From: Renato Westphal Date: Fri, 28 Oct 2016 18:53:38 +0000 (-0200) Subject: lib: fix creation of pre-provisioned VRFs X-Git-Tag: frr-2.0-rc1~34^2~11 X-Git-Url: https://git.puffer.fish/?a=commitdiff_plain;h=60f1637a8b35b2968e64dd1619e499033c8068bb;p=matthieu%2Ffrr.git lib: fix creation of pre-provisioned VRFs If we configure a VRF that doesn't match any device in the kernel, we'll fall in the first case of the vrf_get() function. In this function, a vrf structure is callocated and it's vrf_id is never set explicitly, which means it's set to zero (the vrf-id of the default VRF). When this happens, commands like "router-id A.B.C.D vrf ..." will act on the default VRF and not on the pre-provisioned VRF. To fix this, always set the vrf_id of pre-provisioned VRFs to VRF_UNKNOWN. Signed-off-by: Renato Westphal --- diff --git a/lib/vrf.c b/lib/vrf.c index d87e38ebe8..13884aba62 100644 --- a/lib/vrf.c +++ b/lib/vrf.c @@ -124,6 +124,7 @@ vrf_get (vrf_id_t vrf_id, const char *name) zlog_debug ("VRF(%u) %s is created.", vrf_id, (name) ? name : "(NULL)"); strcpy (vrf->name, name); + vrf->vrf_id = VRF_UNKNOWN; listnode_add_sort (vrf_list, vrf); if_init (&vrf->iflist); QOBJ_REG (vrf, vrf);