bgpd: reset ipv6 invalid link-local nexthop

If the "nexthop-local unchanged" setting is enabled, it preserves the
IPv6 link-local nexthop from the originating peer. However, if the
originating and destination peers are not on the same network segment,
the originating peer's IPv6 link-local address will be unreachable from
the destination peer.

In such cases, reset the IPv6 link-local nexthop, even if "nexthop-local
unchanged" is set on the destination peer.

Signed-off-by: Louis Scalbert <louis.scalbert@6wind.com>
This commit is contained in:
Louis Scalbert 2024-10-09 17:08:44 +02:00
parent 34c1dd076e
commit 5bb99ccad2

View file

@ -2492,8 +2492,11 @@ bool subgroup_announce_check(struct bgp_dest *dest, struct bgp_path_info *pi,
* ensure more prefixes share the same attribute for
* announcement.
*/
if (!(CHECK_FLAG(peer->af_flags[afi][safi],
PEER_FLAG_NEXTHOP_LOCAL_UNCHANGED)))
if (!(CHECK_FLAG(peer->af_flags[afi][safi], PEER_FLAG_NEXTHOP_LOCAL_UNCHANGED)) ||
!IPV6_ADDR_SAME(&peer->nexthop.v6_global, &from->nexthop.v6_global))
/* Reset if "nexthop-local unchanged" is not set or originating and destination peer
* does not share the same subnet.
*/
memset(&attr->mp_nexthop_local, 0, IPV6_MAX_BYTELEN);
}