mirror of
https://git.proxmox.com/git/mirror_frr
synced 2025-08-04 00:28:57 +00:00
lib: set default vrf name at startup
For the daemons that do not use vrf_init(), the call to the define will return a default vrf if no other values has been overriden. Signed-off-by: Philippe Guibert <philippe.guibert@6wind.com>
This commit is contained in:
parent
9a8bdf1c25
commit
fdafe17ee9
@ -466,7 +466,10 @@ void vrf_init(int (*create)(struct vrf *), int (*enable)(struct vrf *),
|
||||
int ((*update)(struct vrf *)))
|
||||
{
|
||||
struct vrf *default_vrf;
|
||||
char *local_ptr = (char *)VRF_DEFAULT_NAME;
|
||||
|
||||
if (local_ptr)
|
||||
vrf_default_name = XSTRDUP(MTYPE_VRF, local_ptr);
|
||||
/* initialise NS, in case VRF backend if NETNS */
|
||||
ns_init();
|
||||
if (debug_vrf)
|
||||
@ -480,12 +483,15 @@ void vrf_init(int (*create)(struct vrf *), int (*enable)(struct vrf *),
|
||||
vrf_master.vrf_update_name_hook = update;
|
||||
|
||||
/* The default VRF always exists. */
|
||||
default_vrf = vrf_get(VRF_DEFAULT, VRF_DEFAULT_NAME);
|
||||
default_vrf = vrf_get(VRF_DEFAULT, vrf_default_name);
|
||||
if (!default_vrf) {
|
||||
flog_err(LIB_ERR_VRF_START,
|
||||
"vrf_init: failed to create the default VRF!");
|
||||
exit(1);
|
||||
}
|
||||
if (vrf_is_backend_netns())
|
||||
strlcpy(default_vrf->data.l.netns_name,
|
||||
vrf_default_name, NS_NAMSIZ);
|
||||
|
||||
/* Enable the default VRF. */
|
||||
if (!vrf_enable(default_vrf)) {
|
||||
|
Loading…
Reference in New Issue
Block a user