]> git.proxmox.com Git - mirror_frr.git/commitdiff
bgpd: fix incorrect config when importing vrf default
authorDon Slice <dslice@cumulusnetworks.com>
Sun, 8 Apr 2018 15:35:21 +0000 (15:35 +0000)
committerDonald Sharp <sharpd@cumulusnetworks.com>
Wed, 25 Apr 2018 16:39:17 +0000 (12:39 -0400)
Found that when doing "import vrf default" in another vrf, an
extra line was added to the configuration in error.   This fix
resolves that incorrect configuration. Manual testing will be
attached to the defect.

Ticket: CM-20467
Signed-off-by: Don Slice <dslice@cumulustnetworks.com>
Reviewed by: Donald Sharp <sharpd@cumulusnetworks.com>

bgpd/bgp_vty.c

index 95abfcb9cb7eee549a87ff6395e6e4d00f4d0163..4c4178495fbe35942b562feba7df8d36db442ecf 100644 (file)
@@ -6676,20 +6676,18 @@ DEFPY (bgp_imexport_vrf,
 
        vrf_bgp = bgp_lookup_by_name(import_name);
        if (!vrf_bgp) {
-               int32_t ret;
+               int32_t ret = 0;
                as_t as = bgp->as;
 
                if (strcmp(import_name, BGP_DEFAULT_NAME) == 0) {
                        vrf_bgp = bgp_get_default();
-                       if (!vrf_bgp) {
-                               bgp_type = BGP_INSTANCE_TYPE_DEFAULT;
-                               import_name = NULL;
-                       }
+                       if (!vrf_bgp)
+                               ret = bgp_get(&vrf_bgp, &as, NULL, BGP_INSTANCE_TYPE_DEFAULT);
+               } else {
+                       /* Auto-create assuming the same AS */
+                       ret = bgp_get(&vrf_bgp, &as, import_name, bgp_type);
                }
 
-               /* Auto-create assuming the same AS */
-               ret = bgp_get(&vrf_bgp, &as, import_name, bgp_type);
-
                if (ret) {
                        vty_out(vty,
                                "VRF %s is not configured as a bgp instance\n",