mirror of
https://github.com/FRRouting/frr.git
synced 2025-04-30 21:47:15 +02:00
bgpd: Add accessor for bgp_attr.pmsi_tnl_type
Add an accessor for the bgp_attr.pmsi_tnl_type to allow us to abstract where it is. Every attribute is paying the price of this bit of data as part of `struct bgp_attr` In the future we'll move it elsewhere. Signed-off-by: Donald Sharp <sharpd@nvidia.com>
This commit is contained in:
parent
df7d4670ea
commit
2a3f51cf6b
|
@ -2785,7 +2785,7 @@ bgp_attr_pmsi_tunnel(struct bgp_attr_parser_args *args)
|
|||
}
|
||||
|
||||
attr->flag |= ATTR_FLAG_BIT(BGP_ATTR_PMSI_TUNNEL);
|
||||
attr->pmsi_tnl_type = tnl_type;
|
||||
bgp_attr_set_pmsi_tnl_type(attr, tnl_type);
|
||||
stream_get(&attr->label, peer->curr, BGP_LABEL_BYTES);
|
||||
|
||||
/* Forward read pointer of input stream. */
|
||||
|
@ -4110,7 +4110,7 @@ bgp_size_t bgp_packet_attribute(struct bgp *bgp, struct peer *peer,
|
|||
stream_putc(s, BGP_ATTR_PMSI_TUNNEL);
|
||||
stream_putc(s, 9); // Length
|
||||
stream_putc(s, 0); // Flags
|
||||
stream_putc(s, attr->pmsi_tnl_type);
|
||||
stream_putc(s, bgp_attr_get_pmsi_tnl_type(attr));
|
||||
stream_put(s, &(attr->label),
|
||||
BGP_LABEL_BYTES); // MPLS Label / VXLAN VNI
|
||||
stream_put_ipv4(s, attr->nexthop.s_addr);
|
||||
|
|
|
@ -457,4 +457,16 @@ static inline uint32_t mac_mobility_seqnum(struct attr *attr)
|
|||
{
|
||||
return (attr) ? attr->mm_seqnum : 0;
|
||||
}
|
||||
|
||||
static inline enum pta_type bgp_attr_get_pmsi_tnl_type(struct attr *attr)
|
||||
{
|
||||
return attr->pmsi_tnl_type;
|
||||
}
|
||||
|
||||
static inline void bgp_attr_set_pmsi_tnl_type(struct attr *attr,
|
||||
enum pta_type pmsi_tnl_type)
|
||||
{
|
||||
attr->pmsi_tnl_type = pmsi_tnl_type;
|
||||
}
|
||||
|
||||
#endif /* _QUAGGA_BGP_ATTR_H */
|
||||
|
|
|
@ -440,7 +440,7 @@ bool bgp_dump_attr(struct attr *attr, char *buf, size_t size)
|
|||
|
||||
if (CHECK_FLAG(attr->flag, ATTR_FLAG_BIT(BGP_ATTR_PMSI_TUNNEL)))
|
||||
snprintf(buf + strlen(buf), size - strlen(buf),
|
||||
", pmsi tnltype %u", attr->pmsi_tnl_type);
|
||||
", pmsi tnltype %u", bgp_attr_get_pmsi_tnl_type(attr));
|
||||
|
||||
if (CHECK_FLAG(attr->flag, ATTR_FLAG_BIT(BGP_ATTR_AS_PATH)))
|
||||
snprintf(buf + strlen(buf), size - strlen(buf), ", path %s",
|
||||
|
|
|
@ -980,7 +980,7 @@ static int evpn_zebra_install(struct bgp *bgp, struct bgpevpn *vpn,
|
|||
} else if (p->prefix.route_type == BGP_EVPN_AD_ROUTE) {
|
||||
ret = bgp_evpn_remote_es_evi_add(bgp, vpn, p);
|
||||
} else {
|
||||
switch (pi->attr->pmsi_tnl_type) {
|
||||
switch (bgp_attr_get_pmsi_tnl_type(pi->attr)) {
|
||||
case PMSI_TNLTYPE_INGR_REPL:
|
||||
flood_control = VXLAN_FLOOD_HEAD_END_REPL;
|
||||
break;
|
||||
|
@ -1711,7 +1711,7 @@ static int update_evpn_route(struct bgp *bgp, struct bgpevpn *vpn,
|
|||
/* PMSI is only needed for type-3 routes */
|
||||
if (p->prefix.route_type == BGP_EVPN_IMET_ROUTE) {
|
||||
attr.flag |= ATTR_FLAG_BIT(BGP_ATTR_PMSI_TUNNEL);
|
||||
attr.pmsi_tnl_type = PMSI_TNLTYPE_INGR_REPL;
|
||||
bgp_attr_set_pmsi_tnl_type(&attr, PMSI_TNLTYPE_INGR_REPL);
|
||||
}
|
||||
|
||||
if (bgp_debug_zebra(NULL)) {
|
||||
|
@ -3738,12 +3738,14 @@ static int process_type3_route(struct peer *peer, afi_t afi, safi_t safi,
|
|||
*/
|
||||
if (attr &&
|
||||
(attr->flag & ATTR_FLAG_BIT(BGP_ATTR_PMSI_TUNNEL))) {
|
||||
if (attr->pmsi_tnl_type != PMSI_TNLTYPE_INGR_REPL &&
|
||||
attr->pmsi_tnl_type != PMSI_TNLTYPE_PIM_SM) {
|
||||
flog_warn(EC_BGP_EVPN_PMSI_PRESENT,
|
||||
"%u:%s - Rx EVPN Type-3 NLRI with unsupported PTA %d",
|
||||
peer->bgp->vrf_id, peer->host,
|
||||
attr->pmsi_tnl_type);
|
||||
enum pta_type pmsi_tnl_type = bgp_attr_get_pmsi_tnl_type(attr);
|
||||
|
||||
if (pmsi_tnl_type != PMSI_TNLTYPE_INGR_REPL
|
||||
&& pmsi_tnl_type != PMSI_TNLTYPE_PIM_SM) {
|
||||
flog_warn(
|
||||
EC_BGP_EVPN_PMSI_PRESENT,
|
||||
"%u:%s - Rx EVPN Type-3 NLRI with unsupported PTA %d",
|
||||
peer->bgp->vrf_id, peer->host, pmsi_tnl_type);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -10221,9 +10221,9 @@ void route_vty_out_detail(struct vty *vty, struct bgp *bgp,
|
|||
|
||||
/* Line 10 display PMSI tunnel attribute, if present */
|
||||
if (attr->flag & ATTR_FLAG_BIT(BGP_ATTR_PMSI_TUNNEL)) {
|
||||
const char *str =
|
||||
lookup_msg(bgp_pmsi_tnltype_str, attr->pmsi_tnl_type,
|
||||
PMSI_TNLTYPE_STR_DEFAULT);
|
||||
const char *str = lookup_msg(bgp_pmsi_tnltype_str,
|
||||
bgp_attr_get_pmsi_tnl_type(attr),
|
||||
PMSI_TNLTYPE_STR_DEFAULT);
|
||||
|
||||
if (json_paths) {
|
||||
json_pmsi = json_object_new_object();
|
||||
|
|
Loading…
Reference in a new issue