mirror of
https://git.proxmox.com/git/mirror_frr
synced 2025-08-03 13:01:59 +00:00
Merge pull request #5172 from donaldsharp/sa_clean_and_clean
Sa clean and clean
This commit is contained in:
commit
dfd7b62ddd
@ -1307,8 +1307,12 @@ static struct bmp *bmp_open(struct bmp_targets *bt, int bmp_sock)
|
||||
}
|
||||
bt->cnt_accept++;
|
||||
|
||||
setsockopt(bmp_sock, SOL_SOCKET, SO_KEEPALIVE, &on, sizeof(on));
|
||||
setsockopt(bmp_sock, IPPROTO_TCP, TCP_NODELAY, &on, sizeof(on));
|
||||
if (setsockopt(bmp_sock, SOL_SOCKET, SO_KEEPALIVE, &on, sizeof(on)) < 0)
|
||||
flog_err(EC_LIB_SOCKET, "bmp: %d can't setsockopt SO_KEEPALIVE: %s(%d)",
|
||||
bmp_sock, safe_strerror(errno), errno);
|
||||
if (setsockopt(bmp_sock, IPPROTO_TCP, TCP_NODELAY, &on, sizeof(on)) < 0)
|
||||
flog_err(EC_LIB_SOCKET, "bmp: %d can't setsockopt TCP_NODELAY: %s(%d)",
|
||||
bmp_sock, safe_strerror(errno), errno);
|
||||
|
||||
zlog_info("bmp[%s] connection established", buf);
|
||||
|
||||
|
@ -3023,8 +3023,7 @@ static int bgp_evpn_route_rmac_self_check(struct bgp *bgp_vrf,
|
||||
* SVI comes up with MAC and stored in hash, triggers
|
||||
* bgp_mac_rescan_all_evpn_tables.
|
||||
*/
|
||||
if (pi->attr &&
|
||||
memcmp(&bgp_vrf->rmac, &pi->attr->rmac, ETH_ALEN) == 0) {
|
||||
if (memcmp(&bgp_vrf->rmac, &pi->attr->rmac, ETH_ALEN) == 0) {
|
||||
if (bgp_debug_update(pi->peer, NULL, NULL, 1)) {
|
||||
char buf1[PREFIX_STRLEN];
|
||||
char attr_str[BUFSIZ] = {0};
|
||||
|
@ -294,7 +294,7 @@ void route_vty_out_flowspec(struct vty *vty, struct prefix *p,
|
||||
}
|
||||
if (!path)
|
||||
return;
|
||||
if (path->attr && path->attr->ecommunity) {
|
||||
if (path->attr->ecommunity) {
|
||||
/* Print attribute */
|
||||
attr = path->attr;
|
||||
s = ecommunity_ecom2str(attr->ecommunity,
|
||||
|
@ -706,7 +706,7 @@ int bgp_pbr_build_and_validate_entry(struct prefix *p,
|
||||
if (ret < 0)
|
||||
return -1;
|
||||
/* extract actiosn from flowspec ecom list */
|
||||
if (path && path->attr && path->attr->ecommunity) {
|
||||
if (path && path->attr->ecommunity) {
|
||||
ecom = path->attr->ecommunity;
|
||||
for (i = 0; i < ecom->size; i++) {
|
||||
ecom_eval = (struct ecommunity_val *)
|
||||
|
1835
bgpd/bgp_route.c
1835
bgpd/bgp_route.c
File diff suppressed because it is too large
Load Diff
@ -700,7 +700,7 @@ route_match_ip_next_hop_type(void *rule, const struct prefix *prefix,
|
||||
|
||||
if (type == RMAP_BGP && prefix->family == AF_INET) {
|
||||
path = (struct bgp_path_info *)object;
|
||||
if (!path || !path->attr)
|
||||
if (!path)
|
||||
return RMAP_NOMATCH;
|
||||
|
||||
/* If nexthop interface's index can't be resolved and nexthop is
|
||||
@ -868,8 +868,7 @@ route_match_vni(void *rule, const struct prefix *prefix,
|
||||
* For any other tunnel type, return noop to ignore
|
||||
* this check.
|
||||
*/
|
||||
if (path->attr && path->attr->encap_tunneltype !=
|
||||
BGP_ENCAP_TYPE_VXLAN)
|
||||
if (path->attr->encap_tunneltype != BGP_ENCAP_TYPE_VXLAN)
|
||||
return RMAP_NOOP;
|
||||
|
||||
/*
|
||||
@ -1470,7 +1469,7 @@ route_match_interface(void *rule, const struct prefix *prefix,
|
||||
if (type == RMAP_BGP) {
|
||||
path = object;
|
||||
|
||||
if (!path || !path->attr)
|
||||
if (!path)
|
||||
return RMAP_NOMATCH;
|
||||
|
||||
ifp = if_lookup_by_name_all_vrf((char *)rule);
|
||||
@ -2690,7 +2689,7 @@ route_match_ipv6_next_hop_type(void *rule, const struct prefix *prefix,
|
||||
|
||||
if (type == RMAP_BGP && prefix->family == AF_INET6) {
|
||||
path = (struct bgp_path_info *)object;
|
||||
if (!path || !path->attr)
|
||||
if (!path)
|
||||
return RMAP_NOMATCH;
|
||||
|
||||
if (IPV6_ADDR_SAME(&path->attr->mp_nexthop_global, addr)
|
||||
|
@ -388,15 +388,13 @@ void del_vnc_route(struct rfapi_descriptor *rfd,
|
||||
bpi = bpi->next) {
|
||||
|
||||
vnc_zlog_debug_verbose(
|
||||
"%s: trying bpi=%p, bpi->peer=%p, bpi->type=%d, bpi->sub_type=%d, bpi->extra->vnc.export.rfapi_handle=%p, local_pref=%u",
|
||||
"%s: trying bpi=%p, bpi->peer=%p, bpi->type=%d, bpi->sub_type=%d, bpi->extra->vnc.export.rfapi_handle=%p, local_pref=%" PRIu64,
|
||||
__func__, bpi, bpi->peer, bpi->type, bpi->sub_type,
|
||||
(bpi->extra ? bpi->extra->vnc.export.rfapi_handle
|
||||
: NULL),
|
||||
((bpi->attr
|
||||
&& CHECK_FLAG(bpi->attr->flag,
|
||||
ATTR_FLAG_BIT(BGP_ATTR_LOCAL_PREF)))
|
||||
? bpi->attr->local_pref
|
||||
: 0));
|
||||
CHECK_FLAG(bpi->attr->flag,
|
||||
ATTR_FLAG_BIT(BGP_ATTR_LOCAL_PREF)
|
||||
? bpi->attr->local_pref : 0));
|
||||
|
||||
if (bpi->peer == peer && bpi->type == type
|
||||
&& bpi->sub_type == sub_type && bpi->extra
|
||||
|
@ -484,8 +484,7 @@ static struct bgp_path_info *rfapiBgpInfoCreate(struct attr *attr,
|
||||
|
||||
new = info_make(type, sub_type, 0, peer, attr, NULL);
|
||||
|
||||
if (attr)
|
||||
new->attr = bgp_attr_intern(attr);
|
||||
new->attr = bgp_attr_intern(attr);
|
||||
|
||||
bgp_path_info_extra_get(new);
|
||||
if (prd) {
|
||||
@ -516,9 +515,8 @@ static void rfapiBgpInfoFree(struct bgp_path_info *goner)
|
||||
peer_unlock(goner->peer);
|
||||
}
|
||||
|
||||
if (goner->attr) {
|
||||
bgp_attr_unintern(&goner->attr);
|
||||
}
|
||||
bgp_attr_unintern(&goner->attr);
|
||||
|
||||
if (goner->extra)
|
||||
bgp_path_info_extra_free(&goner->extra);
|
||||
XFREE(MTYPE_BGP_ROUTE, goner);
|
||||
@ -1113,9 +1111,6 @@ static int rfapiVpnBiSamePtUn(struct bgp_path_info *bpi1,
|
||||
if (!bpi1 || !bpi2)
|
||||
return 0;
|
||||
|
||||
if (!bpi1->attr || !bpi2->attr)
|
||||
return 0;
|
||||
|
||||
/*
|
||||
* VN address comparisons
|
||||
*/
|
||||
@ -1299,13 +1294,10 @@ rfapiRouteInfo2NextHopEntry(struct rfapi_ip_prefix *rprefix,
|
||||
memcpy(&vo->v.l2addr.macaddr, &rn->p.u.prefix_eth.octet,
|
||||
ETH_ALEN);
|
||||
/* only low 3 bytes of this are significant */
|
||||
if (bpi->attr) {
|
||||
(void)rfapiEcommunityGetLNI(
|
||||
bpi->attr->ecommunity,
|
||||
&vo->v.l2addr.logical_net_id);
|
||||
(void)rfapiEcommunityGetEthernetTag(
|
||||
bpi->attr->ecommunity, &vo->v.l2addr.tag_id);
|
||||
}
|
||||
(void)rfapiEcommunityGetLNI(bpi->attr->ecommunity,
|
||||
&vo->v.l2addr.logical_net_id);
|
||||
(void)rfapiEcommunityGetEthernetTag(bpi->attr->ecommunity,
|
||||
&vo->v.l2addr.tag_id);
|
||||
|
||||
/* local_nve_id comes from lower byte of RD type */
|
||||
vo->v.l2addr.local_nve_id = bpi->extra->vnc.import.rd.val[1];
|
||||
@ -1325,129 +1317,117 @@ rfapiRouteInfo2NextHopEntry(struct rfapi_ip_prefix *rprefix,
|
||||
}
|
||||
}
|
||||
|
||||
if (bpi->attr) {
|
||||
bgp_encap_types tun_type = BGP_ENCAP_TYPE_MPLS; /*Default*/
|
||||
new->prefix.cost = rfapiRfpCost(bpi->attr);
|
||||
bgp_encap_types tun_type = BGP_ENCAP_TYPE_MPLS; /*Default*/
|
||||
new->prefix.cost = rfapiRfpCost(bpi->attr);
|
||||
|
||||
struct bgp_attr_encap_subtlv *pEncap;
|
||||
struct bgp_attr_encap_subtlv *pEncap;
|
||||
|
||||
switch (BGP_MP_NEXTHOP_FAMILY(bpi->attr->mp_nexthop_len)) {
|
||||
case AF_INET:
|
||||
new->vn_address.addr_family = AF_INET;
|
||||
new->vn_address.addr.v4 =
|
||||
bpi->attr->mp_nexthop_global_in;
|
||||
break;
|
||||
switch (BGP_MP_NEXTHOP_FAMILY(bpi->attr->mp_nexthop_len)) {
|
||||
case AF_INET:
|
||||
new->vn_address.addr_family = AF_INET;
|
||||
new->vn_address.addr.v4 = bpi->attr->mp_nexthop_global_in;
|
||||
break;
|
||||
|
||||
case AF_INET6:
|
||||
new->vn_address.addr_family = AF_INET6;
|
||||
new->vn_address.addr.v6 = bpi->attr->mp_nexthop_global;
|
||||
case AF_INET6:
|
||||
new->vn_address.addr_family = AF_INET6;
|
||||
new->vn_address.addr.v6 = bpi->attr->mp_nexthop_global;
|
||||
break;
|
||||
|
||||
default:
|
||||
zlog_warn("%s: invalid vpn nexthop length: %d", __func__,
|
||||
bpi->attr->mp_nexthop_len);
|
||||
rfapi_free_next_hop_list(new);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
for (pEncap = bpi->attr->vnc_subtlvs; pEncap; pEncap = pEncap->next) {
|
||||
switch (pEncap->type) {
|
||||
case BGP_VNC_SUBTLV_TYPE_LIFETIME:
|
||||
/* use configured lifetime, not attr lifetime */
|
||||
break;
|
||||
|
||||
default:
|
||||
zlog_warn("%s: invalid vpn nexthop length: %d",
|
||||
__func__, bpi->attr->mp_nexthop_len);
|
||||
rfapi_free_next_hop_list(new);
|
||||
return NULL;
|
||||
zlog_warn("%s: unknown VNC option type %d", __func__,
|
||||
pEncap->type);
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
for (pEncap = bpi->attr->vnc_subtlvs; pEncap;
|
||||
pEncap = pEncap->next) {
|
||||
switch (pEncap->type) {
|
||||
case BGP_VNC_SUBTLV_TYPE_LIFETIME:
|
||||
/* use configured lifetime, not attr lifetime */
|
||||
break;
|
||||
|
||||
default:
|
||||
zlog_warn("%s: unknown VNC option type %d",
|
||||
__func__, pEncap->type);
|
||||
|
||||
|
||||
break;
|
||||
}
|
||||
bgp_attr_extcom_tunnel_type(bpi->attr, &tun_type);
|
||||
if (tun_type == BGP_ENCAP_TYPE_MPLS) {
|
||||
struct prefix p;
|
||||
/* MPLS carries UN address in next hop */
|
||||
rfapiNexthop2Prefix(bpi->attr, &p);
|
||||
if (p.family != 0) {
|
||||
rfapiQprefix2Raddr(&p, &new->un_address);
|
||||
have_vnc_tunnel_un = 1;
|
||||
}
|
||||
}
|
||||
|
||||
bgp_attr_extcom_tunnel_type(bpi->attr, &tun_type);
|
||||
if (tun_type == BGP_ENCAP_TYPE_MPLS) {
|
||||
struct prefix p;
|
||||
/* MPLS carries UN address in next hop */
|
||||
rfapiNexthop2Prefix(bpi->attr, &p);
|
||||
if (p.family != 0) {
|
||||
rfapiQprefix2Raddr(&p, &new->un_address);
|
||||
for (pEncap = bpi->attr->encap_subtlvs; pEncap; pEncap = pEncap->next) {
|
||||
switch (pEncap->type) {
|
||||
case BGP_ENCAP_SUBTLV_TYPE_REMOTE_ENDPOINT:
|
||||
/*
|
||||
* Overrides ENCAP UN address, if any
|
||||
*/
|
||||
switch (pEncap->length) {
|
||||
|
||||
case 8:
|
||||
new->un_address.addr_family = AF_INET;
|
||||
memcpy(&new->un_address.addr.v4, pEncap->value,
|
||||
4);
|
||||
have_vnc_tunnel_un = 1;
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
for (pEncap = bpi->attr->encap_subtlvs; pEncap;
|
||||
pEncap = pEncap->next) {
|
||||
switch (pEncap->type) {
|
||||
case BGP_ENCAP_SUBTLV_TYPE_REMOTE_ENDPOINT:
|
||||
/*
|
||||
* Overrides ENCAP UN address, if any
|
||||
*/
|
||||
switch (pEncap->length) {
|
||||
|
||||
case 8:
|
||||
new->un_address.addr_family = AF_INET;
|
||||
memcpy(&new->un_address.addr.v4,
|
||||
pEncap->value, 4);
|
||||
have_vnc_tunnel_un = 1;
|
||||
break;
|
||||
|
||||
case 20:
|
||||
new->un_address.addr_family = AF_INET6;
|
||||
memcpy(&new->un_address.addr.v6,
|
||||
pEncap->value, 16);
|
||||
have_vnc_tunnel_un = 1;
|
||||
break;
|
||||
|
||||
default:
|
||||
zlog_warn(
|
||||
"%s: invalid tunnel subtlv UN addr length (%d) for bpi %p",
|
||||
__func__, pEncap->length, bpi);
|
||||
}
|
||||
case 20:
|
||||
new->un_address.addr_family = AF_INET6;
|
||||
memcpy(&new->un_address.addr.v6, pEncap->value,
|
||||
16);
|
||||
have_vnc_tunnel_un = 1;
|
||||
break;
|
||||
|
||||
default:
|
||||
zlog_warn(
|
||||
"%s: unknown Encap Attribute option type %d",
|
||||
__func__, pEncap->type);
|
||||
|
||||
|
||||
break;
|
||||
"%s: invalid tunnel subtlv UN addr length (%d) for bpi %p",
|
||||
__func__, pEncap->length, bpi);
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
new->un_options = rfapi_encap_tlv_to_un_option(bpi->attr);
|
||||
default:
|
||||
zlog_warn("%s: unknown Encap Attribute option type %d",
|
||||
__func__, pEncap->type);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
new->un_options = rfapi_encap_tlv_to_un_option(bpi->attr);
|
||||
|
||||
#if DEBUG_ENCAP_MONITOR
|
||||
vnc_zlog_debug_verbose("%s: line %d: have_vnc_tunnel_un=%d",
|
||||
__func__, __LINE__, have_vnc_tunnel_un);
|
||||
vnc_zlog_debug_verbose("%s: line %d: have_vnc_tunnel_un=%d", __func__,
|
||||
__LINE__, have_vnc_tunnel_un);
|
||||
#endif
|
||||
|
||||
if (!have_vnc_tunnel_un && bpi->extra) {
|
||||
/*
|
||||
* use cached UN address from ENCAP route
|
||||
*/
|
||||
new->un_address.addr_family =
|
||||
bpi->extra->vnc.import.un_family;
|
||||
switch (new->un_address.addr_family) {
|
||||
case AF_INET:
|
||||
new->un_address.addr.v4 =
|
||||
bpi->extra->vnc.import.un.addr4;
|
||||
break;
|
||||
case AF_INET6:
|
||||
new->un_address.addr.v6 =
|
||||
bpi->extra->vnc.import.un.addr6;
|
||||
break;
|
||||
default:
|
||||
zlog_warn(
|
||||
"%s: invalid UN addr family (%d) for bpi %p",
|
||||
__func__, new->un_address.addr_family,
|
||||
bpi);
|
||||
rfapi_free_next_hop_list(new);
|
||||
return NULL;
|
||||
break;
|
||||
}
|
||||
if (!have_vnc_tunnel_un && bpi->extra) {
|
||||
/*
|
||||
* use cached UN address from ENCAP route
|
||||
*/
|
||||
new->un_address.addr_family = bpi->extra->vnc.import.un_family;
|
||||
switch (new->un_address.addr_family) {
|
||||
case AF_INET:
|
||||
new->un_address.addr.v4 =
|
||||
bpi->extra->vnc.import.un.addr4;
|
||||
break;
|
||||
case AF_INET6:
|
||||
new->un_address.addr.v6 =
|
||||
bpi->extra->vnc.import.un.addr6;
|
||||
break;
|
||||
default:
|
||||
zlog_warn("%s: invalid UN addr family (%d) for bpi %p",
|
||||
__func__, new->un_address.addr_family, bpi);
|
||||
rfapi_free_next_hop_list(new);
|
||||
return NULL;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@ -2607,12 +2587,6 @@ static int rfapiAttrNexthopAddrDifferent(struct prefix *p1, struct prefix *p2)
|
||||
static void rfapiCopyUnEncap2VPN(struct bgp_path_info *encap_bpi,
|
||||
struct bgp_path_info *vpn_bpi)
|
||||
{
|
||||
if (!encap_bpi->attr) {
|
||||
zlog_warn("%s: no encap bpi attr/extra, can't copy UN address",
|
||||
__func__);
|
||||
return;
|
||||
}
|
||||
|
||||
if (!vpn_bpi || !vpn_bpi->extra) {
|
||||
zlog_warn("%s: no vpn bpi attr/extra, can't copy UN address",
|
||||
__func__);
|
||||
@ -4510,10 +4484,9 @@ static void rfapiDeleteRemotePrefixesIt(
|
||||
vnc_zlog_debug_verbose("%s: examining bpi %p",
|
||||
__func__, bpi);
|
||||
|
||||
if (bpi->attr) {
|
||||
if (!rfapiGetNexthop(bpi->attr, &qpt))
|
||||
qpt_valid = 1;
|
||||
}
|
||||
if (!rfapiGetNexthop(bpi->attr, &qpt))
|
||||
qpt_valid = 1;
|
||||
|
||||
if (vn) {
|
||||
if (!qpt_valid
|
||||
|| !prefix_match(vn, &qpt)) {
|
||||
|
@ -1647,11 +1647,6 @@ void rfapiRibUpdatePendingNode(
|
||||
struct rfapi_info *ri;
|
||||
struct prefix pfx_nh;
|
||||
|
||||
if (!bpi->attr) {
|
||||
/* shouldn't happen */
|
||||
/* TBD increment error stats counter */
|
||||
continue;
|
||||
}
|
||||
if (!bpi->extra) {
|
||||
/* shouldn't happen */
|
||||
/* TBD increment error stats counter */
|
||||
|
@ -418,7 +418,7 @@ void rfapi_vty_out_vncinfo(struct vty *vty, struct prefix *p,
|
||||
}
|
||||
}
|
||||
|
||||
if (bpi->attr && bpi->attr->ecommunity) {
|
||||
if (bpi->attr->ecommunity) {
|
||||
s = ecommunity_ecom2str(bpi->attr->ecommunity,
|
||||
ECOMMUNITY_FORMAT_ROUTE_MAP, 0);
|
||||
vty_out(vty, " EC{%s}", s);
|
||||
@ -538,82 +538,78 @@ void rfapiPrintBi(void *stream, struct bgp_path_info *bpi)
|
||||
* RFP option sizes (they are opaque values)
|
||||
* extended communities (RTs)
|
||||
*/
|
||||
if (bpi->attr) {
|
||||
uint32_t lifetime;
|
||||
int printed_1st_gol = 0;
|
||||
struct bgp_attr_encap_subtlv *pEncap;
|
||||
struct prefix pfx_un;
|
||||
int af = BGP_MP_NEXTHOP_FAMILY(bpi->attr->mp_nexthop_len);
|
||||
uint32_t lifetime;
|
||||
int printed_1st_gol = 0;
|
||||
struct bgp_attr_encap_subtlv *pEncap;
|
||||
struct prefix pfx_un;
|
||||
int af = BGP_MP_NEXTHOP_FAMILY(bpi->attr->mp_nexthop_len);
|
||||
|
||||
/* Nexthop */
|
||||
if (af == AF_INET) {
|
||||
r = snprintf(p, REMAIN, "%s",
|
||||
inet_ntop(AF_INET,
|
||||
&bpi->attr->mp_nexthop_global_in,
|
||||
buf, BUFSIZ));
|
||||
INCP;
|
||||
} else if (af == AF_INET6) {
|
||||
r = snprintf(p, REMAIN, "%s",
|
||||
inet_ntop(AF_INET6,
|
||||
&bpi->attr->mp_nexthop_global,
|
||||
buf, BUFSIZ));
|
||||
INCP;
|
||||
} else {
|
||||
r = snprintf(p, REMAIN, "?");
|
||||
INCP;
|
||||
}
|
||||
/* Nexthop */
|
||||
if (af == AF_INET) {
|
||||
r = snprintf(p, REMAIN, "%s",
|
||||
inet_ntop(AF_INET,
|
||||
&bpi->attr->mp_nexthop_global_in, buf,
|
||||
BUFSIZ));
|
||||
INCP;
|
||||
} else if (af == AF_INET6) {
|
||||
r = snprintf(p, REMAIN, "%s",
|
||||
inet_ntop(AF_INET6, &bpi->attr->mp_nexthop_global,
|
||||
buf, BUFSIZ));
|
||||
INCP;
|
||||
} else {
|
||||
r = snprintf(p, REMAIN, "?");
|
||||
INCP;
|
||||
}
|
||||
|
||||
/*
|
||||
* VNC tunnel subtlv, if present, contains UN address
|
||||
*/
|
||||
if (!rfapiGetVncTunnelUnAddr(bpi->attr, &pfx_un)) {
|
||||
r = snprintf(p, REMAIN, " un=%s",
|
||||
inet_ntop(pfx_un.family, pfx_un.u.val, buf,
|
||||
BUFSIZ));
|
||||
INCP;
|
||||
}
|
||||
/*
|
||||
* VNC tunnel subtlv, if present, contains UN address
|
||||
*/
|
||||
if (!rfapiGetVncTunnelUnAddr(bpi->attr, &pfx_un)) {
|
||||
r = snprintf(
|
||||
p, REMAIN, " un=%s",
|
||||
inet_ntop(pfx_un.family, pfx_un.u.val, buf, BUFSIZ));
|
||||
INCP;
|
||||
}
|
||||
|
||||
/* Lifetime */
|
||||
if (rfapiGetVncLifetime(bpi->attr, &lifetime)) {
|
||||
r = snprintf(p, REMAIN, " nolife");
|
||||
INCP;
|
||||
} else {
|
||||
if (lifetime == 0xffffffff)
|
||||
r = snprintf(p, REMAIN, " %6s", "infini");
|
||||
else
|
||||
r = snprintf(p, REMAIN, " %6u", lifetime);
|
||||
INCP;
|
||||
}
|
||||
/* Lifetime */
|
||||
if (rfapiGetVncLifetime(bpi->attr, &lifetime)) {
|
||||
r = snprintf(p, REMAIN, " nolife");
|
||||
INCP;
|
||||
} else {
|
||||
if (lifetime == 0xffffffff)
|
||||
r = snprintf(p, REMAIN, " %6s", "infini");
|
||||
else
|
||||
r = snprintf(p, REMAIN, " %6u", lifetime);
|
||||
INCP;
|
||||
}
|
||||
|
||||
/* RFP option lengths */
|
||||
for (pEncap = bpi->attr->vnc_subtlvs; pEncap;
|
||||
pEncap = pEncap->next) {
|
||||
/* RFP option lengths */
|
||||
for (pEncap = bpi->attr->vnc_subtlvs; pEncap; pEncap = pEncap->next) {
|
||||
|
||||
if (pEncap->type == BGP_VNC_SUBTLV_TYPE_RFPOPTION) {
|
||||
if (printed_1st_gol) {
|
||||
r = snprintf(p, REMAIN, ",");
|
||||
INCP;
|
||||
} else {
|
||||
r = snprintf(p, REMAIN,
|
||||
" "); /* leading space */
|
||||
INCP;
|
||||
}
|
||||
r = snprintf(p, REMAIN, "%d", pEncap->length);
|
||||
if (pEncap->type == BGP_VNC_SUBTLV_TYPE_RFPOPTION) {
|
||||
if (printed_1st_gol) {
|
||||
r = snprintf(p, REMAIN, ",");
|
||||
INCP;
|
||||
} else {
|
||||
r = snprintf(p, REMAIN,
|
||||
" "); /* leading space */
|
||||
INCP;
|
||||
printed_1st_gol = 1;
|
||||
}
|
||||
}
|
||||
|
||||
/* RT list */
|
||||
if (bpi->attr->ecommunity) {
|
||||
s = ecommunity_ecom2str(bpi->attr->ecommunity,
|
||||
ECOMMUNITY_FORMAT_ROUTE_MAP, 0);
|
||||
r = snprintf(p, REMAIN, " %s", s);
|
||||
r = snprintf(p, REMAIN, "%d", pEncap->length);
|
||||
INCP;
|
||||
XFREE(MTYPE_ECOMMUNITY_STR, s);
|
||||
printed_1st_gol = 1;
|
||||
}
|
||||
}
|
||||
|
||||
/* RT list */
|
||||
if (bpi->attr->ecommunity) {
|
||||
s = ecommunity_ecom2str(bpi->attr->ecommunity,
|
||||
ECOMMUNITY_FORMAT_ROUTE_MAP, 0);
|
||||
r = snprintf(p, REMAIN, " %s", s);
|
||||
INCP;
|
||||
XFREE(MTYPE_ECOMMUNITY_STR, s);
|
||||
}
|
||||
|
||||
r = snprintf(p, REMAIN, " bpi@%p", bpi);
|
||||
INCP;
|
||||
|
||||
@ -628,21 +624,17 @@ void rfapiPrintBi(void *stream, struct bgp_path_info *bpi)
|
||||
INCP;
|
||||
}
|
||||
|
||||
if (bpi->attr) {
|
||||
if (bpi->attr->weight) {
|
||||
r = snprintf(p, REMAIN, " W=%d", bpi->attr->weight);
|
||||
INCP;
|
||||
}
|
||||
|
||||
if (bpi->attr->weight) {
|
||||
r = snprintf(p, REMAIN, " W=%d", bpi->attr->weight);
|
||||
INCP;
|
||||
}
|
||||
|
||||
if (bpi->attr->flag & ATTR_FLAG_BIT(BGP_ATTR_LOCAL_PREF)) {
|
||||
r = snprintf(p, REMAIN, " LP=%d",
|
||||
bpi->attr->local_pref);
|
||||
INCP;
|
||||
} else {
|
||||
r = snprintf(p, REMAIN, " LP=unset");
|
||||
INCP;
|
||||
}
|
||||
if (bpi->attr->flag & ATTR_FLAG_BIT(BGP_ATTR_LOCAL_PREF)) {
|
||||
r = snprintf(p, REMAIN, " LP=%d", bpi->attr->local_pref);
|
||||
INCP;
|
||||
} else {
|
||||
r = snprintf(p, REMAIN, " LP=unset");
|
||||
INCP;
|
||||
}
|
||||
|
||||
r = snprintf(p, REMAIN, " %c:%u", zebra_route_char(bpi->type),
|
||||
@ -1087,16 +1079,13 @@ static int rfapiPrintRemoteRegBi(struct bgp *bgp, void *stream,
|
||||
* See rfapi_import.c'rfapiRouteInfo2NextHopEntry() for conversion
|
||||
* back to cost.
|
||||
*/
|
||||
if (bpi->attr) {
|
||||
uint32_t local_pref;
|
||||
if (bpi->attr->flag & ATTR_FLAG_BIT(BGP_ATTR_LOCAL_PREF))
|
||||
local_pref = bpi->attr->local_pref;
|
||||
else
|
||||
local_pref = 0;
|
||||
cost = (local_pref > 255) ? 0 : 255 - local_pref;
|
||||
} else {
|
||||
cost = 0;
|
||||
}
|
||||
uint32_t local_pref;
|
||||
|
||||
if (bpi->attr->flag & ATTR_FLAG_BIT(BGP_ATTR_LOCAL_PREF))
|
||||
local_pref = bpi->attr->local_pref;
|
||||
else
|
||||
local_pref = 0;
|
||||
cost = (local_pref > 255) ? 0 : 255 - local_pref;
|
||||
|
||||
fp(out, "%-20s ", buf_pfx);
|
||||
fp(out, "%-15s ", buf_vn);
|
||||
|
@ -476,25 +476,21 @@ static void vnc_import_bgp_add_route_mode_resolve_nve_one_bi(
|
||||
plifetime = &lifetime;
|
||||
}
|
||||
|
||||
if (bpi->attr) {
|
||||
encaptlvs = bpi->attr->vnc_subtlvs;
|
||||
if (bpi->attr->encap_tunneltype != BGP_ENCAP_TYPE_RESERVED
|
||||
&& bpi->attr->encap_tunneltype != BGP_ENCAP_TYPE_MPLS) {
|
||||
if (opt != NULL)
|
||||
opt->next = &optary[cur_opt];
|
||||
opt = &optary[cur_opt++];
|
||||
memset(opt, 0, sizeof(struct rfapi_un_option));
|
||||
opt->type = RFAPI_UN_OPTION_TYPE_TUNNELTYPE;
|
||||
opt->v.tunnel.type = bpi->attr->encap_tunneltype;
|
||||
/* TBD parse bpi->attr->extra->encap_subtlvs */
|
||||
}
|
||||
} else {
|
||||
encaptlvs = NULL;
|
||||
encaptlvs = bpi->attr->vnc_subtlvs;
|
||||
if (bpi->attr->encap_tunneltype != BGP_ENCAP_TYPE_RESERVED
|
||||
&& bpi->attr->encap_tunneltype != BGP_ENCAP_TYPE_MPLS) {
|
||||
if (opt != NULL)
|
||||
opt->next = &optary[cur_opt];
|
||||
opt = &optary[cur_opt++];
|
||||
memset(opt, 0, sizeof(struct rfapi_un_option));
|
||||
opt->type = RFAPI_UN_OPTION_TYPE_TUNNELTYPE;
|
||||
opt->v.tunnel.type = bpi->attr->encap_tunneltype;
|
||||
/* TBD parse bpi->attr->extra->encap_subtlvs */
|
||||
}
|
||||
|
||||
struct ecommunity *new_ecom = ecommunity_dup(ecom);
|
||||
|
||||
if (bpi->attr && bpi->attr->ecommunity)
|
||||
if (bpi->attr->ecommunity)
|
||||
ecommunity_merge(new_ecom, bpi->attr->ecommunity);
|
||||
|
||||
if (bpi->extra)
|
||||
@ -635,12 +631,8 @@ static void vnc_import_bgp_add_route_mode_resolve_nve(
|
||||
}
|
||||
|
||||
local_pref = calc_local_pref(info->attr, info->peer);
|
||||
if (info->attr
|
||||
&& (info->attr->flag & ATTR_FLAG_BIT(BGP_ATTR_MULTI_EXIT_DISC))) {
|
||||
|
||||
if (info->attr->flag & ATTR_FLAG_BIT(BGP_ATTR_MULTI_EXIT_DISC))
|
||||
med = &info->attr->med;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* At this point, we have allocated:
|
||||
@ -1103,7 +1095,7 @@ static void vnc_import_bgp_del_route_mode_plain(struct bgp *bgp,
|
||||
* Compute VN address
|
||||
*/
|
||||
|
||||
if (info && info->attr) {
|
||||
if (info) {
|
||||
rfapiUnicastNexthop2Prefix(afi, info->attr, &vn_pfx_space);
|
||||
} else {
|
||||
vnc_zlog_debug_verbose("%s: no attr, can't delete route",
|
||||
@ -1489,12 +1481,9 @@ void vnc_import_bgp_add_vnc_host_route_mode_resolve_nve(
|
||||
}
|
||||
local_pref = calc_local_pref(pb->ubpi->attr, pb->ubpi->peer);
|
||||
|
||||
if (pb->ubpi->attr
|
||||
&& (pb->ubpi->attr->flag
|
||||
& ATTR_FLAG_BIT(BGP_ATTR_MULTI_EXIT_DISC))) {
|
||||
|
||||
if (pb->ubpi->attr->flag
|
||||
& ATTR_FLAG_BIT(BGP_ATTR_MULTI_EXIT_DISC))
|
||||
med = &pb->ubpi->attr->med;
|
||||
}
|
||||
|
||||
/*
|
||||
* Sanity check
|
||||
@ -1729,11 +1718,6 @@ static void vnc_import_bgp_exterior_add_route_it(
|
||||
return;
|
||||
}
|
||||
|
||||
if (!info->attr) {
|
||||
vnc_zlog_debug_verbose("%s: no info, skipping", __func__);
|
||||
return;
|
||||
}
|
||||
|
||||
/*
|
||||
* Extract nexthop from exterior route
|
||||
*
|
||||
@ -1920,11 +1904,6 @@ void vnc_import_bgp_exterior_del_route(
|
||||
return;
|
||||
}
|
||||
|
||||
if (!info->attr) {
|
||||
vnc_zlog_debug_verbose("%s: no info, skipping", __func__);
|
||||
return;
|
||||
}
|
||||
|
||||
/*
|
||||
* Extract nexthop from exterior route
|
||||
*
|
||||
|
@ -1063,6 +1063,13 @@ Configuring Peers
|
||||
on by default or not. This command defaults to on and is not displayed.
|
||||
The `no bgp default ipv4-unicast` form of the command is displayed.
|
||||
|
||||
.. index:: [no] neighbor PEER advertisement-interval (0-600)
|
||||
.. clicmd:: [no] neighbor PEER advertisement-interval (0-600)
|
||||
|
||||
Setup the minimum route advertisement interval(mrai) for the
|
||||
peer in question. This number is between 0 and 600 seconds,
|
||||
with the default advertisement interval being 0.
|
||||
|
||||
.. _bgp-peer-filtering:
|
||||
|
||||
Peer Filtering
|
||||
|
@ -1915,6 +1915,7 @@ DEFUN (mac_access_list,
|
||||
argv_find(argv, argc, "X:X:X:X:X:X", &idx);
|
||||
if (idx)
|
||||
mac = argv[idx]->arg;
|
||||
assert(mac);
|
||||
|
||||
return filter_set_zebra(vty, argv[2]->arg, seq, permit_deny, AFI_L2VPN,
|
||||
mac, 0, 1);
|
||||
@ -1952,6 +1953,7 @@ DEFUN (no_mac_access_list,
|
||||
argv_find(argv, argc, "X:X:X:X:X:X", &idx);
|
||||
if (idx)
|
||||
mac = argv[idx]->arg;
|
||||
assert(mac);
|
||||
|
||||
return filter_set_zebra(vty, argv[2]->arg, seq, permit_deny, AFI_L2VPN,
|
||||
mac, 0, 0);
|
||||
@ -2050,6 +2052,7 @@ DEFUN (access_list_exact,
|
||||
argv_find(argv, argc, "A.B.C.D/M", &idx);
|
||||
if (idx)
|
||||
prefix = argv[idx]->arg;
|
||||
assert(prefix);
|
||||
|
||||
idx = 0;
|
||||
if (argv_find(argv, argc, "exact-match", &idx))
|
||||
@ -2122,6 +2125,7 @@ DEFUN (no_access_list_exact,
|
||||
argv_find(argv, argc, "A.B.C.D/M", &idx);
|
||||
if (idx)
|
||||
prefix = argv[idx]->arg;
|
||||
assert(prefix);
|
||||
|
||||
idx = 0;
|
||||
if (argv_find(argv, argc, "exact-match", &idx))
|
||||
@ -2367,6 +2371,7 @@ DEFUN (no_ipv6_access_list_exact,
|
||||
argv_find(argv, argc, "X:X::X:X/M", &idx);
|
||||
if (idx)
|
||||
prefix = argv[idx]->arg;
|
||||
assert(prefix);
|
||||
|
||||
idx = 0;
|
||||
if (argv_find(argv, argc, "exact-match", &idx))
|
||||
|
@ -1025,10 +1025,9 @@ DEFPY (show_route_all_table_vrf,
|
||||
continue;
|
||||
if (zrt->afi != afi || zrt->safi != SAFI_UNICAST)
|
||||
continue;
|
||||
if (zrt->table)
|
||||
do_show_route_helper(vty, info->zvrf, zrt->table, afi,
|
||||
false, 0, false, false,
|
||||
0, 0, !!json, zrt->tableid);
|
||||
|
||||
do_show_route_helper(vty, info->zvrf, zrt->table, afi, false, 0,
|
||||
false, false, 0, 0, !!json, zrt->tableid);
|
||||
}
|
||||
return CMD_SUCCESS;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user