diff --git a/bgpd/bgp_attr.c b/bgpd/bgp_attr.c index 6d9c555ddc8a..6bf5d17a66ed 100644 --- a/bgpd/bgp_attr.c +++ b/bgpd/bgp_attr.c @@ -776,9 +776,8 @@ unsigned int attrhash_key_make(const void *p) attr->aggregator_addr.s_addr); MIX3(attr->weight, attr->mp_nexthop_global_in.s_addr, attr->originator_id.s_addr); - MIX3(attr->tag, attr->label, attr->label_index); + MIX3(attr->tag, attr->num_labels, attr->label_index); - MIX(attr->num_labels); if (attr->num_labels) key = jhash(&attr->label_tbl, attr->num_labels * sizeof(mpls_label_t), key); @@ -926,7 +925,7 @@ static void attr_show_all_iterator(struct hash_bucket *bucket, struct vty *vty) "\tflags: %" PRIu64 " distance: %u med: %u local_pref: %u origin: %u weight: %u label: %u sid: %pI6\n", attr->flag, attr->distance, attr->med, attr->local_pref, - attr->origin, attr->weight, attr->label, sid); + attr->origin, attr->weight, attr->label_tbl[0], sid); } void attr_show_all(struct vty *vty) @@ -1083,7 +1082,6 @@ struct attr *bgp_attr_default_set(struct attr *attr, struct bgp *bgp, attr->weight = BGP_ATTR_DEFAULT_WEIGHT; attr->tag = 0; attr->label_index = BGP_INVALID_LABEL_INDEX; - attr->label = MPLS_INVALID_LABEL; attr->flag |= ATTR_FLAG_BIT(BGP_ATTR_NEXT_HOP); attr->mp_nexthop_len = IPV6_MAX_BYTELEN; attr->local_pref = bgp->default_local_pref; @@ -1143,7 +1141,6 @@ struct attr *bgp_attr_aggregate_intern( bgp_attr_add_gshut_community(&attr); attr.label_index = BGP_INVALID_LABEL_INDEX; - attr.label = MPLS_INVALID_LABEL; attr.weight = BGP_ATTR_DEFAULT_WEIGHT; attr.mp_nexthop_len = IPV6_MAX_BYTELEN; if (!aggregate->as_set || atomic_aggregate) @@ -3253,7 +3250,8 @@ bgp_attr_pmsi_tunnel(struct bgp_attr_parser_args *args) attr->flag |= ATTR_FLAG_BIT(BGP_ATTR_PMSI_TUNNEL); bgp_attr_set_pmsi_tnl_type(attr, tnl_type); - stream_get(&attr->label, peer->curr, BGP_LABEL_BYTES); + stream_get(&attr->label_tbl[0], peer->curr, BGP_LABEL_BYTES); + attr->num_labels = 1; /* Forward read pointer of input stream. */ stream_forward_getp(peer->curr, length - attr_parse_len); @@ -4851,12 +4849,13 @@ bgp_size_t bgp_packet_attribute(struct bgp *bgp, struct peer *peer, /* PMSI Tunnel */ if (attr->flag & ATTR_FLAG_BIT(BGP_ATTR_PMSI_TUNNEL)) { + mpls_label_t label = attr->num_labels ? attr->label_tbl[0] : MPLS_INVALID_LABEL; stream_putc(s, BGP_ATTR_FLAG_OPTIONAL | BGP_ATTR_FLAG_TRANS); stream_putc(s, BGP_ATTR_PMSI_TUNNEL); stream_putc(s, 9); // Length stream_putc(s, 0); // Flags stream_putc(s, bgp_attr_get_pmsi_tnl_type(attr)); - stream_put(s, &(attr->label), + stream_put(s, &label, BGP_LABEL_BYTES); // MPLS Label / VXLAN VNI stream_put_ipv4(s, attr->nexthop.s_addr); // Unicast tunnel endpoint IP address diff --git a/bgpd/bgp_attr.h b/bgpd/bgp_attr.h index 90578b7a26a7..d3d5ac09ea67 100644 --- a/bgpd/bgp_attr.h +++ b/bgpd/bgp_attr.h @@ -220,9 +220,6 @@ struct attr { /* ifIndex corresponding to mp_nexthop_local. */ ifindex_t nh_lla_ifindex; - /* MPLS label (VNI) */ - mpls_label_t label; - /* Extended Communities attribute. */ struct ecommunity *ecommunity; diff --git a/bgpd/bgp_evpn.c b/bgpd/bgp_evpn.c index bfe8e343a8af..6ef27f9d4c69 100644 --- a/bgpd/bgp_evpn.c +++ b/bgpd/bgp_evpn.c @@ -2147,7 +2147,8 @@ static int update_evpn_route(struct bgp *bgp, struct bgpevpn *vpn, esi_to_str(esi, buf3, sizeof(buf3))); } - vni2label(vpn->vni, &(attr.label)); + vni2label(vpn->vni, &(attr.label_tbl[0])); + attr.num_labels = 1; /* Include L3 VNI related RTs and RMAC for type-2 routes, if they're * IPv4 or IPv6 global addresses and we're advertising L3VNI with @@ -2416,7 +2417,9 @@ void bgp_evpn_update_type2_route_entry(struct bgp *bgp, struct bgpevpn *vpn, memcpy(&attr.esi, &local_pi->attr->esi, sizeof(esi_t)); bgp_evpn_get_rmac_nexthop(vpn, &evp, &attr, local_pi->extra->evpn->af_flags); - vni2label(vpn->vni, &(attr.label)); + vni2label(vpn->vni, &(attr.label_tbl[0])); + attr.num_labels = 1; + /* Add L3 VNI RTs and RMAC for non IPv6 link-local if * using L3 VNI for type-2 routes also. */ diff --git a/bgpd/bgp_evpn_mh.c b/bgpd/bgp_evpn_mh.c index b8b07ee8a3ee..db01b2f15666 100644 --- a/bgpd/bgp_evpn_mh.c +++ b/bgpd/bgp_evpn_mh.c @@ -960,7 +960,8 @@ static int bgp_evpn_type1_route_update(struct bgp *bgp, struct bgp_evpn_es *es, if (vpn) { /* EAD-EVI route update */ /* MPLS label */ - vni2label(vpn->vni, &(attr.label)); + vni2label(vpn->vni, &(attr.label_tbl[0])); + attr.num_labels = 1; /* Set up extended community */ bgp_evpn_type1_evi_route_extcomm_build(es, vpn, &attr); diff --git a/bgpd/bgp_packet.c b/bgpd/bgp_packet.c index 9d484d901ac1..0bf547ff6659 100644 --- a/bgpd/bgp_packet.c +++ b/bgpd/bgp_packet.c @@ -2243,7 +2243,6 @@ static int bgp_update_receive(struct peer_connection *connection, /* Set initial values. */ memset(&attr, 0, sizeof(attr)); attr.label_index = BGP_INVALID_LABEL_INDEX; - attr.label = MPLS_INVALID_LABEL; memset(&nlris, 0, sizeof(nlris)); memset(peer->rcvd_attr_str, 0, BUFSIZ); peer->rcvd_attr_printed = 0; diff --git a/bgpd/bgp_route.c b/bgpd/bgp_route.c index e42ef6c29a1c..af12b0ca0742 100644 --- a/bgpd/bgp_route.c +++ b/bgpd/bgp_route.c @@ -10984,11 +10984,11 @@ void route_vty_out_detail(struct vty *vty, struct bgp *bgp, struct bgp_dest *bn, json_pmsi = json_object_new_object(); json_object_string_add(json_pmsi, "tunnelType", str); json_object_int_add(json_pmsi, "label", - label2vni(&attr->label)); + label2vni(&attr->label_tbl[0])); json_object_object_add(json_path, "pmsi", json_pmsi); } else vty_out(vty, " PMSI Tunnel Type: %s, label: %d\n", - str, label2vni(&attr->label)); + str, label2vni(&attr->label_tbl[0])); } if (path->peer->connection->t_gr_restart &&