mirror of
https://git.proxmox.com/git/mirror_frr
synced 2025-08-07 09:22:03 +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++;
|
bt->cnt_accept++;
|
||||||
|
|
||||||
setsockopt(bmp_sock, SOL_SOCKET, SO_KEEPALIVE, &on, sizeof(on));
|
if (setsockopt(bmp_sock, SOL_SOCKET, SO_KEEPALIVE, &on, sizeof(on)) < 0)
|
||||||
setsockopt(bmp_sock, IPPROTO_TCP, TCP_NODELAY, &on, sizeof(on));
|
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);
|
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
|
* SVI comes up with MAC and stored in hash, triggers
|
||||||
* bgp_mac_rescan_all_evpn_tables.
|
* bgp_mac_rescan_all_evpn_tables.
|
||||||
*/
|
*/
|
||||||
if (pi->attr &&
|
if (memcmp(&bgp_vrf->rmac, &pi->attr->rmac, ETH_ALEN) == 0) {
|
||||||
memcmp(&bgp_vrf->rmac, &pi->attr->rmac, ETH_ALEN) == 0) {
|
|
||||||
if (bgp_debug_update(pi->peer, NULL, NULL, 1)) {
|
if (bgp_debug_update(pi->peer, NULL, NULL, 1)) {
|
||||||
char buf1[PREFIX_STRLEN];
|
char buf1[PREFIX_STRLEN];
|
||||||
char attr_str[BUFSIZ] = {0};
|
char attr_str[BUFSIZ] = {0};
|
||||||
|
@ -294,7 +294,7 @@ void route_vty_out_flowspec(struct vty *vty, struct prefix *p,
|
|||||||
}
|
}
|
||||||
if (!path)
|
if (!path)
|
||||||
return;
|
return;
|
||||||
if (path->attr && path->attr->ecommunity) {
|
if (path->attr->ecommunity) {
|
||||||
/* Print attribute */
|
/* Print attribute */
|
||||||
attr = path->attr;
|
attr = path->attr;
|
||||||
s = ecommunity_ecom2str(attr->ecommunity,
|
s = ecommunity_ecom2str(attr->ecommunity,
|
||||||
|
@ -706,7 +706,7 @@ int bgp_pbr_build_and_validate_entry(struct prefix *p,
|
|||||||
if (ret < 0)
|
if (ret < 0)
|
||||||
return -1;
|
return -1;
|
||||||
/* extract actiosn from flowspec ecom list */
|
/* extract actiosn from flowspec ecom list */
|
||||||
if (path && path->attr && path->attr->ecommunity) {
|
if (path && path->attr->ecommunity) {
|
||||||
ecom = path->attr->ecommunity;
|
ecom = path->attr->ecommunity;
|
||||||
for (i = 0; i < ecom->size; i++) {
|
for (i = 0; i < ecom->size; i++) {
|
||||||
ecom_eval = (struct ecommunity_val *)
|
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) {
|
if (type == RMAP_BGP && prefix->family == AF_INET) {
|
||||||
path = (struct bgp_path_info *)object;
|
path = (struct bgp_path_info *)object;
|
||||||
if (!path || !path->attr)
|
if (!path)
|
||||||
return RMAP_NOMATCH;
|
return RMAP_NOMATCH;
|
||||||
|
|
||||||
/* If nexthop interface's index can't be resolved and nexthop is
|
/* 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
|
* For any other tunnel type, return noop to ignore
|
||||||
* this check.
|
* this check.
|
||||||
*/
|
*/
|
||||||
if (path->attr && path->attr->encap_tunneltype !=
|
if (path->attr->encap_tunneltype != BGP_ENCAP_TYPE_VXLAN)
|
||||||
BGP_ENCAP_TYPE_VXLAN)
|
|
||||||
return RMAP_NOOP;
|
return RMAP_NOOP;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -1470,7 +1469,7 @@ route_match_interface(void *rule, const struct prefix *prefix,
|
|||||||
if (type == RMAP_BGP) {
|
if (type == RMAP_BGP) {
|
||||||
path = object;
|
path = object;
|
||||||
|
|
||||||
if (!path || !path->attr)
|
if (!path)
|
||||||
return RMAP_NOMATCH;
|
return RMAP_NOMATCH;
|
||||||
|
|
||||||
ifp = if_lookup_by_name_all_vrf((char *)rule);
|
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) {
|
if (type == RMAP_BGP && prefix->family == AF_INET6) {
|
||||||
path = (struct bgp_path_info *)object;
|
path = (struct bgp_path_info *)object;
|
||||||
if (!path || !path->attr)
|
if (!path)
|
||||||
return RMAP_NOMATCH;
|
return RMAP_NOMATCH;
|
||||||
|
|
||||||
if (IPV6_ADDR_SAME(&path->attr->mp_nexthop_global, addr)
|
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) {
|
bpi = bpi->next) {
|
||||||
|
|
||||||
vnc_zlog_debug_verbose(
|
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,
|
__func__, bpi, bpi->peer, bpi->type, bpi->sub_type,
|
||||||
(bpi->extra ? bpi->extra->vnc.export.rfapi_handle
|
(bpi->extra ? bpi->extra->vnc.export.rfapi_handle
|
||||||
: NULL),
|
: NULL),
|
||||||
((bpi->attr
|
CHECK_FLAG(bpi->attr->flag,
|
||||||
&& CHECK_FLAG(bpi->attr->flag,
|
ATTR_FLAG_BIT(BGP_ATTR_LOCAL_PREF)
|
||||||
ATTR_FLAG_BIT(BGP_ATTR_LOCAL_PREF)))
|
? bpi->attr->local_pref : 0));
|
||||||
? bpi->attr->local_pref
|
|
||||||
: 0));
|
|
||||||
|
|
||||||
if (bpi->peer == peer && bpi->type == type
|
if (bpi->peer == peer && bpi->type == type
|
||||||
&& bpi->sub_type == sub_type && bpi->extra
|
&& 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);
|
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);
|
bgp_path_info_extra_get(new);
|
||||||
if (prd) {
|
if (prd) {
|
||||||
@ -516,9 +515,8 @@ static void rfapiBgpInfoFree(struct bgp_path_info *goner)
|
|||||||
peer_unlock(goner->peer);
|
peer_unlock(goner->peer);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (goner->attr) {
|
bgp_attr_unintern(&goner->attr);
|
||||||
bgp_attr_unintern(&goner->attr);
|
|
||||||
}
|
|
||||||
if (goner->extra)
|
if (goner->extra)
|
||||||
bgp_path_info_extra_free(&goner->extra);
|
bgp_path_info_extra_free(&goner->extra);
|
||||||
XFREE(MTYPE_BGP_ROUTE, goner);
|
XFREE(MTYPE_BGP_ROUTE, goner);
|
||||||
@ -1113,9 +1111,6 @@ static int rfapiVpnBiSamePtUn(struct bgp_path_info *bpi1,
|
|||||||
if (!bpi1 || !bpi2)
|
if (!bpi1 || !bpi2)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
if (!bpi1->attr || !bpi2->attr)
|
|
||||||
return 0;
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* VN address comparisons
|
* VN address comparisons
|
||||||
*/
|
*/
|
||||||
@ -1299,13 +1294,10 @@ rfapiRouteInfo2NextHopEntry(struct rfapi_ip_prefix *rprefix,
|
|||||||
memcpy(&vo->v.l2addr.macaddr, &rn->p.u.prefix_eth.octet,
|
memcpy(&vo->v.l2addr.macaddr, &rn->p.u.prefix_eth.octet,
|
||||||
ETH_ALEN);
|
ETH_ALEN);
|
||||||
/* only low 3 bytes of this are significant */
|
/* only low 3 bytes of this are significant */
|
||||||
if (bpi->attr) {
|
(void)rfapiEcommunityGetLNI(bpi->attr->ecommunity,
|
||||||
(void)rfapiEcommunityGetLNI(
|
&vo->v.l2addr.logical_net_id);
|
||||||
bpi->attr->ecommunity,
|
(void)rfapiEcommunityGetEthernetTag(bpi->attr->ecommunity,
|
||||||
&vo->v.l2addr.logical_net_id);
|
&vo->v.l2addr.tag_id);
|
||||||
(void)rfapiEcommunityGetEthernetTag(
|
|
||||||
bpi->attr->ecommunity, &vo->v.l2addr.tag_id);
|
|
||||||
}
|
|
||||||
|
|
||||||
/* local_nve_id comes from lower byte of RD type */
|
/* local_nve_id comes from lower byte of RD type */
|
||||||
vo->v.l2addr.local_nve_id = bpi->extra->vnc.import.rd.val[1];
|
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*/
|
||||||
bgp_encap_types tun_type = BGP_ENCAP_TYPE_MPLS; /*Default*/
|
new->prefix.cost = rfapiRfpCost(bpi->attr);
|
||||||
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)) {
|
switch (BGP_MP_NEXTHOP_FAMILY(bpi->attr->mp_nexthop_len)) {
|
||||||
case AF_INET:
|
case AF_INET:
|
||||||
new->vn_address.addr_family = AF_INET;
|
new->vn_address.addr_family = AF_INET;
|
||||||
new->vn_address.addr.v4 =
|
new->vn_address.addr.v4 = bpi->attr->mp_nexthop_global_in;
|
||||||
bpi->attr->mp_nexthop_global_in;
|
break;
|
||||||
break;
|
|
||||||
|
|
||||||
case AF_INET6:
|
case AF_INET6:
|
||||||
new->vn_address.addr_family = AF_INET6;
|
new->vn_address.addr_family = AF_INET6;
|
||||||
new->vn_address.addr.v6 = bpi->attr->mp_nexthop_global;
|
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;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
zlog_warn("%s: invalid vpn nexthop length: %d",
|
zlog_warn("%s: unknown VNC option type %d", __func__,
|
||||||
__func__, bpi->attr->mp_nexthop_len);
|
pEncap->type);
|
||||||
rfapi_free_next_hop_list(new);
|
|
||||||
return NULL;
|
break;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
for (pEncap = bpi->attr->vnc_subtlvs; pEncap;
|
bgp_attr_extcom_tunnel_type(bpi->attr, &tun_type);
|
||||||
pEncap = pEncap->next) {
|
if (tun_type == BGP_ENCAP_TYPE_MPLS) {
|
||||||
switch (pEncap->type) {
|
struct prefix p;
|
||||||
case BGP_VNC_SUBTLV_TYPE_LIFETIME:
|
/* MPLS carries UN address in next hop */
|
||||||
/* use configured lifetime, not attr lifetime */
|
rfapiNexthop2Prefix(bpi->attr, &p);
|
||||||
break;
|
if (p.family != 0) {
|
||||||
|
rfapiQprefix2Raddr(&p, &new->un_address);
|
||||||
default:
|
have_vnc_tunnel_un = 1;
|
||||||
zlog_warn("%s: unknown VNC option type %d",
|
|
||||||
__func__, pEncap->type);
|
|
||||||
|
|
||||||
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
bgp_attr_extcom_tunnel_type(bpi->attr, &tun_type);
|
for (pEncap = bpi->attr->encap_subtlvs; pEncap; pEncap = pEncap->next) {
|
||||||
if (tun_type == BGP_ENCAP_TYPE_MPLS) {
|
switch (pEncap->type) {
|
||||||
struct prefix p;
|
case BGP_ENCAP_SUBTLV_TYPE_REMOTE_ENDPOINT:
|
||||||
/* MPLS carries UN address in next hop */
|
/*
|
||||||
rfapiNexthop2Prefix(bpi->attr, &p);
|
* Overrides ENCAP UN address, if any
|
||||||
if (p.family != 0) {
|
*/
|
||||||
rfapiQprefix2Raddr(&p, &new->un_address);
|
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;
|
have_vnc_tunnel_un = 1;
|
||||||
}
|
break;
|
||||||
}
|
|
||||||
|
|
||||||
for (pEncap = bpi->attr->encap_subtlvs; pEncap;
|
case 20:
|
||||||
pEncap = pEncap->next) {
|
new->un_address.addr_family = AF_INET6;
|
||||||
switch (pEncap->type) {
|
memcpy(&new->un_address.addr.v6, pEncap->value,
|
||||||
case BGP_ENCAP_SUBTLV_TYPE_REMOTE_ENDPOINT:
|
16);
|
||||||
/*
|
have_vnc_tunnel_un = 1;
|
||||||
* 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);
|
|
||||||
}
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
zlog_warn(
|
zlog_warn(
|
||||||
"%s: unknown Encap Attribute option type %d",
|
"%s: invalid tunnel subtlv UN addr length (%d) for bpi %p",
|
||||||
__func__, pEncap->type);
|
__func__, pEncap->length, bpi);
|
||||||
|
|
||||||
|
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
}
|
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
|
#if DEBUG_ENCAP_MONITOR
|
||||||
vnc_zlog_debug_verbose("%s: line %d: have_vnc_tunnel_un=%d",
|
vnc_zlog_debug_verbose("%s: line %d: have_vnc_tunnel_un=%d", __func__,
|
||||||
__func__, __LINE__, have_vnc_tunnel_un);
|
__LINE__, have_vnc_tunnel_un);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if (!have_vnc_tunnel_un && bpi->extra) {
|
if (!have_vnc_tunnel_un && bpi->extra) {
|
||||||
/*
|
/*
|
||||||
* use cached UN address from ENCAP route
|
* use cached UN address from ENCAP route
|
||||||
*/
|
*/
|
||||||
new->un_address.addr_family =
|
new->un_address.addr_family = bpi->extra->vnc.import.un_family;
|
||||||
bpi->extra->vnc.import.un_family;
|
switch (new->un_address.addr_family) {
|
||||||
switch (new->un_address.addr_family) {
|
case AF_INET:
|
||||||
case AF_INET:
|
new->un_address.addr.v4 =
|
||||||
new->un_address.addr.v4 =
|
bpi->extra->vnc.import.un.addr4;
|
||||||
bpi->extra->vnc.import.un.addr4;
|
break;
|
||||||
break;
|
case AF_INET6:
|
||||||
case AF_INET6:
|
new->un_address.addr.v6 =
|
||||||
new->un_address.addr.v6 =
|
bpi->extra->vnc.import.un.addr6;
|
||||||
bpi->extra->vnc.import.un.addr6;
|
break;
|
||||||
break;
|
default:
|
||||||
default:
|
zlog_warn("%s: invalid UN addr family (%d) for bpi %p",
|
||||||
zlog_warn(
|
__func__, new->un_address.addr_family, bpi);
|
||||||
"%s: invalid UN addr family (%d) for bpi %p",
|
rfapi_free_next_hop_list(new);
|
||||||
__func__, new->un_address.addr_family,
|
return NULL;
|
||||||
bpi);
|
break;
|
||||||
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,
|
static void rfapiCopyUnEncap2VPN(struct bgp_path_info *encap_bpi,
|
||||||
struct bgp_path_info *vpn_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) {
|
if (!vpn_bpi || !vpn_bpi->extra) {
|
||||||
zlog_warn("%s: no vpn bpi attr/extra, can't copy UN address",
|
zlog_warn("%s: no vpn bpi attr/extra, can't copy UN address",
|
||||||
__func__);
|
__func__);
|
||||||
@ -4510,10 +4484,9 @@ static void rfapiDeleteRemotePrefixesIt(
|
|||||||
vnc_zlog_debug_verbose("%s: examining bpi %p",
|
vnc_zlog_debug_verbose("%s: examining bpi %p",
|
||||||
__func__, bpi);
|
__func__, bpi);
|
||||||
|
|
||||||
if (bpi->attr) {
|
if (!rfapiGetNexthop(bpi->attr, &qpt))
|
||||||
if (!rfapiGetNexthop(bpi->attr, &qpt))
|
qpt_valid = 1;
|
||||||
qpt_valid = 1;
|
|
||||||
}
|
|
||||||
if (vn) {
|
if (vn) {
|
||||||
if (!qpt_valid
|
if (!qpt_valid
|
||||||
|| !prefix_match(vn, &qpt)) {
|
|| !prefix_match(vn, &qpt)) {
|
||||||
|
@ -1647,11 +1647,6 @@ void rfapiRibUpdatePendingNode(
|
|||||||
struct rfapi_info *ri;
|
struct rfapi_info *ri;
|
||||||
struct prefix pfx_nh;
|
struct prefix pfx_nh;
|
||||||
|
|
||||||
if (!bpi->attr) {
|
|
||||||
/* shouldn't happen */
|
|
||||||
/* TBD increment error stats counter */
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
if (!bpi->extra) {
|
if (!bpi->extra) {
|
||||||
/* shouldn't happen */
|
/* shouldn't happen */
|
||||||
/* TBD increment error stats counter */
|
/* 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,
|
s = ecommunity_ecom2str(bpi->attr->ecommunity,
|
||||||
ECOMMUNITY_FORMAT_ROUTE_MAP, 0);
|
ECOMMUNITY_FORMAT_ROUTE_MAP, 0);
|
||||||
vty_out(vty, " EC{%s}", s);
|
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)
|
* RFP option sizes (they are opaque values)
|
||||||
* extended communities (RTs)
|
* extended communities (RTs)
|
||||||
*/
|
*/
|
||||||
if (bpi->attr) {
|
uint32_t lifetime;
|
||||||
uint32_t lifetime;
|
int printed_1st_gol = 0;
|
||||||
int printed_1st_gol = 0;
|
struct bgp_attr_encap_subtlv *pEncap;
|
||||||
struct bgp_attr_encap_subtlv *pEncap;
|
struct prefix pfx_un;
|
||||||
struct prefix pfx_un;
|
int af = BGP_MP_NEXTHOP_FAMILY(bpi->attr->mp_nexthop_len);
|
||||||
int af = BGP_MP_NEXTHOP_FAMILY(bpi->attr->mp_nexthop_len);
|
|
||||||
|
|
||||||
/* Nexthop */
|
/* Nexthop */
|
||||||
if (af == AF_INET) {
|
if (af == AF_INET) {
|
||||||
r = snprintf(p, REMAIN, "%s",
|
r = snprintf(p, REMAIN, "%s",
|
||||||
inet_ntop(AF_INET,
|
inet_ntop(AF_INET,
|
||||||
&bpi->attr->mp_nexthop_global_in,
|
&bpi->attr->mp_nexthop_global_in, buf,
|
||||||
buf, BUFSIZ));
|
BUFSIZ));
|
||||||
INCP;
|
INCP;
|
||||||
} else if (af == AF_INET6) {
|
} else if (af == AF_INET6) {
|
||||||
r = snprintf(p, REMAIN, "%s",
|
r = snprintf(p, REMAIN, "%s",
|
||||||
inet_ntop(AF_INET6,
|
inet_ntop(AF_INET6, &bpi->attr->mp_nexthop_global,
|
||||||
&bpi->attr->mp_nexthop_global,
|
buf, BUFSIZ));
|
||||||
buf, BUFSIZ));
|
INCP;
|
||||||
INCP;
|
} else {
|
||||||
} else {
|
r = snprintf(p, REMAIN, "?");
|
||||||
r = snprintf(p, REMAIN, "?");
|
INCP;
|
||||||
INCP;
|
}
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* VNC tunnel subtlv, if present, contains UN address
|
* VNC tunnel subtlv, if present, contains UN address
|
||||||
*/
|
*/
|
||||||
if (!rfapiGetVncTunnelUnAddr(bpi->attr, &pfx_un)) {
|
if (!rfapiGetVncTunnelUnAddr(bpi->attr, &pfx_un)) {
|
||||||
r = snprintf(p, REMAIN, " un=%s",
|
r = snprintf(
|
||||||
inet_ntop(pfx_un.family, pfx_un.u.val, buf,
|
p, REMAIN, " un=%s",
|
||||||
BUFSIZ));
|
inet_ntop(pfx_un.family, pfx_un.u.val, buf, BUFSIZ));
|
||||||
INCP;
|
INCP;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Lifetime */
|
/* Lifetime */
|
||||||
if (rfapiGetVncLifetime(bpi->attr, &lifetime)) {
|
if (rfapiGetVncLifetime(bpi->attr, &lifetime)) {
|
||||||
r = snprintf(p, REMAIN, " nolife");
|
r = snprintf(p, REMAIN, " nolife");
|
||||||
INCP;
|
INCP;
|
||||||
} else {
|
} else {
|
||||||
if (lifetime == 0xffffffff)
|
if (lifetime == 0xffffffff)
|
||||||
r = snprintf(p, REMAIN, " %6s", "infini");
|
r = snprintf(p, REMAIN, " %6s", "infini");
|
||||||
else
|
else
|
||||||
r = snprintf(p, REMAIN, " %6u", lifetime);
|
r = snprintf(p, REMAIN, " %6u", lifetime);
|
||||||
INCP;
|
INCP;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* RFP option lengths */
|
/* RFP option lengths */
|
||||||
for (pEncap = bpi->attr->vnc_subtlvs; pEncap;
|
for (pEncap = bpi->attr->vnc_subtlvs; pEncap; pEncap = pEncap->next) {
|
||||||
pEncap = pEncap->next) {
|
|
||||||
|
|
||||||
if (pEncap->type == BGP_VNC_SUBTLV_TYPE_RFPOPTION) {
|
if (pEncap->type == BGP_VNC_SUBTLV_TYPE_RFPOPTION) {
|
||||||
if (printed_1st_gol) {
|
if (printed_1st_gol) {
|
||||||
r = snprintf(p, REMAIN, ",");
|
r = snprintf(p, REMAIN, ",");
|
||||||
INCP;
|
INCP;
|
||||||
} else {
|
} else {
|
||||||
r = snprintf(p, REMAIN,
|
r = snprintf(p, REMAIN,
|
||||||
" "); /* leading space */
|
" "); /* leading space */
|
||||||
INCP;
|
|
||||||
}
|
|
||||||
r = snprintf(p, REMAIN, "%d", pEncap->length);
|
|
||||||
INCP;
|
INCP;
|
||||||
printed_1st_gol = 1;
|
|
||||||
}
|
}
|
||||||
}
|
r = snprintf(p, REMAIN, "%d", pEncap->length);
|
||||||
|
|
||||||
/* RT list */
|
|
||||||
if (bpi->attr->ecommunity) {
|
|
||||||
s = ecommunity_ecom2str(bpi->attr->ecommunity,
|
|
||||||
ECOMMUNITY_FORMAT_ROUTE_MAP, 0);
|
|
||||||
r = snprintf(p, REMAIN, " %s", s);
|
|
||||||
INCP;
|
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);
|
r = snprintf(p, REMAIN, " bpi@%p", bpi);
|
||||||
INCP;
|
INCP;
|
||||||
|
|
||||||
@ -628,21 +624,17 @@ void rfapiPrintBi(void *stream, struct bgp_path_info *bpi)
|
|||||||
INCP;
|
INCP;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (bpi->attr) {
|
if (bpi->attr->weight) {
|
||||||
|
r = snprintf(p, REMAIN, " W=%d", bpi->attr->weight);
|
||||||
|
INCP;
|
||||||
|
}
|
||||||
|
|
||||||
if (bpi->attr->weight) {
|
if (bpi->attr->flag & ATTR_FLAG_BIT(BGP_ATTR_LOCAL_PREF)) {
|
||||||
r = snprintf(p, REMAIN, " W=%d", bpi->attr->weight);
|
r = snprintf(p, REMAIN, " LP=%d", bpi->attr->local_pref);
|
||||||
INCP;
|
INCP;
|
||||||
}
|
} else {
|
||||||
|
r = snprintf(p, REMAIN, " LP=unset");
|
||||||
if (bpi->attr->flag & ATTR_FLAG_BIT(BGP_ATTR_LOCAL_PREF)) {
|
INCP;
|
||||||
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),
|
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
|
* See rfapi_import.c'rfapiRouteInfo2NextHopEntry() for conversion
|
||||||
* back to cost.
|
* back to cost.
|
||||||
*/
|
*/
|
||||||
if (bpi->attr) {
|
uint32_t local_pref;
|
||||||
uint32_t local_pref;
|
|
||||||
if (bpi->attr->flag & ATTR_FLAG_BIT(BGP_ATTR_LOCAL_PREF))
|
if (bpi->attr->flag & ATTR_FLAG_BIT(BGP_ATTR_LOCAL_PREF))
|
||||||
local_pref = bpi->attr->local_pref;
|
local_pref = bpi->attr->local_pref;
|
||||||
else
|
else
|
||||||
local_pref = 0;
|
local_pref = 0;
|
||||||
cost = (local_pref > 255) ? 0 : 255 - local_pref;
|
cost = (local_pref > 255) ? 0 : 255 - local_pref;
|
||||||
} else {
|
|
||||||
cost = 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
fp(out, "%-20s ", buf_pfx);
|
fp(out, "%-20s ", buf_pfx);
|
||||||
fp(out, "%-15s ", buf_vn);
|
fp(out, "%-15s ", buf_vn);
|
||||||
|
@ -476,25 +476,21 @@ static void vnc_import_bgp_add_route_mode_resolve_nve_one_bi(
|
|||||||
plifetime = &lifetime;
|
plifetime = &lifetime;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (bpi->attr) {
|
encaptlvs = bpi->attr->vnc_subtlvs;
|
||||||
encaptlvs = bpi->attr->vnc_subtlvs;
|
if (bpi->attr->encap_tunneltype != BGP_ENCAP_TYPE_RESERVED
|
||||||
if (bpi->attr->encap_tunneltype != BGP_ENCAP_TYPE_RESERVED
|
&& bpi->attr->encap_tunneltype != BGP_ENCAP_TYPE_MPLS) {
|
||||||
&& bpi->attr->encap_tunneltype != BGP_ENCAP_TYPE_MPLS) {
|
if (opt != NULL)
|
||||||
if (opt != NULL)
|
opt->next = &optary[cur_opt];
|
||||||
opt->next = &optary[cur_opt];
|
opt = &optary[cur_opt++];
|
||||||
opt = &optary[cur_opt++];
|
memset(opt, 0, sizeof(struct rfapi_un_option));
|
||||||
memset(opt, 0, sizeof(struct rfapi_un_option));
|
opt->type = RFAPI_UN_OPTION_TYPE_TUNNELTYPE;
|
||||||
opt->type = RFAPI_UN_OPTION_TYPE_TUNNELTYPE;
|
opt->v.tunnel.type = bpi->attr->encap_tunneltype;
|
||||||
opt->v.tunnel.type = bpi->attr->encap_tunneltype;
|
/* TBD parse bpi->attr->extra->encap_subtlvs */
|
||||||
/* TBD parse bpi->attr->extra->encap_subtlvs */
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
encaptlvs = NULL;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
struct ecommunity *new_ecom = ecommunity_dup(ecom);
|
struct ecommunity *new_ecom = ecommunity_dup(ecom);
|
||||||
|
|
||||||
if (bpi->attr && bpi->attr->ecommunity)
|
if (bpi->attr->ecommunity)
|
||||||
ecommunity_merge(new_ecom, bpi->attr->ecommunity);
|
ecommunity_merge(new_ecom, bpi->attr->ecommunity);
|
||||||
|
|
||||||
if (bpi->extra)
|
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);
|
local_pref = calc_local_pref(info->attr, info->peer);
|
||||||
if (info->attr
|
if (info->attr->flag & ATTR_FLAG_BIT(BGP_ATTR_MULTI_EXIT_DISC))
|
||||||
&& (info->attr->flag & ATTR_FLAG_BIT(BGP_ATTR_MULTI_EXIT_DISC))) {
|
|
||||||
|
|
||||||
med = &info->attr->med;
|
med = &info->attr->med;
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* At this point, we have allocated:
|
* 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
|
* Compute VN address
|
||||||
*/
|
*/
|
||||||
|
|
||||||
if (info && info->attr) {
|
if (info) {
|
||||||
rfapiUnicastNexthop2Prefix(afi, info->attr, &vn_pfx_space);
|
rfapiUnicastNexthop2Prefix(afi, info->attr, &vn_pfx_space);
|
||||||
} else {
|
} else {
|
||||||
vnc_zlog_debug_verbose("%s: no attr, can't delete route",
|
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);
|
local_pref = calc_local_pref(pb->ubpi->attr, pb->ubpi->peer);
|
||||||
|
|
||||||
if (pb->ubpi->attr
|
if (pb->ubpi->attr->flag
|
||||||
&& (pb->ubpi->attr->flag
|
& ATTR_FLAG_BIT(BGP_ATTR_MULTI_EXIT_DISC))
|
||||||
& ATTR_FLAG_BIT(BGP_ATTR_MULTI_EXIT_DISC))) {
|
|
||||||
|
|
||||||
med = &pb->ubpi->attr->med;
|
med = &pb->ubpi->attr->med;
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Sanity check
|
* Sanity check
|
||||||
@ -1729,11 +1718,6 @@ static void vnc_import_bgp_exterior_add_route_it(
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!info->attr) {
|
|
||||||
vnc_zlog_debug_verbose("%s: no info, skipping", __func__);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Extract nexthop from exterior route
|
* Extract nexthop from exterior route
|
||||||
*
|
*
|
||||||
@ -1920,11 +1904,6 @@ void vnc_import_bgp_exterior_del_route(
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!info->attr) {
|
|
||||||
vnc_zlog_debug_verbose("%s: no info, skipping", __func__);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Extract nexthop from exterior route
|
* 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.
|
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.
|
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:
|
.. _bgp-peer-filtering:
|
||||||
|
|
||||||
Peer Filtering
|
Peer Filtering
|
||||||
|
@ -1915,6 +1915,7 @@ DEFUN (mac_access_list,
|
|||||||
argv_find(argv, argc, "X:X:X:X:X:X", &idx);
|
argv_find(argv, argc, "X:X:X:X:X:X", &idx);
|
||||||
if (idx)
|
if (idx)
|
||||||
mac = argv[idx]->arg;
|
mac = argv[idx]->arg;
|
||||||
|
assert(mac);
|
||||||
|
|
||||||
return filter_set_zebra(vty, argv[2]->arg, seq, permit_deny, AFI_L2VPN,
|
return filter_set_zebra(vty, argv[2]->arg, seq, permit_deny, AFI_L2VPN,
|
||||||
mac, 0, 1);
|
mac, 0, 1);
|
||||||
@ -1952,6 +1953,7 @@ DEFUN (no_mac_access_list,
|
|||||||
argv_find(argv, argc, "X:X:X:X:X:X", &idx);
|
argv_find(argv, argc, "X:X:X:X:X:X", &idx);
|
||||||
if (idx)
|
if (idx)
|
||||||
mac = argv[idx]->arg;
|
mac = argv[idx]->arg;
|
||||||
|
assert(mac);
|
||||||
|
|
||||||
return filter_set_zebra(vty, argv[2]->arg, seq, permit_deny, AFI_L2VPN,
|
return filter_set_zebra(vty, argv[2]->arg, seq, permit_deny, AFI_L2VPN,
|
||||||
mac, 0, 0);
|
mac, 0, 0);
|
||||||
@ -2050,6 +2052,7 @@ DEFUN (access_list_exact,
|
|||||||
argv_find(argv, argc, "A.B.C.D/M", &idx);
|
argv_find(argv, argc, "A.B.C.D/M", &idx);
|
||||||
if (idx)
|
if (idx)
|
||||||
prefix = argv[idx]->arg;
|
prefix = argv[idx]->arg;
|
||||||
|
assert(prefix);
|
||||||
|
|
||||||
idx = 0;
|
idx = 0;
|
||||||
if (argv_find(argv, argc, "exact-match", &idx))
|
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);
|
argv_find(argv, argc, "A.B.C.D/M", &idx);
|
||||||
if (idx)
|
if (idx)
|
||||||
prefix = argv[idx]->arg;
|
prefix = argv[idx]->arg;
|
||||||
|
assert(prefix);
|
||||||
|
|
||||||
idx = 0;
|
idx = 0;
|
||||||
if (argv_find(argv, argc, "exact-match", &idx))
|
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);
|
argv_find(argv, argc, "X:X::X:X/M", &idx);
|
||||||
if (idx)
|
if (idx)
|
||||||
prefix = argv[idx]->arg;
|
prefix = argv[idx]->arg;
|
||||||
|
assert(prefix);
|
||||||
|
|
||||||
idx = 0;
|
idx = 0;
|
||||||
if (argv_find(argv, argc, "exact-match", &idx))
|
if (argv_find(argv, argc, "exact-match", &idx))
|
||||||
|
@ -1025,10 +1025,9 @@ DEFPY (show_route_all_table_vrf,
|
|||||||
continue;
|
continue;
|
||||||
if (zrt->afi != afi || zrt->safi != SAFI_UNICAST)
|
if (zrt->afi != afi || zrt->safi != SAFI_UNICAST)
|
||||||
continue;
|
continue;
|
||||||
if (zrt->table)
|
|
||||||
do_show_route_helper(vty, info->zvrf, zrt->table, afi,
|
do_show_route_helper(vty, info->zvrf, zrt->table, afi, false, 0,
|
||||||
false, 0, false, false,
|
false, false, 0, 0, !!json, zrt->tableid);
|
||||||
0, 0, !!json, zrt->tableid);
|
|
||||||
}
|
}
|
||||||
return CMD_SUCCESS;
|
return CMD_SUCCESS;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user