diff --git a/bgpd/bgp_evpn.c b/bgpd/bgp_evpn.c index 915c914ae87c..08934288b3ca 100644 --- a/bgpd/bgp_evpn.c +++ b/bgpd/bgp_evpn.c @@ -4689,11 +4689,14 @@ static int process_type2_route(struct peer *peer, afi_t afi, safi_t safi, } /* Process the route. */ - if (attr) + if (attr) { + attr->num_labels = num_labels; + attr->label_tbl[0] = label[0]; + bgp_set_valid_label(&attr->label_tbl[0]); bgp_update(peer, (struct prefix *)&p, addpath_id, attr, afi, safi, ZEBRA_ROUTE_BGP, BGP_ROUTE_NORMAL, &prd, - &label[0], num_labels, 0, &evpn); - else + 0, &evpn); + } else bgp_withdraw(peer, (struct prefix *)&p, addpath_id, afi, safi, ZEBRA_ROUTE_BGP, BGP_ROUTE_NORMAL, &prd, &label[0], num_labels, &evpn); @@ -4782,8 +4785,8 @@ static int process_type3_route(struct peer *peer, afi_t afi, safi_t safi, /* Process the route. */ if (attr) bgp_update(peer, (struct prefix *)&p, addpath_id, attr, afi, - safi, ZEBRA_ROUTE_BGP, BGP_ROUTE_NORMAL, &prd, NULL, - 0, 0, NULL); + safi, ZEBRA_ROUTE_BGP, BGP_ROUTE_NORMAL, &prd, + 0, NULL); else bgp_withdraw(peer, (struct prefix *)&p, addpath_id, afi, safi, ZEBRA_ROUTE_BGP, BGP_ROUTE_NORMAL, &prd, NULL, 0, @@ -4914,11 +4917,14 @@ static int process_type5_route(struct peer *peer, afi_t afi, safi_t safi, } /* Process the route. */ - if (attr && is_valid_update) + if (attr && is_valid_update) { + attr->num_labels = 1; + attr->label_tbl[0] = label; + bgp_set_valid_label(&attr->label_tbl[0]); bgp_update(peer, (struct prefix *)&p, addpath_id, attr, afi, safi, ZEBRA_ROUTE_BGP, BGP_ROUTE_NORMAL, &prd, - &label, 1, 0, &evpn); - else { + 0, &evpn); + } else { if (!is_valid_update) { char attr_str[BUFSIZ] = {0}; diff --git a/bgpd/bgp_evpn_mh.c b/bgpd/bgp_evpn_mh.c index 4122a635ed74..4bc81d100ec9 100644 --- a/bgpd/bgp_evpn_mh.c +++ b/bgpd/bgp_evpn_mh.c @@ -756,8 +756,8 @@ int bgp_evpn_type4_route_process(struct peer *peer, afi_t afi, safi_t safi, /* Process the route. */ if (attr) { bgp_update(peer, (struct prefix *)&p, addpath_id, attr, afi, - safi, ZEBRA_ROUTE_BGP, BGP_ROUTE_NORMAL, &prd, NULL, - 0, 0, NULL); + safi, ZEBRA_ROUTE_BGP, BGP_ROUTE_NORMAL, &prd, + 0, NULL); } else { bgp_withdraw(peer, (struct prefix *)&p, addpath_id, afi, safi, ZEBRA_ROUTE_BGP, BGP_ROUTE_NORMAL, &prd, NULL, 0, @@ -1225,8 +1225,8 @@ int bgp_evpn_type1_route_process(struct peer *peer, afi_t afi, safi_t safi, /* Process the route. */ if (attr) { bgp_update(peer, (struct prefix *)&p, addpath_id, attr, afi, - safi, ZEBRA_ROUTE_BGP, BGP_ROUTE_NORMAL, &prd, NULL, - 0, 0, NULL); + safi, ZEBRA_ROUTE_BGP, BGP_ROUTE_NORMAL, &prd, + 0, NULL); } else { bgp_withdraw(peer, (struct prefix *)&p, addpath_id, afi, safi, ZEBRA_ROUTE_BGP, BGP_ROUTE_NORMAL, &prd, NULL, 0, diff --git a/bgpd/bgp_flowspec.c b/bgpd/bgp_flowspec.c index 6165bf892e72..b170108fe7ea 100644 --- a/bgpd/bgp_flowspec.c +++ b/bgpd/bgp_flowspec.c @@ -192,7 +192,7 @@ int bgp_nlri_parse_flowspec(struct peer *peer, struct attr *attr, if (!withdraw) { bgp_update(peer, &p, 0, attr, afi, safi, ZEBRA_ROUTE_BGP, BGP_ROUTE_NORMAL, NULL, - NULL, 0, 0, NULL); + 0, NULL); } else { bgp_withdraw(peer, &p, 0, afi, safi, ZEBRA_ROUTE_BGP, BGP_ROUTE_NORMAL, NULL, NULL, 0, NULL); diff --git a/bgpd/bgp_label.c b/bgpd/bgp_label.c index e8ce99ac07be..39065cf5c226 100644 --- a/bgpd/bgp_label.c +++ b/bgpd/bgp_label.c @@ -449,9 +449,12 @@ int bgp_nlri_parse_label(struct peer *peer, struct attr *attr, } if (attr) { + attr->num_labels = 1; + attr->label_tbl[0] = label; + bgp_set_valid_label(&attr->label_tbl[0]); bgp_update(peer, &p, addpath_id, attr, packet->afi, safi, ZEBRA_ROUTE_BGP, BGP_ROUTE_NORMAL, - NULL, &label, 1, 0, NULL); + NULL, 0, NULL); } else { bgp_withdraw(peer, &p, addpath_id, packet->afi, SAFI_UNICAST, ZEBRA_ROUTE_BGP, diff --git a/bgpd/bgp_mac.c b/bgpd/bgp_mac.c index 5de58feadc08..df56ff4f07cf 100644 --- a/bgpd/bgp_mac.c +++ b/bgpd/bgp_mac.c @@ -140,8 +140,6 @@ static void bgp_process_mac_rescan_table(struct bgp *bgp, struct peer *peer, const struct prefix *p = bgp_dest_get_prefix(dest); struct prefix_evpn *pevpn = (struct prefix_evpn *)dest; struct prefix_rd prd; - uint32_t num_labels = 0; - mpls_label_t *label_pnt = NULL; struct bgp_route_evpn *evpn; if (pevpn->family == AF_EVPN @@ -169,10 +167,6 @@ static void bgp_process_mac_rescan_table(struct bgp *bgp, struct peer *peer, && !dest_affected) continue; - num_labels = pi->attr->num_labels; - if (num_labels) - label_pnt = &pi->attr->label_tbl[0]; - prd.family = AF_UNSPEC; prd.prefixlen = 64; memcpy(&prd.val, pdest_p->u.val, 8); @@ -183,7 +177,7 @@ static void bgp_process_mac_rescan_table(struct bgp *bgp, struct peer *peer, bgp_debug_rdpfxpath2str( AFI_L2VPN, SAFI_EVPN, &prd, - p, label_pnt, num_labels, + p, &pi->attr->label_tbl[0], pi->attr->num_labels, pi->addpath_rx_id ? 1 : 0, pi->addpath_rx_id, NULL, pfx_buf, sizeof(pfx_buf)); @@ -198,8 +192,8 @@ static void bgp_process_mac_rescan_table(struct bgp *bgp, struct peer *peer, sizeof(evpn)); bgp_update(peer, p, pi->addpath_rx_id, pi->attr, AFI_L2VPN, SAFI_EVPN, ZEBRA_ROUTE_BGP, - BGP_ROUTE_NORMAL, &prd, label_pnt, - num_labels, 1, evpn); + BGP_ROUTE_NORMAL, &prd, + 1, evpn); } } } diff --git a/bgpd/bgp_mplsvpn.c b/bgpd/bgp_mplsvpn.c index ea2ddaebbf90..b1f151919673 100644 --- a/bgpd/bgp_mplsvpn.c +++ b/bgpd/bgp_mplsvpn.c @@ -239,9 +239,12 @@ int bgp_nlri_parse_vpn(struct peer *peer, struct attr *attr, STREAM_GET(p.u.val, data, psize - VPN_PREFIXLEN_MIN_BYTES); if (attr) { + attr->num_labels = 1; + attr->label_tbl[0] = label; + bgp_set_valid_label(&attr->label_tbl[0]); bgp_update(peer, &p, addpath_id, attr, packet->afi, SAFI_MPLS_VPN, ZEBRA_ROUTE_BGP, - BGP_ROUTE_NORMAL, &prd, &label, 1, 0, NULL); + BGP_ROUTE_NORMAL, &prd, 0, NULL); } else { bgp_withdraw(peer, &p, addpath_id, packet->afi, SAFI_MPLS_VPN, ZEBRA_ROUTE_BGP, diff --git a/bgpd/bgp_route.c b/bgpd/bgp_route.c index 8a8de0c01daf..310a37d793a0 100644 --- a/bgpd/bgp_route.c +++ b/bgpd/bgp_route.c @@ -4165,8 +4165,8 @@ static bool bgp_accept_own(struct peer *peer, afi_t afi, safi_t safi, void bgp_update(struct peer *peer, const struct prefix *p, uint32_t addpath_id, struct attr *attr, afi_t afi, safi_t safi, int type, - int sub_type, struct prefix_rd *prd, mpls_label_t *label, - uint32_t num_labels, int soft_reconfig, + int sub_type, struct prefix_rd *prd, + int soft_reconfig, struct bgp_route_evpn *evpn) { int ret; @@ -5286,18 +5286,12 @@ static void bgp_soft_reconfig_table_update(struct peer *peer, safi_t safi, struct prefix_rd *prd) { struct bgp_path_info *pi; - uint32_t num_labels = 0; - mpls_label_t *label_pnt = NULL; struct bgp_route_evpn evpn; for (pi = bgp_dest_get_bgp_path_info(dest); pi; pi = pi->next) if (pi->peer == peer) break; - if (pi) - num_labels = pi->attr->num_labels; - if (num_labels) - label_pnt = &pi->attr->label_tbl[0]; if (pi) memcpy(&evpn, bgp_attr_get_evpn_overlay(pi->attr), sizeof(evpn)); @@ -5306,7 +5300,7 @@ static void bgp_soft_reconfig_table_update(struct peer *peer, bgp_update(peer, bgp_dest_get_prefix(dest), ain->addpath_rx_id, ain->attr, afi, safi, ZEBRA_ROUTE_BGP, BGP_ROUTE_NORMAL, prd, - label_pnt, num_labels, 1, &evpn); + 1, &evpn); } static void bgp_soft_reconfig_table(struct peer *peer, afi_t afi, safi_t safi, @@ -6217,7 +6211,7 @@ int bgp_nlri_parse_ip(struct peer *peer, struct attr *attr, if (attr) bgp_update(peer, &p, addpath_id, attr, afi, safi, ZEBRA_ROUTE_BGP, BGP_ROUTE_NORMAL, NULL, - NULL, 0, 0, NULL); + 0, NULL); else bgp_withdraw(peer, &p, addpath_id, afi, safi, ZEBRA_ROUTE_BGP, BGP_ROUTE_NORMAL, NULL, diff --git a/bgpd/bgp_route.h b/bgpd/bgp_route.h index dd1edddc98f1..16d72e74f14f 100644 --- a/bgpd/bgp_route.h +++ b/bgpd/bgp_route.h @@ -779,8 +779,8 @@ extern int bgp_static_set(struct vty *vty, bool negate, const char *ip_str, extern void bgp_update(struct peer *peer, const struct prefix *p, uint32_t addpath_id, struct attr *attr, afi_t afi, safi_t safi, int type, int sub_type, - struct prefix_rd *prd, mpls_label_t *label, - uint32_t num_labels, int soft_reconfig, + struct prefix_rd *prd, + int soft_reconfig, struct bgp_route_evpn *evpn); extern void bgp_withdraw(struct peer *peer, const struct prefix *p, uint32_t addpath_id, afi_t afi, safi_t safi, int type, diff --git a/bgpd/bgp_rpki.c b/bgpd/bgp_rpki.c index 6585be7e8246..c31347e67723 100644 --- a/bgpd/bgp_rpki.c +++ b/bgpd/bgp_rpki.c @@ -655,21 +655,11 @@ static void revalidate_bgp_node(struct bgp_dest *bgp_dest, afi_t afi, { struct bgp_adj_in *ain; - for (ain = bgp_dest->adj_in; ain; ain = ain->next) { - struct bgp_path_info *path = - bgp_dest_get_bgp_path_info(bgp_dest); - mpls_label_t *label = NULL; - uint32_t num_labels = 0; - - if (path) { - label = path->attr->label_tbl; - num_labels = path->attr->num_labels; - } + for (ain = bgp_dest->adj_in; ain; ain = ain->next) (void)bgp_update(ain->peer, bgp_dest_get_prefix(bgp_dest), ain->addpath_rx_id, ain->attr, afi, safi, - ZEBRA_ROUTE_BGP, BGP_ROUTE_NORMAL, NULL, label, - num_labels, 1, NULL); - } + ZEBRA_ROUTE_BGP, BGP_ROUTE_NORMAL, NULL, + 1, NULL); } /* diff --git a/bgpd/rfapi/vnc_export_bgp.c b/bgpd/rfapi/vnc_export_bgp.c index 7decb75782dc..efad8ac6d81d 100644 --- a/bgpd/rfapi/vnc_export_bgp.c +++ b/bgpd/rfapi/vnc_export_bgp.c @@ -307,7 +307,6 @@ void vnc_direct_bgp_add_route_ce(struct bgp *bgp, struct agg_node *rn, iattr, /* bgp_update copies this attr */ afi, SAFI_UNICAST, ZEBRA_ROUTE_VNC_DIRECT, BGP_ROUTE_REDISTRIBUTE, NULL, /* RD not used for unicast */ - NULL, 0, /* tag not used for unicast */ 0, NULL); /* EVPN not used */ bgp_attr_unintern(&iattr); } @@ -1033,9 +1032,7 @@ void vnc_direct_bgp_add_nve(struct bgp *bgp, struct rfapi_descriptor *rfd) ZEBRA_ROUTE_VNC_DIRECT, BGP_ROUTE_REDISTRIBUTE, NULL, /* RD not used for unicast */ - NULL, - /* tag not used for unicast */ - 0, 0, NULL); /* EVPN not used */ + 0, NULL); /* EVPN not used */ bgp_attr_unintern(&iattr); } @@ -1246,8 +1243,7 @@ static void vnc_direct_add_rn_group_rd(struct bgp *bgp, iattr, /* bgp_update copies it */ afi, SAFI_UNICAST, ZEBRA_ROUTE_VNC_DIRECT, BGP_ROUTE_REDISTRIBUTE, NULL, /* RD not used for unicast */ - NULL, /* tag not used for unicast */ - 0, 0, NULL); /* EVPN not used */ + 0, NULL); /* EVPN not used */ bgp_attr_unintern(&iattr); @@ -1699,8 +1695,7 @@ void vnc_direct_bgp_rh_add_route(struct bgp *bgp, afi_t afi, iattr, /* bgp_update copies this attr */ afi, SAFI_UNICAST, ZEBRA_ROUTE_VNC_DIRECT_RH, BGP_ROUTE_REDISTRIBUTE, NULL, /* RD not used for unicast */ - NULL, /* tag not used for unicast, EVPN neither */ - 0, 0, NULL); /* EVPN not used */ + 0, NULL); /* EVPN not used */ bgp_attr_unintern(&iattr); } @@ -1937,10 +1932,7 @@ void vnc_direct_bgp_rh_vpn_enable(struct bgp *bgp, afi_t afi) ZEBRA_ROUTE_VNC_DIRECT_RH, BGP_ROUTE_REDISTRIBUTE, NULL, /* RD not used for unicast */ - NULL, - /* tag not used for unicast, - or EVPN */ - 0, 0, NULL); /* EVPN not used */ + 0, NULL); /* EVPN not used */ bgp_attr_unintern(&iattr); }