mirror of
https://git.proxmox.com/git/mirror_frr
synced 2025-08-05 18:42:23 +00:00
vrf: return vrf implementation for default vrf
To correct potential crash with netns implementation of vrf (see next commit) it is necessary to allow any daemons to know the vrf implementation whatever the vrf. With current implementation the daemons do not know the vrf implementation for the default vrf. For this vrf the returned vrf implementation is always vrf-lite. To solve this issue a netns name is set to the default vrf to just test is presence to know the used implementation. For zebra a netns name (if needed) is set in the vrf_init function just before enabling the vrf. So this information is propagated to the other daemons thanks the zapi message called when the vrf is enable at zebra layer and override the default configuration (vrf-lite) of the daemon. Signed-off-by: Thibaut Collet <thibaut.collet@6wind.com>
This commit is contained in:
parent
f177317a20
commit
20c87e98d8
12
lib/vrf.c
12
lib/vrf.c
@ -497,6 +497,16 @@ void vrf_init(int (*create)(struct vrf *), int (*enable)(struct vrf *),
|
||||
strlcpy(default_vrf->data.l.netns_name,
|
||||
VRF_DEFAULT_NAME, NS_NAMSIZ);
|
||||
|
||||
if (vrf_is_backend_netns()) {
|
||||
struct ns *ns;
|
||||
|
||||
strlcpy(default_vrf->data.l.netns_name,
|
||||
VRF_DEFAULT_NAME, NS_NAMSIZ);
|
||||
ns = ns_lookup(ns_get_default_id());
|
||||
ns->vrf_ctxt = (void *)default_vrf;
|
||||
default_vrf->ns_ctxt = (void *)ns;
|
||||
}
|
||||
|
||||
/* Enable the default VRF. */
|
||||
if (!vrf_enable(default_vrf)) {
|
||||
flog_err(LIB_ERR_VRF_START,
|
||||
@ -711,8 +721,6 @@ int vrf_is_mapped_on_netns(struct vrf *vrf)
|
||||
{
|
||||
if (!vrf || vrf->data.l.netns_name[0] == '\0')
|
||||
return 0;
|
||||
if (vrf->vrf_id == VRF_DEFAULT)
|
||||
return 0;
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user