From: Don Slice Date: Fri, 20 Jul 2018 15:02:15 +0000 (+0000) Subject: bgpd: make name of default vrf/bgp instance consistent X-Git-Tag: frr-7.0.1~233^2 X-Git-Url: https://git.proxmox.com/?a=commitdiff_plain;h=5742e42b987b979da057e39a764b4d4225d15ad8;p=mirror_frr.git bgpd: make name of default vrf/bgp instance consistent 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 Reviewed-by: CCR-7658 Testing: manual testing and automated tests before pushing --- diff --git a/bgpd/bgp_fsm.c b/bgpd/bgp_fsm.c index 8aa35eddf..1f0cfd6e2 100644 --- a/bgpd/bgp_fsm.c +++ b/bgpd/bgp_fsm.c @@ -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 */ diff --git a/bgpd/bgp_mplsvpn.c b/bgpd/bgp_mplsvpn.c index 385716970..d4204126e 100644 --- a/bgpd/bgp_mplsvpn.c +++ b/bgpd/bgp_mplsvpn.c @@ -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; diff --git a/bgpd/bgp_nexthop.c b/bgpd/bgp_nexthop.c index 5ed6fd6eb..65191ff01 100644 --- a/bgpd/bgp_nexthop.c +++ b/bgpd/bgp_nexthop.c @@ -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); } diff --git a/bgpd/bgp_route.c b/bgpd/bgp_route.c index c20b404f1..7be939f45 100644 --- a/bgpd/bgp_route.c +++ b/bgpd/bgp_route.c @@ -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"); diff --git a/bgpd/bgp_vty.c b/bgpd/bgp_vty.c index ecbe33ff8..2c455750e 100644 --- a/bgpd/bgp_vty.c +++ b/bgpd/bgp_vty.c @@ -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); } diff --git a/bgpd/bgpd.h b/bgpd/bgpd.h index c04fe6903..e14b0f39e 100644 --- a/bgpd/bgpd.h +++ b/bgpd/bgpd.h @@ -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];