lib: enforce vrf_name_to_id by returning default_vrf when name is null

in order to enforce the vrf_id to return, from a vrf name, a check is
done on the vrf_name_to_id callback.

Signed-off-by: Philippe Guibert <philippe.guibert@6wind.com>
This commit is contained in:
Philippe Guibert 2018-11-20 10:30:47 +01:00
parent 71c4e0c59b
commit 2569910bb6

View File

@ -330,6 +330,8 @@ vrf_id_t vrf_name_to_id(const char *name)
vrf_id_t vrf_id = VRF_DEFAULT; // Pending: need a way to return invalid
// id/ routine not used.
if (!name)
return vrf_id;
vrf = vrf_lookup_by_name(name);
if (vrf)
vrf_id = vrf->vrf_id;