diff options
author | Donald Sharp <sharpd@nvidia.com> | 2023-01-11 16:14:11 +0100 |
---|---|---|
committer | Donald Sharp <sharpd@nvidia.com> | 2023-01-13 14:13:52 +0100 |
commit | 2bb8b49ce13aee725fbce975eac1493890f8caff (patch) | |
tree | bd594621e7bd3e909684f6bd7f20f5d6ae1b4131 /bgpd/bgp_mplsvpn.c | |
parent | Merge pull request #12629 from opensourcerouting/fix/use_static_repo (diff) | |
download | frr-2bb8b49ce13aee725fbce975eac1493890f8caff.tar.xz frr-2bb8b49ce13aee725fbce975eac1493890f8caff.zip |
Revert "Merge pull request #11127 from louis-6wind/bgp-leak"
This reverts commit 16aa1809e7c8caad37e8edd4e5aaac4f344bc7d3, reversing
changes made to f616e716089b16d9a678846282a6ac5c55e31a56.
Diffstat (limited to 'bgpd/bgp_mplsvpn.c')
-rw-r--r-- | bgpd/bgp_mplsvpn.c | 83 |
1 files changed, 18 insertions, 65 deletions
diff --git a/bgpd/bgp_mplsvpn.c b/bgpd/bgp_mplsvpn.c index 9b86c9b4b..c92d678ef 100644 --- a/bgpd/bgp_mplsvpn.c +++ b/bgpd/bgp_mplsvpn.c @@ -1060,11 +1060,9 @@ static bool leak_update_nexthop_valid(struct bgp *to_bgp, struct bgp_dest *bn, { struct bgp_path_info *bpi_ultimate; struct bgp *bgp_nexthop; - struct bgp_table *table; bool nh_valid; bpi_ultimate = bgp_get_imported_bpi_ultimate(source_bpi); - table = bgp_dest_table(bpi_ultimate->net); if (bpi->extra && bpi->extra->bgp_orig) bgp_nexthop = bpi->extra->bgp_orig; @@ -1072,25 +1070,13 @@ static bool leak_update_nexthop_valid(struct bgp *to_bgp, struct bgp_dest *bn, bgp_nexthop = bgp_orig; /* - * No nexthop tracking for redistributed routes, - * for static (i.e. coming from the bgp network statement or for + * No nexthop tracking for redistributed routes or for * EVPN-imported routes that get leaked. */ if (bpi_ultimate->sub_type == BGP_ROUTE_REDISTRIBUTE || is_pi_family_evpn(bpi_ultimate)) nh_valid = 1; - else if (bpi_ultimate->type == ZEBRA_ROUTE_BGP && - bpi_ultimate->sub_type == BGP_ROUTE_STATIC && table && - (table->safi == SAFI_UNICAST || - table->safi == SAFI_LABELED_UNICAST)) { - /* Routes from network statement */ - if (CHECK_FLAG(bgp_nexthop->flags, BGP_FLAG_IMPORT_CHECK)) - nh_valid = bgp_find_or_add_nexthop( - to_bgp, bgp_nexthop, afi, safi, bpi_ultimate, - NULL, 0, p); - else - nh_valid = 1; - } else + else /* * TBD do we need to do anything about the * 'connected' parameter? @@ -1280,7 +1266,6 @@ leak_update(struct bgp *to_bgp, struct bgp_dest *bn, if (debug) zlog_debug("%s: ->%s: %pBD Found route, changed attr", __func__, to_bgp->name_pretty, bn); - UNSET_FLAG(bpi->attr->nh_flag, BGP_ATTR_NH_REFRESH); return bpi; } @@ -1879,31 +1864,11 @@ static bool vpn_leak_to_vrf_update_onevrf(struct bgp *to_bgp, /* to */ uint32_t num_labels = 0; int nexthop_self_flag = 1; struct bgp_path_info *bpi_ultimate = NULL; - struct bgp_path_info *bpi; int origin_local = 0; struct bgp *src_vrf; - struct interface *ifp; int debug = BGP_DEBUG(vpn, VPN_LEAK_TO_VRF); - /* - * For VRF-2-VRF route-leaking, - * the source will be the originating VRF. - * - * If ACCEPT_OWN mechanism is enabled, then we SHOULD(?) - * get the source VRF (BGP) by looking at the RD. - */ - struct bgp *src_bgp = bgp_lookup_by_rd(path_vpn, prd, afi); - - if (path_vpn->extra && path_vpn->extra->bgp_orig) - src_vrf = path_vpn->extra->bgp_orig; - else if (src_bgp) - src_vrf = src_bgp; - else - src_vrf = from_bgp; - - bn = bgp_afi_node_get(to_bgp->rib[afi][safi], afi, safi, p, NULL); - if (!vpn_leak_from_vpn_active(to_bgp, afi, &debugmsg)) { if (debug) zlog_debug("%s: skipping: %s", __func__, debugmsg); @@ -1963,18 +1928,6 @@ static bool vpn_leak_to_vrf_update_onevrf(struct bgp *to_bgp, /* to */ community_strip_accept_own(&static_attr); - for (bpi = bgp_dest_get_bgp_path_info(bn); bpi; bpi = bpi->next) { - if (bpi->extra && bpi->extra->parent == path_vpn) - break; - } - - if (bpi && - leak_update_nexthop_valid(to_bgp, bn, &static_attr, afi, safi, - path_vpn, bpi, src_vrf, p, debug)) - SET_FLAG(static_attr.nh_flag, BGP_ATTR_NH_VALID); - else - UNSET_FLAG(static_attr.nh_flag, BGP_ATTR_NH_VALID); - /* * Nexthop: stash and clear * @@ -2017,22 +1970,6 @@ static bool vpn_leak_to_vrf_update_onevrf(struct bgp *to_bgp, /* to */ break; } - if (static_attr.nexthop.s_addr == INADDR_ANY && - IN6_IS_ADDR_UNSPECIFIED(&static_attr.mp_nexthop_global)) { - ifp = if_get_vrf_loopback(src_vrf->vrf_id); - if (ifp) - static_attr.nh_ifindex = ifp->ifindex; - } else if (static_attr.nh_ifindex) - ifp = if_lookup_by_index(static_attr.nh_ifindex, - src_vrf->vrf_id); - else - ifp = NULL; - - if (ifp && if_is_operative(ifp)) - SET_FLAG(static_attr.nh_flag, BGP_ATTR_NH_IF_OPERSTATE); - else - UNSET_FLAG(static_attr.nh_flag, BGP_ATTR_NH_IF_OPERSTATE); - /* * route map handling */ @@ -2114,6 +2051,22 @@ static bool vpn_leak_to_vrf_update_onevrf(struct bgp *to_bgp, /* to */ zlog_debug("%s: pfx %pBD: num_labels %d", __func__, path_vpn->net, num_labels); + /* + * For VRF-2-VRF route-leaking, + * the source will be the originating VRF. + * + * If ACCEPT_OWN mechanism is enabled, then we SHOULD(?) + * get the source VRF (BGP) by looking at the RD. + */ + struct bgp *src_bgp = bgp_lookup_by_rd(path_vpn, prd, afi); + + if (path_vpn->extra && path_vpn->extra->bgp_orig) + src_vrf = path_vpn->extra->bgp_orig; + else if (src_bgp) + src_vrf = src_bgp; + else + src_vrf = from_bgp; + leak_update(to_bgp, bn, new_attr, afi, safi, path_vpn, pLabels, num_labels, src_vrf, &nexthop_orig, nexthop_self_flag, debug); |