diff options
author | Philippe Guibert <philippe.guibert@6wind.com> | 2018-05-31 10:12:11 +0200 |
---|---|---|
committer | Philippe Guibert <philippe.guibert@6wind.com> | 2018-08-28 16:23:50 +0200 |
commit | 9a8bdf1c25180e7c00b525c6c8de26cc2f713fb2 (patch) | |
tree | ec151489ac2791dd17ab021ce21429912134ef22 /bgpd/bgp_main.c | |
parent | ospfd: adaptations to handle vrf alias (diff) | |
download | frr-9a8bdf1c25180e7c00b525c6c8de26cc2f713fb2.tar.xz frr-9a8bdf1c25180e7c00b525c6c8de26cc2f713fb2.zip |
bgpd: handle vrf aliases in vty API
Because a VRF name can be used for default VRF, or an alias of an
already created VRF can be passed as parameter, the default VRF name
must be found out. This avoids creating double BGP instances for
example.
Signed-off-by: Philippe Guibert <philippe.guibert@6wind.com>
Diffstat (limited to 'bgpd/bgp_main.c')
-rw-r--r-- | bgpd/bgp_main.c | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/bgpd/bgp_main.c b/bgpd/bgp_main.c index 2308a32a2..e0834604b 100644 --- a/bgpd/bgp_main.c +++ b/bgpd/bgp_main.c @@ -266,6 +266,12 @@ static int bgp_vrf_enable(struct vrf *vrf) bgp = bgp_lookup_by_name(vrf->name); if (bgp) { + if (bgp->name && strmatch(vrf->name, VRF_DEFAULT_NAME)) { + XFREE(MTYPE_BGP, bgp->name); + bgp->name = NULL; + XFREE(MTYPE_BGP, bgp->name_pretty); + bgp->name_pretty = XSTRDUP(MTYPE_BGP, "VRF default"); + } old_vrf_id = bgp->vrf_id; /* We have instance configured, link to VRF and make it "up". */ bgp_vrf_link(bgp, vrf); |