]> git.proxmox.com Git - mirror_frr.git/commitdiff
bgpd: make name of default vrf/bgp instance consistent
authorDon Slice <dslice@cumulusnetworks.com>
Fri, 20 Jul 2018 15:02:15 +0000 (15:02 +0000)
committerDonald Sharp <sharpd@cumulusnetworks.com>
Wed, 31 Oct 2018 10:20:37 +0000 (06:20 -0400)
Problems were reported with the name of the default vrf and the
default bgp instance being different, creating confusion.  This
fix changes both to "default" for consistency.

Ticket: CM-21791
Signed-off-by: Don Slice <dslice@cumulusnetworks.com>
Reviewed-by: CCR-7658
Testing: manual testing and automated tests before pushing

bgpd/bgp_fsm.c
bgpd/bgp_mplsvpn.c
bgpd/bgp_nexthop.c
bgpd/bgp_route.c
bgpd/bgp_vty.c
bgpd/bgpd.h

index 8aa35eddfcccede59b8b987cce51e98361bc0fe1..1f0cfd6e257e92ce815f9bf14ceccce8430fdfa6 100644 (file)
@@ -1043,8 +1043,9 @@ int bgp_stop(struct peer *peer)
                                "%%ADJCHANGE: neighbor %s(%s) in vrf %s Down %s",
                                peer->host,
                                (peer->hostname) ? peer->hostname : "Unknown",
-                               vrf ? ((vrf->vrf_id != VRF_DEFAULT) ? vrf->name
-                                                                   : "Default")
+                               vrf ? ((vrf->vrf_id != VRF_DEFAULT)
+                                               ? vrf->name
+                                               : VRF_DEFAULT_NAME)
                                    : "",
                                peer_down_str[(int)peer->last_reset]);
                }
@@ -1564,8 +1565,9 @@ static int bgp_establish(struct peer *peer)
                zlog_info("%%ADJCHANGE: neighbor %s(%s) in vrf %s Up",
                          peer->host,
                          (peer->hostname) ? peer->hostname : "Unknown",
-                         vrf ? ((vrf->vrf_id != VRF_DEFAULT) ? vrf->name
-                                                             : "Default")
+                         vrf ? ((vrf->vrf_id != VRF_DEFAULT)
+                                       ? vrf->name
+                                       : VRF_DEFAULT_NAME)
                              : "");
        }
        /* assign update-group/subgroup */
index 385716970b079e013ca38c887958b39aa1cc00e3..d4204126e170476fa90d9ad1f6a2c4f932815e70 100644 (file)
@@ -1492,7 +1492,7 @@ void vrf_import_from_vrf(struct bgp *to_bgp, struct bgp *from_bgp,
        struct ecommunity *ecom;
        bool first_export = false;
 
-       export_name = to_bgp->name ? to_bgp->name : BGP_DEFAULT_NAME;
+       export_name = to_bgp->name ? to_bgp->name : VRF_DEFAULT_NAME;
        idir = BGP_VPN_POLICY_DIR_FROMVPN;
        edir = BGP_VPN_POLICY_DIR_TOVPN;
 
@@ -1501,7 +1501,7 @@ void vrf_import_from_vrf(struct bgp *to_bgp, struct bgp *from_bgp,
         * any VRF is importing from "import_vrf".
         */
        vname = (from_bgp->name ? XSTRDUP(MTYPE_TMP, from_bgp->name)
-                              : XSTRDUP(MTYPE_TMP, BGP_DEFAULT_NAME));
+                              : XSTRDUP(MTYPE_TMP, VRF_DEFAULT_NAME));
 
        listnode_add(to_bgp->vpn_policy[afi].import_vrf, vname);
 
@@ -1557,8 +1557,8 @@ void vrf_unimport_from_vrf(struct bgp *to_bgp, struct bgp *from_bgp,
        struct ecommunity *ecom;
        struct listnode *node;
 
-       export_name = to_bgp->name ? to_bgp->name : BGP_DEFAULT_NAME;
-       tmp_name = from_bgp->name ? from_bgp->name : BGP_DEFAULT_NAME;
+       export_name = to_bgp->name ? to_bgp->name : VRF_DEFAULT_NAME;
+       tmp_name = from_bgp->name ? from_bgp->name : VRF_DEFAULT_NAME;
        idir = BGP_VPN_POLICY_DIR_FROMVPN;
        edir = BGP_VPN_POLICY_DIR_TOVPN;
 
index 5ed6fd6ebedea4880ff0de945ed51f846b884328..65191ff01bf2954821f9b52dcdd12b56e5576afe 100644 (file)
@@ -663,7 +663,7 @@ static void bgp_show_all_instances_nexthops_vty(struct vty *vty)
        for (ALL_LIST_ELEMENTS(bm->bgp, node, nnode, bgp)) {
                vty_out(vty, "\nInstance %s:\n",
                        (bgp->inst_type == BGP_INSTANCE_TYPE_DEFAULT)
-                               ? "Default"
+                               ? VRF_DEFAULT_NAME
                                : bgp->name);
                bgp_show_nexthops(vty, bgp, 0);
        }
index c20b404f19530fc08e967ef346a1ffc537965cd0..7be939f45bb8081b4bb2e9ea69b56260ce7693ba 100644 (file)
@@ -8318,8 +8318,9 @@ static int bgp_show_table(struct vty *vty, struct bgp *bgp, safi_t safi,
                        "{\n \"vrfId\": %d,\n \"vrfName\": \"%s\",\n \"tableVersion\": %" PRId64
                        ",\n \"routerId\": \"%s\",\n \"routes\": { ",
                        bgp->vrf_id == VRF_UNKNOWN ? -1 : (int)bgp->vrf_id,
-                       bgp->inst_type == BGP_INSTANCE_TYPE_DEFAULT ? "Default"
-                                                                   : bgp->name,
+                       bgp->inst_type == BGP_INSTANCE_TYPE_DEFAULT
+                                               ? VRF_DEFAULT_NAME
+                                               : bgp->name,
                        table->version, inet_ntoa(bgp->router_id));
                *json_header_depth = 2;
                if (rd) {
@@ -8695,12 +8696,12 @@ static void bgp_show_all_instances_routes_vty(struct vty *vty, afi_t afi,
 
                        vty_out(vty, "\"%s\":",
                                (bgp->inst_type == BGP_INSTANCE_TYPE_DEFAULT)
-                                       ? "Default"
+                                       ? VRF_DEFAULT_NAME
                                        : bgp->name);
                } else {
                        vty_out(vty, "\nInstance %s:\n",
                                (bgp->inst_type == BGP_INSTANCE_TYPE_DEFAULT)
-                                       ? "Default"
+                                       ? VRF_DEFAULT_NAME
                                        : bgp->name);
                }
                bgp_show(vty, bgp, afi, safi, bgp_show_type_normal, NULL,
@@ -8835,7 +8836,7 @@ void route_vty_out_detail_header(struct vty *vty, struct bgp *bgp,
                                vty_out(vty, ", table %s",
                                        (bgp->inst_type
                                         == BGP_INSTANCE_TYPE_DEFAULT)
-                                               ? "Default-IP-Routing-Table"
+                                               ? VRF_DEFAULT_NAME
                                                : bgp->name);
                } else
                        vty_out(vty, ", no best path");
index ecbe33ff8c51759ed393174add66746990638524..2c455750e7e324cd2d4d5c49ea479d1fd1470c1f 100644 (file)
@@ -6784,7 +6784,7 @@ DEFPY(bgp_imexport_vrf, bgp_imexport_vrf_cmd,
        safi = bgp_node_safi(vty);
 
        if (((BGP_INSTANCE_TYPE_DEFAULT == bgp->inst_type)
-            && (strcmp(import_name, BGP_DEFAULT_NAME) == 0))
+            && (strcmp(import_name, VRF_DEFAULT_NAME) == 0))
            || (bgp->name && (strcmp(import_name, bgp->name) == 0))) {
                vty_out(vty, "%% Cannot %s vrf %s into itself\n",
                        remove ? "unimport" : "import", import_name);
@@ -6806,7 +6806,7 @@ DEFPY(bgp_imexport_vrf, bgp_imexport_vrf_cmd,
 
        vrf_bgp = bgp_lookup_by_name(import_name);
        if (!vrf_bgp) {
-               if (strcmp(import_name, BGP_DEFAULT_NAME) == 0)
+               if (strcmp(import_name, VRF_DEFAULT_NAME) == 0)
                        vrf_bgp = bgp_default;
                else
                        /* Auto-create assuming the same AS */
@@ -7403,7 +7403,7 @@ DEFUN (show_bgp_vrfs,
                }
 
                if (bgp->inst_type == BGP_INSTANCE_TYPE_DEFAULT) {
-                       name = "Default";
+                       name = VRF_DEFAULT_NAME;
                        type = "DFLT";
                } else {
                        name = bgp->name;
@@ -7770,7 +7770,7 @@ static int bgp_show_summary(struct vty *vty, struct bgp *bgp, int afi, int safi,
                                        json, "vrfName",
                                        (bgp->inst_type
                                         == BGP_INSTANCE_TYPE_DEFAULT)
-                                               ? "Default"
+                                               ? VRF_DEFAULT_NAME
                                                : bgp->name);
                        } else {
                                vty_out(vty,
@@ -8188,12 +8188,12 @@ static void bgp_show_all_instances_summary_vty(struct vty *vty, afi_t afi,
 
                        vty_out(vty, "\"%s\":",
                                (bgp->inst_type == BGP_INSTANCE_TYPE_DEFAULT)
-                                       ? "Default"
+                                       ? VRF_DEFAULT_NAME
                                        : bgp->name);
                } else {
                        vty_out(vty, "\nInstance %s:\n",
                                (bgp->inst_type == BGP_INSTANCE_TYPE_DEFAULT)
-                                       ? "Default"
+                                       ? VRF_DEFAULT_NAME
                                        : bgp->name);
                }
                bgp_show_summary_afi_safi(vty, bgp, afi, safi, use_json, json);
@@ -10843,7 +10843,7 @@ static void bgp_show_all_instances_neighbors_vty(struct vty *vty,
                        json_object_string_add(
                                json, "vrfName",
                                (bgp->inst_type == BGP_INSTANCE_TYPE_DEFAULT)
-                                       ? "Default"
+                                       ? VRF_DEFAULT_NAME
                                        : bgp->name);
 
                        if (!is_first)
@@ -10853,12 +10853,12 @@ static void bgp_show_all_instances_neighbors_vty(struct vty *vty,
 
                        vty_out(vty, "\"%s\":",
                                (bgp->inst_type == BGP_INSTANCE_TYPE_DEFAULT)
-                                       ? "Default"
+                                       ? VRF_DEFAULT_NAME
                                        : bgp->name);
                } else {
                        vty_out(vty, "\nInstance %s:\n",
                                (bgp->inst_type == BGP_INSTANCE_TYPE_DEFAULT)
-                                       ? "Default"
+                                       ? VRF_DEFAULT_NAME
                                        : bgp->name);
                }
 
@@ -11292,7 +11292,7 @@ static void bgp_show_all_instances_updgrps_vty(struct vty *vty, afi_t afi,
        for (ALL_LIST_ELEMENTS(bm->bgp, node, nnode, bgp)) {
                vty_out(vty, "\nInstance %s:\n",
                        (bgp->inst_type == BGP_INSTANCE_TYPE_DEFAULT)
-                               ? "Default"
+                               ? VRF_DEFAULT_NAME
                                : bgp->name);
                update_group_show(bgp, afi, safi, vty, 0);
        }
index c04fe69035347e14c515890c0c9fbd8cf2dcc510..e14b0f39e027fe4426d7a16f8458a54f2170fac2 100644 (file)
@@ -368,7 +368,6 @@ struct bgp {
 /* vrf-route leaking flags */
 #define BGP_CONFIG_VRF_TO_VRF_IMPORT                   (1 << 7)
 #define BGP_CONFIG_VRF_TO_VRF_EXPORT                   (1 << 8)
-#define BGP_DEFAULT_NAME               "default"
 
        /* Route table for next-hop lookup cache. */
        struct bgp_table *nexthop_cache_table[AFI_MAX];