Skip to content

Commit

Permalink
bgpd: reset ipv6 invalid link-local nexthop
Browse files Browse the repository at this point in the history
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 <[email protected]>
  • Loading branch information
louis-6wind committed Oct 10, 2024
1 parent 34c1dd0 commit 5bb99cc
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions bgpd/bgp_route.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}

Expand Down

0 comments on commit 5bb99cc

Please sign in to comment.