Merge branch 'master' into type5-with-asymm

This commit is contained in:
Mitesh Kanjariya 2018-02-12 02:05:00 -08:00 committed by GitHub
commit efc812a379
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
11 changed files with 515 additions and 516 deletions

View File

@ -385,8 +385,8 @@ int bgp_dump_attr(struct attr *attr, char *buf, size_t size)
if (CHECK_FLAG(attr->flag, ATTR_FLAG_BIT(BGP_ATTR_COMMUNITIES))) if (CHECK_FLAG(attr->flag, ATTR_FLAG_BIT(BGP_ATTR_COMMUNITIES)))
snprintf(buf + strlen(buf), size - strlen(buf), snprintf(buf + strlen(buf), size - strlen(buf),
", community %s", community_str(attr->community, ", community %s",
false)); community_str(attr->community, false));
if (CHECK_FLAG(attr->flag, ATTR_FLAG_BIT(BGP_ATTR_EXT_COMMUNITIES))) if (CHECK_FLAG(attr->flag, ATTR_FLAG_BIT(BGP_ATTR_EXT_COMMUNITIES)))
snprintf(buf + strlen(buf), size - strlen(buf), snprintf(buf + strlen(buf), size - strlen(buf),

View File

@ -153,9 +153,9 @@ extern int bgp_debug_zebra(struct prefix *p);
extern int bgp_debug_count(void); extern int bgp_debug_count(void);
extern const char *bgp_debug_rdpfxpath2str(afi_t, safi_t, struct prefix_rd *, extern const char *bgp_debug_rdpfxpath2str(afi_t, safi_t, struct prefix_rd *,
union prefixconstptr, union prefixconstptr, mpls_label_t *,
mpls_label_t *, u_int32_t, u_int32_t, int, u_int32_t, char *,
int, u_int32_t, char *, int); int);
const char *bgp_notify_admin_message(char *buf, size_t bufsz, u_char *data, const char *bgp_notify_admin_message(char *buf, size_t bufsz, u_char *data,
size_t datalen); size_t datalen);

View File

@ -366,8 +366,8 @@ int bgp_show_mpls_vpn(struct vty *vty, afi_t afi, struct prefix_rd *prd,
return CMD_WARNING; return CMD_WARNING;
} }
table = bgp->rib[afi][SAFI_MPLS_VPN]; table = bgp->rib[afi][SAFI_MPLS_VPN];
return bgp_show_table_rd(vty, bgp, SAFI_MPLS_VPN, return bgp_show_table_rd(vty, bgp, SAFI_MPLS_VPN, table, prd, type,
table, prd, type, output_arg, use_json); output_arg, use_json);
} }
DEFUN (show_bgp_ip_vpn_all_rd, DEFUN (show_bgp_ip_vpn_all_rd,

File diff suppressed because it is too large Load Diff

View File

@ -618,8 +618,7 @@ static route_map_result_t route_match_mac_address(void *rule,
p.prefixlen = ETH_ALEN * 8; p.prefixlen = ETH_ALEN * 8;
p.u.prefix_eth = prefix->u.prefix_evpn.mac; p.u.prefix_eth = prefix->u.prefix_evpn.mac;
return (access_list_apply(alist, &p) return (access_list_apply(alist, &p) == FILTER_DENY
== FILTER_DENY
? RMAP_NOMATCH ? RMAP_NOMATCH
: RMAP_MATCH); : RMAP_MATCH);
} }
@ -3860,7 +3859,8 @@ DEFUN (set_community,
buffer_putstr(b, "no-export"); buffer_putstr(b, "no-export");
continue; continue;
} }
if (strncmp(argv[i]->arg, "graceful-shutdown", strlen(argv[i]->arg)) if (strncmp(argv[i]->arg, "graceful-shutdown",
strlen(argv[i]->arg))
== 0) { == 0) {
buffer_putstr(b, "graceful-shutdown"); buffer_putstr(b, "graceful-shutdown");
continue; continue;

View File

@ -1540,7 +1540,8 @@ DEFUN (no_bgp_maxpaths,
} }
ALIAS_HIDDEN(no_bgp_maxpaths, no_bgp_maxpaths_hidden_cmd, ALIAS_HIDDEN(no_bgp_maxpaths, no_bgp_maxpaths_hidden_cmd,
"no maximum-paths [" CMD_RANGE_STR(1, MULTIPATH_NUM) "]", NO_STR "no maximum-paths [" CMD_RANGE_STR(1, MULTIPATH_NUM) "]",
NO_STR
"Forward packets over multiple paths\n" "Forward packets over multiple paths\n"
"Number of paths\n") "Number of paths\n")
@ -4363,22 +4364,22 @@ DEFUN (neighbor_attr_unchanged,
SET_FLAG(flags, PEER_FLAG_NEXTHOP_UNCHANGED); SET_FLAG(flags, PEER_FLAG_NEXTHOP_UNCHANGED);
SET_FLAG(flags, PEER_FLAG_MED_UNCHANGED); SET_FLAG(flags, PEER_FLAG_MED_UNCHANGED);
} else { } else {
if (!CHECK_FLAG(flags, PEER_FLAG_AS_PATH_UNCHANGED) && if (!CHECK_FLAG(flags, PEER_FLAG_AS_PATH_UNCHANGED)
peer_af_flag_check(peer, afi, safi, && peer_af_flag_check(peer, afi, safi,
PEER_FLAG_AS_PATH_UNCHANGED)) { PEER_FLAG_AS_PATH_UNCHANGED)) {
peer_af_flag_unset_vty(vty, peer_str, afi, safi, peer_af_flag_unset_vty(vty, peer_str, afi, safi,
PEER_FLAG_AS_PATH_UNCHANGED); PEER_FLAG_AS_PATH_UNCHANGED);
} }
if (!CHECK_FLAG(flags, PEER_FLAG_NEXTHOP_UNCHANGED) && if (!CHECK_FLAG(flags, PEER_FLAG_NEXTHOP_UNCHANGED)
peer_af_flag_check(peer, afi, safi, && peer_af_flag_check(peer, afi, safi,
PEER_FLAG_NEXTHOP_UNCHANGED)) { PEER_FLAG_NEXTHOP_UNCHANGED)) {
peer_af_flag_unset_vty(vty, peer_str, afi, safi, peer_af_flag_unset_vty(vty, peer_str, afi, safi,
PEER_FLAG_NEXTHOP_UNCHANGED); PEER_FLAG_NEXTHOP_UNCHANGED);
} }
if (!CHECK_FLAG(flags, PEER_FLAG_MED_UNCHANGED) && if (!CHECK_FLAG(flags, PEER_FLAG_MED_UNCHANGED)
peer_af_flag_check(peer, afi, safi, && peer_af_flag_check(peer, afi, safi,
PEER_FLAG_MED_UNCHANGED)) { PEER_FLAG_MED_UNCHANGED)) {
peer_af_flag_unset_vty(vty, peer_str, afi, safi, peer_af_flag_unset_vty(vty, peer_str, afi, safi,
PEER_FLAG_MED_UNCHANGED); PEER_FLAG_MED_UNCHANGED);
@ -6125,8 +6126,8 @@ DEFUN_NOSH (address_family_ipv4_safi,
if (argc == 3) { if (argc == 3) {
VTY_DECLVAR_CONTEXT(bgp, bgp); VTY_DECLVAR_CONTEXT(bgp, bgp);
safi_t safi = bgp_vty_safi_from_str(argv[2]->text); safi_t safi = bgp_vty_safi_from_str(argv[2]->text);
if (bgp->inst_type != BGP_INSTANCE_TYPE_DEFAULT && if (bgp->inst_type != BGP_INSTANCE_TYPE_DEFAULT
safi != SAFI_UNICAST && safi != SAFI_MULTICAST && safi != SAFI_UNICAST && safi != SAFI_MULTICAST
&& safi != SAFI_EVPN) { && safi != SAFI_EVPN) {
vty_out(vty, vty_out(vty,
"Only Unicast/Multicast/EVPN SAFIs supported in non-core instances.\n"); "Only Unicast/Multicast/EVPN SAFIs supported in non-core instances.\n");
@ -6149,8 +6150,8 @@ DEFUN_NOSH (address_family_ipv6_safi,
if (argc == 3) { if (argc == 3) {
VTY_DECLVAR_CONTEXT(bgp, bgp); VTY_DECLVAR_CONTEXT(bgp, bgp);
safi_t safi = bgp_vty_safi_from_str(argv[2]->text); safi_t safi = bgp_vty_safi_from_str(argv[2]->text);
if (bgp->inst_type != BGP_INSTANCE_TYPE_DEFAULT && if (bgp->inst_type != BGP_INSTANCE_TYPE_DEFAULT
safi != SAFI_UNICAST && safi != SAFI_MULTICAST && safi != SAFI_UNICAST && safi != SAFI_MULTICAST
&& safi != SAFI_EVPN) { && safi != SAFI_EVPN) {
vty_out(vty, vty_out(vty,
"Only Unicast/Multicast/EVPN SAFIs supported in non-core instances.\n"); "Only Unicast/Multicast/EVPN SAFIs supported in non-core instances.\n");
@ -6537,8 +6538,9 @@ DEFUN (show_bgp_vrfs,
if (uj) { if (uj) {
int64_t vrf_id_ui = (bgp->vrf_id == VRF_UNKNOWN) ? -1 : int64_t vrf_id_ui = (bgp->vrf_id == VRF_UNKNOWN)
(int64_t)bgp->vrf_id; ? -1
: (int64_t)bgp->vrf_id;
json_object_string_add(json_vrf, "type", type); json_object_string_add(json_vrf, "type", type);
json_object_int_add(json_vrf, "vrfId", vrf_id_ui); json_object_int_add(json_vrf, "vrfId", vrf_id_ui);
json_object_string_add(json_vrf, "routerId", json_object_string_add(json_vrf, "routerId",
@ -6549,17 +6551,18 @@ DEFUN (show_bgp_vrfs,
peers_estb); peers_estb);
json_object_int_add(json_vrf, "l3vni", bgp->l3vni); json_object_int_add(json_vrf, "l3vni", bgp->l3vni);
json_object_string_add(json_vrf, "rmac", json_object_string_add(
prefix_mac2str(&bgp->rmac, buf, json_vrf, "rmac",
sizeof(buf))); prefix_mac2str(&bgp->rmac, buf, sizeof(buf)));
json_object_object_add(json_vrfs, name, json_vrf); json_object_object_add(json_vrfs, name, json_vrf);
} else } else
vty_out(vty, vty_out(vty,
"%4s %-5d %-16s %9u %10u %-37s %-10u %-15s\n", "%4s %-5d %-16s %9u %10u %-37s %-10u %-15s\n",
type, bgp->vrf_id == VRF_UNKNOWN ? type,
-1 : (int)bgp->vrf_id, bgp->vrf_id == VRF_UNKNOWN ? -1
inet_ntoa(bgp->router_id), : (int)bgp->vrf_id,
peers_cfg, peers_estb, name, bgp->l3vni, inet_ntoa(bgp->router_id), peers_cfg,
peers_estb, name, bgp->l3vni,
prefix_mac2str(&bgp->rmac, buf, sizeof(buf))); prefix_mac2str(&bgp->rmac, buf, sizeof(buf)));
} }
@ -6568,7 +6571,8 @@ DEFUN (show_bgp_vrfs,
json_object_int_add(json, "totalVrfs", count); json_object_int_add(json, "totalVrfs", count);
vty_out(vty, "%s\n", json_object_to_json_string_ext( vty_out(vty, "%s\n",
json_object_to_json_string_ext(
json, JSON_C_TO_STRING_PRETTY)); json, JSON_C_TO_STRING_PRETTY));
json_object_free(json); json_object_free(json);
} else { } else {
@ -6718,16 +6722,19 @@ DEFUN (show_bgp_memory,
/* Other attributes */ /* Other attributes */
if ((count = community_count())) if ((count = community_count()))
vty_out(vty, "%ld BGP community entries, using %s of memory\n", vty_out(vty, "%ld BGP community entries, using %s of memory\n",
count, mtype_memstr(memstrbuf, sizeof(memstrbuf), count,
mtype_memstr(memstrbuf, sizeof(memstrbuf),
count * sizeof(struct community))); count * sizeof(struct community)));
if ((count = mtype_stats_alloc(MTYPE_ECOMMUNITY))) if ((count = mtype_stats_alloc(MTYPE_ECOMMUNITY)))
vty_out(vty, "%ld BGP community entries, using %s of memory\n", vty_out(vty, "%ld BGP community entries, using %s of memory\n",
count, mtype_memstr(memstrbuf, sizeof(memstrbuf), count,
mtype_memstr(memstrbuf, sizeof(memstrbuf),
count * sizeof(struct ecommunity))); count * sizeof(struct ecommunity)));
if ((count = mtype_stats_alloc(MTYPE_LCOMMUNITY))) if ((count = mtype_stats_alloc(MTYPE_LCOMMUNITY)))
vty_out(vty, vty_out(vty,
"%ld BGP large-community entries, using %s of memory\n", "%ld BGP large-community entries, using %s of memory\n",
count, mtype_memstr(memstrbuf, sizeof(memstrbuf), count,
mtype_memstr(memstrbuf, sizeof(memstrbuf),
count * sizeof(struct lcommunity))); count * sizeof(struct lcommunity)));
if ((count = mtype_stats_alloc(MTYPE_CLUSTER))) if ((count = mtype_stats_alloc(MTYPE_CLUSTER)))
@ -6757,7 +6764,8 @@ DEFUN (show_bgp_memory,
count * sizeof(struct hash_backet))); count * sizeof(struct hash_backet)));
if ((count = mtype_stats_alloc(MTYPE_BGP_REGEXP))) if ((count = mtype_stats_alloc(MTYPE_BGP_REGEXP)))
vty_out(vty, "%ld compiled regexes, using %s of memory\n", vty_out(vty, "%ld compiled regexes, using %s of memory\n",
count, mtype_memstr(memstrbuf, sizeof(memstrbuf), count,
mtype_memstr(memstrbuf, sizeof(memstrbuf),
count * sizeof(regex_t))); count * sizeof(regex_t)));
return CMD_SUCCESS; return CMD_SUCCESS;
} }
@ -6773,27 +6781,21 @@ static void bgp_show_bestpath_json(struct bgp *bgp, json_object *json)
json_object_string_add(bestpath, "asPath", "confed"); json_object_string_add(bestpath, "asPath", "confed");
if (bgp_flag_check(bgp, BGP_FLAG_ASPATH_MULTIPATH_RELAX)) { if (bgp_flag_check(bgp, BGP_FLAG_ASPATH_MULTIPATH_RELAX)) {
if (bgp_flag_check(bgp, if (bgp_flag_check(bgp, BGP_FLAG_MULTIPATH_RELAX_AS_SET))
BGP_FLAG_MULTIPATH_RELAX_AS_SET)) json_object_string_add(bestpath, "multiPathRelax",
json_object_string_add(bestpath,
"multiPathRelax",
"as-set"); "as-set");
else else
json_object_string_add(bestpath, json_object_string_add(bestpath, "multiPathRelax",
"multiPathRelax",
"true"); "true");
} else } else
json_object_string_add(bestpath, json_object_string_add(bestpath, "multiPathRelax", "false");
"multiPathRelax",
"false");
if (bgp_flag_check(bgp, BGP_FLAG_COMPARE_ROUTER_ID)) if (bgp_flag_check(bgp, BGP_FLAG_COMPARE_ROUTER_ID))
json_object_string_add(bestpath, "compareRouterId", "true"); json_object_string_add(bestpath, "compareRouterId", "true");
if (bgp_flag_check(bgp, BGP_FLAG_MED_CONFED) if (bgp_flag_check(bgp, BGP_FLAG_MED_CONFED)
|| bgp_flag_check(bgp, BGP_FLAG_MED_MISSING_AS_WORST)) { || bgp_flag_check(bgp, BGP_FLAG_MED_MISSING_AS_WORST)) {
if (bgp_flag_check(bgp, BGP_FLAG_MED_CONFED)) if (bgp_flag_check(bgp, BGP_FLAG_MED_CONFED))
json_object_string_add(bestpath, "med", json_object_string_add(bestpath, "med", "confed");
"confed");
if (bgp_flag_check(bgp, BGP_FLAG_MED_MISSING_AS_WORST)) if (bgp_flag_check(bgp, BGP_FLAG_MED_MISSING_AS_WORST))
json_object_string_add(bestpath, "med", json_object_string_add(bestpath, "med",
"missing-as-worst"); "missing-as-worst");
@ -6884,9 +6886,9 @@ static int bgp_show_summary(struct vty *vty, struct bgp *bgp, int afi, int safi,
char memstrbuf[MTYPE_MEMSTR_LEN]; char memstrbuf[MTYPE_MEMSTR_LEN];
int64_t vrf_id_ui; int64_t vrf_id_ui;
vrf_id_ui = vrf_id_ui = (bgp->vrf_id == VRF_UNKNOWN)
(bgp->vrf_id == VRF_UNKNOWN) ? -1 : ? -1
(int64_t)bgp->vrf_id; : (int64_t)bgp->vrf_id;
/* Usage summary and header */ /* Usage summary and header */
if (use_json) { if (use_json) {
@ -6905,8 +6907,9 @@ static int bgp_show_summary(struct vty *vty, struct bgp *bgp, int afi, int safi,
vty_out(vty, vty_out(vty,
"BGP router identifier %s, local AS number %u vrf-id %d", "BGP router identifier %s, local AS number %u vrf-id %d",
inet_ntoa(bgp->router_id), bgp->as, inet_ntoa(bgp->router_id), bgp->as,
bgp->vrf_id == VRF_UNKNOWN ? -1 : bgp->vrf_id == VRF_UNKNOWN
(int)bgp->vrf_id); ? -1
: (int)bgp->vrf_id);
vty_out(vty, "\n"); vty_out(vty, "\n");
} }
@ -7015,7 +7018,8 @@ static int bgp_show_summary(struct vty *vty, struct bgp *bgp, int afi, int safi,
json, "peerGroupCount", ents); json, "peerGroupCount", ents);
json_object_int_add( json_object_int_add(
json, "peerGroupMemory", json, "peerGroupMemory",
ents * sizeof(struct ents
* sizeof(struct
peer_group)); peer_group));
} }
@ -7039,9 +7043,10 @@ static int bgp_show_summary(struct vty *vty, struct bgp *bgp, int afi, int safi,
vty_out(vty, vty_out(vty,
"RIB entries %ld, using %s of memory\n", "RIB entries %ld, using %s of memory\n",
ents, ents,
mtype_memstr(memstrbuf, mtype_memstr(
sizeof(memstrbuf), memstrbuf, sizeof(memstrbuf),
ents * sizeof(struct ents
* sizeof(struct
bgp_node))); bgp_node)));
/* Peer related usage */ /* Peer related usage */
@ -7059,7 +7064,8 @@ static int bgp_show_summary(struct vty *vty, struct bgp *bgp, int afi, int safi,
mtype_memstr( mtype_memstr(
memstrbuf, memstrbuf,
sizeof(memstrbuf), sizeof(memstrbuf),
ents * sizeof(struct ents
* sizeof(struct
peer_group))); peer_group)));
if (CHECK_FLAG(bgp->af_flags[afi][safi], if (CHECK_FLAG(bgp->af_flags[afi][safi],
@ -7165,7 +7171,8 @@ static int bgp_show_summary(struct vty *vty, struct bgp *bgp, int afi, int safi,
if (peer->status == Established) if (peer->status == Established)
if (peer->afc_recv[afi][pfx_rcd_safi]) if (peer->afc_recv[afi][pfx_rcd_safi])
vty_out(vty, " %12ld", vty_out(vty, " %12ld",
peer->pcount[afi][pfx_rcd_safi]); peer->pcount[afi]
[pfx_rcd_safi]);
else else
vty_out(vty, " NoNeg"); vty_out(vty, " NoNeg");
else { else {
@ -7192,7 +7199,8 @@ static int bgp_show_summary(struct vty *vty, struct bgp *bgp, int afi, int safi,
bgp_show_bestpath_json(bgp, json); bgp_show_bestpath_json(bgp, json);
vty_out(vty, "%s\n", json_object_to_json_string_ext( vty_out(vty, "%s\n",
json_object_to_json_string_ext(
json, JSON_C_TO_STRING_PRETTY)); json, JSON_C_TO_STRING_PRETTY));
json_object_free(json); json_object_free(json);
} else { } else {
@ -7829,8 +7837,9 @@ static void bgp_show_peer_afi(struct vty *vty, struct peer *p, afi_t afi,
paf = peer_af_find(p, afi, safi); paf = peer_af_find(p, afi, safi);
if (paf && PAF_SUBGRP(paf)) { if (paf && PAF_SUBGRP(paf)) {
vty_out(vty, " Update group %" PRIu64 vty_out(vty,
", subgroup %" PRIu64 "\n", " Update group %" PRIu64 ", subgroup %" PRIu64
"\n",
PAF_UPDGRP(paf)->id, PAF_SUBGRP(paf)->id); PAF_UPDGRP(paf)->id, PAF_SUBGRP(paf)->id);
vty_out(vty, " Packet Queue length %d\n", vty_out(vty, " Packet Queue length %d\n",
bpacket_queue_virtual_length(paf)); bpacket_queue_virtual_length(paf));
@ -8300,7 +8309,8 @@ static void bgp_show_peer(struct vty *vty, struct peer *p, u_char use_json,
epoch_tbuf = time(NULL) - uptime; epoch_tbuf = time(NULL) - uptime;
#if CONFDATE > 20200101 #if CONFDATE > 20200101
CPP_NOTICE("bgpTimerUp should be deprecated and can be removed now"); CPP_NOTICE(
"bgpTimerUp should be deprecated and can be removed now");
#endif #endif
/* /*
* bgpTimerUp was miliseconds that was accurate * bgpTimerUp was miliseconds that was accurate
@ -8376,8 +8386,8 @@ static void bgp_show_peer(struct vty *vty, struct peer *p, u_char use_json,
"bgpTimerConfiguredKeepAliveIntervalMsecs", "bgpTimerConfiguredKeepAliveIntervalMsecs",
p->keepalive * 1000); p->keepalive * 1000);
} else if ((bgp->default_holdtime != BGP_DEFAULT_HOLDTIME) } else if ((bgp->default_holdtime != BGP_DEFAULT_HOLDTIME)
|| (bgp->default_keepalive != || (bgp->default_keepalive
BGP_DEFAULT_KEEPALIVE)) { != BGP_DEFAULT_KEEPALIVE)) {
json_object_int_add(json_neigh, json_object_int_add(json_neigh,
"bgpTimerConfiguredHoldTimeMsecs", "bgpTimerConfiguredHoldTimeMsecs",
bgp->default_holdtime); bgp->default_holdtime);
@ -8437,8 +8447,8 @@ static void bgp_show_peer(struct vty *vty, struct peer *p, u_char use_json,
vty_out(vty, ", keepalive interval is %d seconds\n", vty_out(vty, ", keepalive interval is %d seconds\n",
p->keepalive); p->keepalive);
} else if ((bgp->default_holdtime != BGP_DEFAULT_HOLDTIME) } else if ((bgp->default_holdtime != BGP_DEFAULT_HOLDTIME)
|| (bgp->default_keepalive != || (bgp->default_keepalive
BGP_DEFAULT_KEEPALIVE)) { != BGP_DEFAULT_KEEPALIVE)) {
vty_out(vty, " Configured hold time is %d", vty_out(vty, " Configured hold time is %d",
bgp->default_holdtime); bgp->default_holdtime);
vty_out(vty, ", keepalive interval is %d seconds\n", vty_out(vty, ", keepalive interval is %d seconds\n",
@ -9629,7 +9639,8 @@ static void bgp_show_peer(struct vty *vty, struct peer *p, u_char use_json,
} else } else
vty_out(vty, vty_out(vty,
" Reduce the no. of prefix from %s, will restart in %ld seconds\n", " Reduce the no. of prefix from %s, will restart in %ld seconds\n",
p->host, thread_timer_remain_second( p->host,
thread_timer_remain_second(
p->t_pmax_restart)); p->t_pmax_restart));
} else { } else {
if (use_json) if (use_json)
@ -9874,7 +9885,8 @@ static int bgp_show_neighbor(struct vty *vty, struct bgp *bgp,
} }
if (use_json) { if (use_json) {
vty_out(vty, "%s\n", json_object_to_json_string_ext( vty_out(vty, "%s\n",
json_object_to_json_string_ext(
json, JSON_C_TO_STRING_PRETTY)); json, JSON_C_TO_STRING_PRETTY));
json_object_free(json); json_object_free(json);
} else { } else {
@ -9910,7 +9922,8 @@ static void bgp_show_all_instances_neighbors_vty(struct vty *vty,
json_object_int_add(json, "vrfId", json_object_int_add(json, "vrfId",
(bgp->vrf_id == VRF_UNKNOWN) (bgp->vrf_id == VRF_UNKNOWN)
? -1 : (int64_t) bgp->vrf_id); ? -1
: (int64_t)bgp->vrf_id);
json_object_string_add( json_object_string_add(
json, "vrfName", json, "vrfName",
(bgp->inst_type == BGP_INSTANCE_TYPE_DEFAULT) (bgp->inst_type == BGP_INSTANCE_TYPE_DEFAULT)
@ -10645,7 +10658,8 @@ DEFUN (show_ip_bgp_peer_groups,
vrf = pg = NULL; vrf = pg = NULL;
int idx = 0; int idx = 0;
vrf = argv_find(argv, argc, "VIEWVRFNAME", &idx) ? argv[idx]->arg : NULL; vrf = argv_find(argv, argc, "VIEWVRFNAME", &idx) ? argv[idx]->arg
: NULL;
pg = argv_find(argv, argc, "PGNAME", &idx) ? argv[idx]->arg : NULL; pg = argv_find(argv, argc, "PGNAME", &idx) ? argv[idx]->arg : NULL;
return bgp_show_peer_group_vty(vty, vrf, pg); return bgp_show_peer_group_vty(vty, vrf, pg);

View File

@ -570,8 +570,8 @@ static int zebra_read_route(int command, struct zclient *zclient,
/* Now perform the add/update. */ /* Now perform the add/update. */
bgp_redistribute_add(bgp, &api.prefix, &nexthop, ifindex, bgp_redistribute_add(bgp, &api.prefix, &nexthop, ifindex,
nhtype, api.metric, api.type, nhtype, api.metric, api.type, api.instance,
api.instance, api.tag); api.tag);
} else { } else {
bgp_redistribute_delete(bgp, &api.prefix, api.type, bgp_redistribute_delete(bgp, &api.prefix, api.type,
api.instance); api.instance);
@ -1142,8 +1142,8 @@ void bgp_zebra_announce(struct bgp_node *rn, struct prefix *p,
api_nh->type = NEXTHOP_TYPE_IPV6_IFINDEX; api_nh->type = NEXTHOP_TYPE_IPV6_IFINDEX;
} }
if (mpinfo->extra && if (mpinfo->extra
bgp_is_valid_label(&mpinfo->extra->label[0]) && bgp_is_valid_label(&mpinfo->extra->label[0])
&& !CHECK_FLAG(api.flags, ZEBRA_FLAG_EVPN_ROUTE)) { && !CHECK_FLAG(api.flags, ZEBRA_FLAG_EVPN_ROUTE)) {
has_valid_label = 1; has_valid_label = 1;
label = label_pton(&mpinfo->extra->label[0]); label = label_pton(&mpinfo->extra->label[0]);
@ -1155,8 +1155,7 @@ void bgp_zebra_announce(struct bgp_node *rn, struct prefix *p,
} }
/* if this is a evpn route we don't have to include the label */ /* if this is a evpn route we don't have to include the label */
if (has_valid_label && if (has_valid_label && !(CHECK_FLAG(api.flags, ZEBRA_FLAG_EVPN_ROUTE)))
!(CHECK_FLAG(api.flags, ZEBRA_FLAG_EVPN_ROUTE)))
SET_FLAG(api.message, ZAPI_MESSAGE_LABEL); SET_FLAG(api.message, ZAPI_MESSAGE_LABEL);
if (info->sub_type != BGP_ROUTE_AGGREGATE) if (info->sub_type != BGP_ROUTE_AGGREGATE)
@ -1198,8 +1197,8 @@ void bgp_zebra_announce(struct bgp_node *rn, struct prefix *p,
sizeof(nh_buf)); sizeof(nh_buf));
label_buf[0] = '\0'; label_buf[0] = '\0';
if (has_valid_label && if (has_valid_label
!CHECK_FLAG(api.flags, ZEBRA_FLAG_EVPN_ROUTE)) && !CHECK_FLAG(api.flags, ZEBRA_FLAG_EVPN_ROUTE))
sprintf(label_buf, "label %u", sprintf(label_buf, "label %u",
api_nh->labels[0]); api_nh->labels[0]);
zlog_debug(" nhop [%d]: %s %s", i + 1, nh_buf, zlog_debug(" nhop [%d]: %s %s", i + 1, nh_buf,
@ -1579,8 +1578,7 @@ void bgp_zebra_instance_register(struct bgp *bgp)
/* For default instance, register to learn about VNIs, if appropriate. /* For default instance, register to learn about VNIs, if appropriate.
*/ */
if (bgp->inst_type == BGP_INSTANCE_TYPE_DEFAULT if (bgp->inst_type == BGP_INSTANCE_TYPE_DEFAULT && is_evpn_enabled())
&& is_evpn_enabled())
bgp_zebra_advertise_all_vni(bgp, 1); bgp_zebra_advertise_all_vni(bgp, 1);
} }
@ -1598,8 +1596,7 @@ void bgp_zebra_instance_deregister(struct bgp *bgp)
/* For default instance, unregister learning about VNIs, if appropriate. /* For default instance, unregister learning about VNIs, if appropriate.
*/ */
if (bgp->inst_type == BGP_INSTANCE_TYPE_DEFAULT if (bgp->inst_type == BGP_INSTANCE_TYPE_DEFAULT && is_evpn_enabled())
&& is_evpn_enabled())
bgp_zebra_advertise_all_vni(bgp, 0); bgp_zebra_advertise_all_vni(bgp, 0);
/* Deregister for router-id, interfaces, redistributed routes. */ /* Deregister for router-id, interfaces, redistributed routes. */
@ -1788,8 +1785,8 @@ static int bgp_zebra_process_local_vni(int command, struct zclient *zclient,
if (BGP_DEBUG(zebra, ZEBRA)) if (BGP_DEBUG(zebra, ZEBRA))
zlog_debug("Rx VNI %s VRF %s VNI %u tenant-vrf %s", zlog_debug("Rx VNI %s VRF %s VNI %u tenant-vrf %s",
(command == ZEBRA_VNI_ADD) ? "add" : "del", (command == ZEBRA_VNI_ADD) ? "add" : "del",
vrf_id_to_name(vrf_id), vrf_id_to_name(vrf_id), vni,
vni, vrf_id_to_name(tenant_vrf_id)); vrf_id_to_name(tenant_vrf_id));
if (command == ZEBRA_VNI_ADD) if (command == ZEBRA_VNI_ADD)
return bgp_evpn_local_vni_add( return bgp_evpn_local_vni_add(
@ -1848,8 +1845,7 @@ static int bgp_zebra_process_local_macip(int command, struct zclient *zclient,
return bgp_evpn_local_macip_del(bgp, vni, &mac, &ip); return bgp_evpn_local_macip_del(bgp, vni, &mac, &ip);
} }
static void bgp_zebra_process_local_ip_prefix(int cmd, static void bgp_zebra_process_local_ip_prefix(int cmd, struct zclient *zclient,
struct zclient *zclient,
zebra_size_t length, zebra_size_t length,
vrf_id_t vrf_id) vrf_id_t vrf_id)
{ {
@ -1875,25 +1871,19 @@ static void bgp_zebra_process_local_ip_prefix(int cmd,
if (cmd == ZEBRA_IP_PREFIX_ROUTE_ADD) { if (cmd == ZEBRA_IP_PREFIX_ROUTE_ADD) {
if (p.family == AF_INET) if (p.family == AF_INET)
return bgp_evpn_advertise_type5_route(bgp_vrf, &p, return bgp_evpn_advertise_type5_route(
NULL, bgp_vrf, &p, NULL, AFI_IP, SAFI_UNICAST);
AFI_IP,
SAFI_UNICAST);
else else
return bgp_evpn_advertise_type5_route(bgp_vrf, &p, return bgp_evpn_advertise_type5_route(
NULL, bgp_vrf, &p, NULL, AFI_IP6, SAFI_UNICAST);
AFI_IP6,
SAFI_UNICAST);
} else { } else {
if (p.family == AF_INET) if (p.family == AF_INET)
return bgp_evpn_withdraw_type5_route(bgp_vrf, &p, return bgp_evpn_withdraw_type5_route(
AFI_IP, bgp_vrf, &p, AFI_IP, SAFI_UNICAST);
SAFI_UNICAST);
else else
return bgp_evpn_withdraw_type5_route(bgp_vrf, &p, return bgp_evpn_withdraw_type5_route(
AFI_IP6, bgp_vrf, &p, AFI_IP6, SAFI_UNICAST);
SAFI_UNICAST);
} }
} }

View File

@ -1403,16 +1403,12 @@ static void bgp_recalculate_afi_safi_bestpaths(struct bgp *bgp, afi_t afi,
if (rn->info != NULL) { if (rn->info != NULL) {
/* Special handling for 2-level routing /* Special handling for 2-level routing
* tables. */ * tables. */
if (safi == SAFI_MPLS_VPN if (safi == SAFI_MPLS_VPN || safi == SAFI_ENCAP
|| safi == SAFI_ENCAP
|| safi == SAFI_EVPN) { || safi == SAFI_EVPN) {
for (nrn = bgp_table_top(( for (nrn = bgp_table_top(
struct bgp_table (struct bgp_table *)(rn->info));
*)(rn->info)); nrn; nrn = bgp_route_next(nrn))
nrn; bgp_process(bgp, nrn, afi, safi);
nrn = bgp_route_next(nrn))
bgp_process(bgp, nrn,
afi, safi);
} else } else
bgp_process(bgp, rn, afi, safi); bgp_process(bgp, rn, afi, safi);
} }
@ -1864,8 +1860,7 @@ static int peer_activate_af(struct peer *peer, afi_t afi, safi_t safi)
peer->afc[afi][safi] = 1; peer->afc[afi][safi] = 1;
if (peer->group) if (peer->group)
peer_group2peer_config_copy_af(peer->group, peer, peer_group2peer_config_copy_af(peer->group, peer, afi, safi);
afi, safi);
if (!active && peer_active(peer)) { if (!active && peer_active(peer)) {
bgp_timer_set(peer); bgp_timer_set(peer);
@ -1933,12 +1928,14 @@ int peer_activate(struct peer *peer, afi_t afi, safi_t safi)
ret |= peer_activate_af(peer, afi, safi); ret |= peer_activate_af(peer, afi, safi);
} }
/* If this is the first peer to be activated for this afi/labeled-unicast /* If this is the first peer to be activated for this
* recalc bestpaths to trigger label allocation */ * afi/labeled-unicast recalc bestpaths to trigger label allocation */
if (safi == SAFI_LABELED_UNICAST && !bgp->allocate_mpls_labels[afi][SAFI_UNICAST]) { if (safi == SAFI_LABELED_UNICAST
&& !bgp->allocate_mpls_labels[afi][SAFI_UNICAST]) {
if (BGP_DEBUG(zebra, ZEBRA)) if (BGP_DEBUG(zebra, ZEBRA))
zlog_info("peer(s) are now active for labeled-unicast, allocate MPLS labels"); zlog_info(
"peer(s) are now active for labeled-unicast, allocate MPLS labels");
bgp->allocate_mpls_labels[afi][SAFI_UNICAST] = 1; bgp->allocate_mpls_labels[afi][SAFI_UNICAST] = 1;
bgp_recalculate_afi_safi_bestpaths(bgp, afi, SAFI_UNICAST); bgp_recalculate_afi_safi_bestpaths(bgp, afi, SAFI_UNICAST);
@ -2027,14 +2024,15 @@ int peer_deactivate(struct peer *peer, afi_t afi, safi_t safi)
bgp = peer->bgp; bgp = peer->bgp;
/* If this is the last peer to be deactivated for this afi/labeled-unicast /* If this is the last peer to be deactivated for this
* recalc bestpaths to trigger label deallocation */ * afi/labeled-unicast recalc bestpaths to trigger label deallocation */
if (safi == SAFI_LABELED_UNICAST && if (safi == SAFI_LABELED_UNICAST
bgp->allocate_mpls_labels[afi][SAFI_UNICAST] && && bgp->allocate_mpls_labels[afi][SAFI_UNICAST]
!bgp_afi_safi_peer_exists(bgp, afi, safi)) { && !bgp_afi_safi_peer_exists(bgp, afi, safi)) {
if (BGP_DEBUG(zebra, ZEBRA)) if (BGP_DEBUG(zebra, ZEBRA))
zlog_info("peer(s) are no longer active for labeled-unicast, deallocate MPLS labels"); zlog_info(
"peer(s) are no longer active for labeled-unicast, deallocate MPLS labels");
bgp->allocate_mpls_labels[afi][SAFI_UNICAST] = 0; bgp->allocate_mpls_labels[afi][SAFI_UNICAST] = 0;
bgp_recalculate_afi_safi_bestpaths(bgp, afi, SAFI_UNICAST); bgp_recalculate_afi_safi_bestpaths(bgp, afi, SAFI_UNICAST);
@ -2856,8 +2854,7 @@ static struct bgp *bgp_create(as_t *as, const char *name,
XSTRDUP(MTYPE_BGP_PEER_HOST, cmd_domainname_get()); XSTRDUP(MTYPE_BGP_PEER_HOST, cmd_domainname_get());
bgp->peer = list_new(); bgp->peer = list_new();
bgp->peer->cmp = (int (*)(void *, void *))peer_cmp; bgp->peer->cmp = (int (*)(void *, void *))peer_cmp;
bgp->peerhash = hash_create(peer_hash_key_make, bgp->peerhash = hash_create(peer_hash_key_make, peer_hash_same,
peer_hash_same,
"BGP Peer Hash"); "BGP Peer Hash");
bgp->peerhash->max_size = BGP_PEER_MAX_HASH_SIZE; bgp->peerhash->max_size = BGP_PEER_MAX_HASH_SIZE;
@ -3988,7 +3985,8 @@ static int peer_af_flag_modify(struct peer *peer, afi_t afi, safi_t safi,
} }
/* Track if addpath TX is in use */ /* Track if addpath TX is in use */
if (flag & (PEER_FLAG_ADDPATH_TX_ALL_PATHS if (flag
& (PEER_FLAG_ADDPATH_TX_ALL_PATHS
| PEER_FLAG_ADDPATH_TX_BESTPATH_PER_AS)) { | PEER_FLAG_ADDPATH_TX_BESTPATH_PER_AS)) {
bgp = peer->bgp; bgp = peer->bgp;
addpath_tx_used = 0; addpath_tx_used = 0;
@ -6802,7 +6800,8 @@ static void bgp_config_write_peer_af(struct vty *vty, struct bgp *bgp,
} else { } else {
if (!peer_af_flag_check(peer, afi, safi, if (!peer_af_flag_check(peer, afi, safi,
PEER_FLAG_SEND_COMMUNITY) PEER_FLAG_SEND_COMMUNITY)
&& (!g_peer || peer_af_flag_check(g_peer, afi, safi, && (!g_peer
|| peer_af_flag_check(g_peer, afi, safi,
PEER_FLAG_SEND_COMMUNITY)) PEER_FLAG_SEND_COMMUNITY))
&& !peer_af_flag_check(peer, afi, safi, && !peer_af_flag_check(peer, afi, safi,
PEER_FLAG_SEND_EXT_COMMUNITY) PEER_FLAG_SEND_EXT_COMMUNITY)
@ -6811,7 +6810,8 @@ static void bgp_config_write_peer_af(struct vty *vty, struct bgp *bgp,
PEER_FLAG_SEND_EXT_COMMUNITY)) PEER_FLAG_SEND_EXT_COMMUNITY))
&& !peer_af_flag_check(peer, afi, safi, && !peer_af_flag_check(peer, afi, safi,
PEER_FLAG_SEND_LARGE_COMMUNITY) PEER_FLAG_SEND_LARGE_COMMUNITY)
&& (!g_peer || peer_af_flag_check( && (!g_peer
|| peer_af_flag_check(
g_peer, afi, safi, g_peer, afi, safi,
PEER_FLAG_SEND_LARGE_COMMUNITY))) { PEER_FLAG_SEND_LARGE_COMMUNITY))) {
vty_out(vty, " no neighbor %s send-community all\n", vty_out(vty, " no neighbor %s send-community all\n",
@ -6841,7 +6841,8 @@ static void bgp_config_write_peer_af(struct vty *vty, struct bgp *bgp,
if (!peer_af_flag_check(peer, afi, safi, if (!peer_af_flag_check(peer, afi, safi,
PEER_FLAG_SEND_COMMUNITY) PEER_FLAG_SEND_COMMUNITY)
&& (!g_peer || peer_af_flag_check( && (!g_peer
|| peer_af_flag_check(
g_peer, afi, safi, g_peer, afi, safi,
PEER_FLAG_SEND_COMMUNITY))) { PEER_FLAG_SEND_COMMUNITY))) {
vty_out(vty, vty_out(vty,
@ -6954,16 +6955,16 @@ static void bgp_config_write_peer_af(struct vty *vty, struct bgp *bgp,
bgp_config_write_filter(vty, peer, afi, safi); bgp_config_write_filter(vty, peer, afi, safi);
/* atribute-unchanged. */ /* atribute-unchanged. */
if (peer_af_flag_check(peer, afi, safi, PEER_FLAG_AS_PATH_UNCHANGED) || if (peer_af_flag_check(peer, afi, safi, PEER_FLAG_AS_PATH_UNCHANGED)
peer_af_flag_check(peer, afi, safi, PEER_FLAG_NEXTHOP_UNCHANGED) || || peer_af_flag_check(peer, afi, safi, PEER_FLAG_NEXTHOP_UNCHANGED)
peer_af_flag_check(peer, afi, safi, PEER_FLAG_MED_UNCHANGED)) { || peer_af_flag_check(peer, afi, safi, PEER_FLAG_MED_UNCHANGED)) {
if (!peer_group_active(peer) || if (!peer_group_active(peer)
peergroup_af_flag_check(peer, afi, safi, || peergroup_af_flag_check(peer, afi, safi,
PEER_FLAG_AS_PATH_UNCHANGED) || PEER_FLAG_AS_PATH_UNCHANGED)
peergroup_af_flag_check(peer, afi, safi, || peergroup_af_flag_check(peer, afi, safi,
PEER_FLAG_NEXTHOP_UNCHANGED) || PEER_FLAG_NEXTHOP_UNCHANGED)
peergroup_af_flag_check(peer, afi, safi, || peergroup_af_flag_check(peer, afi, safi,
PEER_FLAG_MED_UNCHANGED)) { PEER_FLAG_MED_UNCHANGED)) {
vty_out(vty, vty_out(vty,

View File

@ -262,9 +262,10 @@ struct bgp {
/* $FRR indent$ */ /* $FRR indent$ */
/* clang-format off */ /* clang-format off */
#define BGP_MAXMED_ADMIN_UNCONFIGURED 0 /* Off by default */ #define BGP_MAXMED_ADMIN_UNCONFIGURED 0 /* Off by default */
u_int32_t u_int32_t maxmed_admin_value; /* Max-med value when administrative in on
maxmed_admin_value; /* Max-med value when administrative in on
*/ */
/* $FRR indent$ */
/* clang-format off */
#define BGP_MAXMED_VALUE_DEFAULT 4294967294 /* Maximum by default */ #define BGP_MAXMED_VALUE_DEFAULT 4294967294 /* Maximum by default */
u_char maxmed_active; /* 1/0 if max-med is active or not */ u_char maxmed_active; /* 1/0 if max-med is active or not */
@ -871,20 +872,28 @@ struct peer {
struct work_queue *clear_node_queue; struct work_queue *clear_node_queue;
#define PEER_TOTAL_RX(peer) \ #define PEER_TOTAL_RX(peer) \
atomic_load_explicit(&peer->open_in, memory_order_relaxed) + \ atomic_load_explicit(&peer->open_in, memory_order_relaxed) \
atomic_load_explicit(&peer->update_in, memory_order_relaxed) + \ + atomic_load_explicit(&peer->update_in, memory_order_relaxed) \
atomic_load_explicit(&peer->notify_in, memory_order_relaxed) + \ + atomic_load_explicit(&peer->notify_in, memory_order_relaxed) \
atomic_load_explicit(&peer->refresh_in, memory_order_relaxed) + \ + atomic_load_explicit(&peer->refresh_in, \
atomic_load_explicit(&peer->keepalive_in, memory_order_relaxed) + \ memory_order_relaxed) \
atomic_load_explicit(&peer->dynamic_cap_in, memory_order_relaxed) + atomic_load_explicit(&peer->keepalive_in, \
memory_order_relaxed) \
+ atomic_load_explicit(&peer->dynamic_cap_in, \
memory_order_relaxed)
#define PEER_TOTAL_TX(peer) \ #define PEER_TOTAL_TX(peer) \
atomic_load_explicit(&peer->open_out, memory_order_relaxed) + \ atomic_load_explicit(&peer->open_out, memory_order_relaxed) \
atomic_load_explicit(&peer->update_out, memory_order_relaxed) + \ + atomic_load_explicit(&peer->update_out, \
atomic_load_explicit(&peer->notify_out, memory_order_relaxed) + \ memory_order_relaxed) \
atomic_load_explicit(&peer->refresh_out, memory_order_relaxed) + \ + atomic_load_explicit(&peer->notify_out, \
atomic_load_explicit(&peer->keepalive_out, memory_order_relaxed) + \ memory_order_relaxed) \
atomic_load_explicit(&peer->dynamic_cap_out, memory_order_relaxed) + atomic_load_explicit(&peer->refresh_out, \
memory_order_relaxed) \
+ atomic_load_explicit(&peer->keepalive_out, \
memory_order_relaxed) \
+ atomic_load_explicit(&peer->dynamic_cap_out, \
memory_order_relaxed)
/* Statistics field */ /* Statistics field */
_Atomic uint32_t open_in; /* Open message input count */ _Atomic uint32_t open_in; /* Open message input count */
@ -1481,7 +1490,8 @@ extern int peer_cmp(struct peer *p1, struct peer *p2);
extern int bgp_map_afi_safi_iana2int(iana_afi_t pkt_afi, iana_safi_t pkt_safi, extern int bgp_map_afi_safi_iana2int(iana_afi_t pkt_afi, iana_safi_t pkt_safi,
afi_t *afi, safi_t *safi); afi_t *afi, safi_t *safi);
extern int bgp_map_afi_safi_int2iana(afi_t afi, safi_t safi, extern int bgp_map_afi_safi_int2iana(afi_t afi, safi_t safi,
iana_afi_t *pkt_afi, iana_safi_t *pkt_safi); iana_afi_t *pkt_afi,
iana_safi_t *pkt_safi);
extern struct peer_af *peer_af_create(struct peer *, afi_t, safi_t); extern struct peer_af *peer_af_create(struct peer *, afi_t, safi_t);
extern struct peer_af *peer_af_find(struct peer *, afi_t, safi_t); extern struct peer_af *peer_af_find(struct peer *, afi_t, safi_t);

View File

@ -264,7 +264,8 @@ int bgp_rfapi_is_vnc_configured(struct bgp *bgp)
{ \ { \
switch (bgp_rfapi_is_vnc_configured(bgp)) { \ switch (bgp_rfapi_is_vnc_configured(bgp)) { \
case EPERM: \ case EPERM: \
vty_out(vty, "VNC operations only permitted on default BGP instance.\n"); \ vty_out(vty, \
"VNC operations only permitted on default BGP instance.\n"); \
return CMD_WARNING_CONFIG_FAILED; \ return CMD_WARNING_CONFIG_FAILED; \
break; \ break; \
case ENXIO: \ case ENXIO: \
@ -509,8 +510,7 @@ DEFUN (vnc_defaults_responselifetime,
} else { } else {
rspint = strtoul(argv[1]->arg, NULL, 10); rspint = strtoul(argv[1]->arg, NULL, 10);
if (rspint > INT32_MAX) if (rspint > INT32_MAX)
rspint = rspint = INT32_MAX; /* is really an int, not an unsigned
INT32_MAX; /* is really an int, not an unsigned
int */ int */
} }
@ -1636,8 +1636,8 @@ DEFUN (vnc_nve_group_export_no_prefixlist,
idx += 2; /* skip afi and keyword */ idx += 2; /* skip afi and keyword */
if (is_bgp) { if (is_bgp) {
if (idx == argc || if (idx == argc
strmatch(argv[idx]->arg, || strmatch(argv[idx]->arg,
rfg->plist_export_bgp_name[afi])) { rfg->plist_export_bgp_name[afi])) {
if (rfg->plist_export_bgp_name[afi]) if (rfg->plist_export_bgp_name[afi])
free(rfg->plist_export_bgp_name[afi]); free(rfg->plist_export_bgp_name[afi]);
@ -1647,8 +1647,8 @@ DEFUN (vnc_nve_group_export_no_prefixlist,
vnc_direct_bgp_reexport_group_afi(bgp, rfg, afi); vnc_direct_bgp_reexport_group_afi(bgp, rfg, afi);
} }
} else { } else {
if (idx == argc || if (idx == argc
strmatch(argv[idx]->arg, || strmatch(argv[idx]->arg,
rfg->plist_export_zebra_name[afi])) { rfg->plist_export_zebra_name[afi])) {
if (rfg->plist_export_zebra_name[afi]) if (rfg->plist_export_zebra_name[afi])
free(rfg->plist_export_zebra_name[afi]); free(rfg->plist_export_zebra_name[afi]);
@ -1768,8 +1768,9 @@ DEFUN (vnc_nve_group_export_no_routemap,
} }
if (is_bgp) { if (is_bgp) {
if (idx == argc || if (idx == argc
strmatch(argv[idx]->arg, rfg->routemap_export_bgp_name)) { || strmatch(argv[idx]->arg,
rfg->routemap_export_bgp_name)) {
if (rfg->routemap_export_bgp_name) if (rfg->routemap_export_bgp_name)
free(rfg->routemap_export_bgp_name); free(rfg->routemap_export_bgp_name);
rfg->routemap_export_bgp_name = NULL; rfg->routemap_export_bgp_name = NULL;
@ -1779,8 +1780,8 @@ DEFUN (vnc_nve_group_export_no_routemap,
vnc_direct_bgp_reexport_group_afi(bgp, rfg, AFI_IP6); vnc_direct_bgp_reexport_group_afi(bgp, rfg, AFI_IP6);
} }
} else { } else {
if (idx == argc || if (idx == argc
strmatch(argv[idx]->arg, || strmatch(argv[idx]->arg,
rfg->routemap_export_zebra_name)) { rfg->routemap_export_zebra_name)) {
if (rfg->routemap_export_zebra_name) if (rfg->routemap_export_zebra_name)
free(rfg->routemap_export_zebra_name); free(rfg->routemap_export_zebra_name);
@ -2466,8 +2467,7 @@ bgp_rfapi_delete_named_nve_group(struct vty *vty, /* NULL = no output */
if (rfg->rfd) if (rfg->rfd)
clear_vnc_vrf_closer(rfg); clear_vnc_vrf_closer(rfg);
bgp_rfapi_delete_nve_group(vty, bgp, rfg); bgp_rfapi_delete_nve_group(vty, bgp, rfg);
} } else /* must be delete all */
else /* must be delete all */
for (ALL_LIST_ELEMENTS(bgp->rfapi_cfg->nve_groups_sequential, for (ALL_LIST_ELEMENTS(bgp->rfapi_cfg->nve_groups_sequential,
node, nnode, rfg)) { node, nnode, rfg)) {
if (rfg->rfd) if (rfg->rfd)
@ -3950,7 +3950,9 @@ int bgp_rfapi_cfg_write(struct vty *vty, struct bgp *bgp)
if (rfg->plist_export_bgp_name[afi]) { if (rfg->plist_export_bgp_name[afi]) {
vty_out(vty, vty_out(vty,
" export %s%s prefix-list %s\n", " export %s%s prefix-list %s\n",
(rfg->type == RFAPI_GROUP_CFG_VRF ? "" : "bgp "), (rfg->type == RFAPI_GROUP_CFG_VRF
? ""
: "bgp "),
afistr, afistr,
rfg->plist_export_bgp_name rfg->plist_export_bgp_name
[afi]); [afi]);
@ -3958,7 +3960,9 @@ int bgp_rfapi_cfg_write(struct vty *vty, struct bgp *bgp)
if (rfg->plist_export_zebra_name[afi]) { if (rfg->plist_export_zebra_name[afi]) {
vty_out(vty, vty_out(vty,
" export %s%s prefix-list %s\n", " export %s%s prefix-list %s\n",
(rfg->type == RFAPI_GROUP_CFG_VRF ? "" : "zebra "), (rfg->type == RFAPI_GROUP_CFG_VRF
? ""
: "zebra "),
afistr, afistr,
rfg->plist_export_zebra_name rfg->plist_export_zebra_name
[afi]); [afi]);
@ -3993,12 +3997,16 @@ int bgp_rfapi_cfg_write(struct vty *vty, struct bgp *bgp)
if (rfg->routemap_export_bgp_name) { if (rfg->routemap_export_bgp_name) {
vty_out(vty, " export %sroute-map %s\n", vty_out(vty, " export %sroute-map %s\n",
(rfg->type == RFAPI_GROUP_CFG_VRF ? "" : "bgp "), (rfg->type == RFAPI_GROUP_CFG_VRF
? ""
: "bgp "),
rfg->routemap_export_bgp_name); rfg->routemap_export_bgp_name);
} }
if (rfg->routemap_export_zebra_name) { if (rfg->routemap_export_zebra_name) {
vty_out(vty, " export %sroute-map %s\n", vty_out(vty, " export %sroute-map %s\n",
(rfg->type == RFAPI_GROUP_CFG_VRF ? "" : "zebra "), (rfg->type == RFAPI_GROUP_CFG_VRF
? ""
: "zebra "),
rfg->routemap_export_zebra_name); rfg->routemap_export_zebra_name);
} }
if (rfg->routemap_redist_name[ZEBRA_ROUTE_BGP_DIRECT]) { if (rfg->routemap_redist_name[ZEBRA_ROUTE_BGP_DIRECT]) {
@ -4098,7 +4106,8 @@ int bgp_rfapi_cfg_write(struct vty *vty, struct bgp *bgp)
} }
if (hc->default_rd.prefixlen if (hc->default_rd.prefixlen
|| hc->default_response_lifetime != BGP_VNC_DEFAULT_RESPONSE_LIFETIME_DEFAULT || hc->default_response_lifetime
!= BGP_VNC_DEFAULT_RESPONSE_LIFETIME_DEFAULT
|| hc->default_rt_import_list || hc->default_rt_export_list || hc->default_rt_import_list || hc->default_rt_export_list
|| hc->nve_groups_sequential->count) { || hc->nve_groups_sequential->count) {
@ -4184,8 +4193,8 @@ int bgp_rfapi_cfg_write(struct vty *vty, struct bgp *bgp)
prefix2str(&rfg->vn_prefix, buf, prefix2str(&rfg->vn_prefix, buf,
sizeof(buf)); sizeof(buf));
vty_out(vty, " prefix %s %s\n", vty_out(vty, " prefix %s %s\n", "vn",
"vn", buf); buf);
} }
if (rfg->un_prefix.family && rfg->un_node) { if (rfg->un_prefix.family && rfg->un_node) {
@ -4193,8 +4202,8 @@ int bgp_rfapi_cfg_write(struct vty *vty, struct bgp *bgp)
prefix2str(&rfg->un_prefix, buf, prefix2str(&rfg->un_prefix, buf,
sizeof(buf)); sizeof(buf));
vty_out(vty, " prefix %s %s\n", vty_out(vty, " prefix %s %s\n", "un",
"un", buf); buf);
} }
@ -4215,10 +4224,9 @@ int bgp_rfapi_cfg_write(struct vty *vty, struct bgp *bgp)
value); value);
} else } else
vty_out(vty, vty_out(vty, " rd %s\n",
" rd %s\n", prefix_rd2str(
prefix_rd2str(&rfg->rd, &rfg->rd, buf,
buf,
sizeof(buf))); sizeof(buf)));
} }
if (rfg->flags & RFAPI_RFG_RESPONSE_LIFETIME) { if (rfg->flags & RFAPI_RFG_RESPONSE_LIFETIME) {

View File

@ -6,7 +6,7 @@ import sys, re, subprocess, os
# find all DEFUNs # find all DEFUNs
defun_re = re.compile( defun_re = re.compile(
r'^(DEF(UN(_NOSH|_HIDDEN)?|PY)\s*\(.*?)^(?=\s*\{)', r'^((DEF(UN(_NOSH|_HIDDEN)?|PY)|ALIAS)\s*\(.*?)^(?=\s*\{)',
re.M | re.S) re.M | re.S)
define_re = re.compile( define_re = re.compile(
r'((^#\s*define[^\n]+[^\\]\n)+)', r'((^#\s*define[^\n]+[^\\]\n)+)',