From 5f6a61f91fdbfa33df1b7112c961135156fbd894 Mon Sep 17 00:00:00 2001 From: Richard Cunningham <29760295+cunningr@users.noreply.github.com> Date: Wed, 12 Jun 2024 15:34:15 +0100 Subject: [PATCH] bgpd: Exclude case for remote prefix w/o link-local If we expand the truth (A || B) to "(A && B) || (A && !B) || (!A && B)" so that we can isolate the case (!A && B), we then add the additional check (C) to ensure that original route actually has a link-local hext-hop Signed-off-by: Richard Cunningham <29760295+cunningr@users.noreply.github.com> --- bgpd/bgp_route.c | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/bgpd/bgp_route.c b/bgpd/bgp_route.c index 3ff7dbc07041..7cc51331a514 100644 --- a/bgpd/bgp_route.c +++ b/bgpd/bgp_route.c @@ -2472,13 +2472,16 @@ bool subgroup_announce_check(struct bgp_dest *dest, struct bgp_path_info *pi, if (NEXTHOP_IS_V6) { attr->mp_nexthop_len = BGP_ATTR_NHLEN_IPV6_GLOBAL; if ((CHECK_FLAG(peer->af_flags[afi][safi], - PEER_FLAG_NEXTHOP_LOCAL_UNCHANGED) - && IN6_IS_ADDR_LINKLOCAL(&attr->mp_nexthop_local)) - || (!reflect && !transparent - && IN6_IS_ADDR_LINKLOCAL(&peer->nexthop.v6_local) - && peer->shared_network - && (from == bgp->peer_self - || peer->sort == BGP_PEER_EBGP))) { + PEER_FLAG_NEXTHOP_LOCAL_UNCHANGED) && + IN6_IS_ADDR_LINKLOCAL(&attr->mp_nexthop_local)) || + (!reflect && !transparent && + IN6_IS_ADDR_LINKLOCAL(&peer->nexthop.v6_local) && + peer->shared_network && + ((from == bgp->peer_self && peer->sort == BGP_PEER_EBGP) || + (from == bgp->peer_self && peer->sort != BGP_PEER_EBGP) || + (from != bgp->peer_self && + IN6_IS_ADDR_LINKLOCAL(&attr->mp_nexthop_local) && + peer->sort == BGP_PEER_EBGP)))) { if (safi == SAFI_MPLS_VPN) attr->mp_nexthop_len = BGP_ATTR_NHLEN_VPNV6_GLOBAL_AND_LL;