mirror of
https://git.proxmox.com/git/mirror_frr
synced 2025-08-16 10:38:05 +00:00
Merge pull request #3205 from donaldsharp/default
bgpd: make name of default vrf/bgp instance consistent
This commit is contained in:
commit
591328ffc6
@ -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 */
|
||||
|
@ -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;
|
||||
|
||||
|
@ -666,7 +666,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);
|
||||
}
|
||||
|
@ -8365,7 +8365,8 @@ 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->inst_type == BGP_INSTANCE_TYPE_DEFAULT
|
||||
? VRF_DEFAULT_NAME
|
||||
: bgp->name,
|
||||
table->version, inet_ntoa(bgp->router_id));
|
||||
*json_header_depth = 2;
|
||||
@ -8742,12 +8743,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,
|
||||
@ -8882,7 +8883,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");
|
||||
|
@ -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,
|
||||
@ -8197,12 +8197,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);
|
||||
@ -10852,7 +10852,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)
|
||||
@ -10862,12 +10862,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);
|
||||
}
|
||||
|
||||
@ -11301,7 +11301,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);
|
||||
}
|
||||
|
@ -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];
|
||||
|
Loading…
Reference in New Issue
Block a user