From c4a82636282c059a32ff9b19396c547c46cbf82b Mon Sep 17 00:00:00 2001 From: Louis Scalbert Date: Fri, 11 Oct 2024 06:59:16 +0200 Subject: [PATCH] bgpd, tests: don't send local nexthop from rr client AS 65000 | AS 65001 | RR | | | R1 --- | --- R2 | When r1 peer is an iBGP route reflector client of rr and r2 peer is a eBGP neighbor of rr, and all three routers shares the same network, r2 receives announcements coming from r1 with a IPv6 link-local nexthop from rr. This is incorrect as r2 should send traffic to r1 without involving rr. Do not send an IPv6 link-local nexthop if the originating peer is a route-reflector client. Link: https://github.com/FRRouting/frr/pull/16219#issuecomment-2397425505 Link: https://github.com/FRRouting/frr/pull/17037#discussion_r1792529683 Signed-off-by: Louis Scalbert --- bgpd/bgp_route.c | 1 + .../r4/show_bgp_ipv6_step2.json | 48 +++---------------- .../r5/show_bgp_ipv6_step2.json | 48 +++---------------- 3 files changed, 13 insertions(+), 84 deletions(-) diff --git a/bgpd/bgp_route.c b/bgpd/bgp_route.c index d69c263196..5fd058b6b5 100644 --- a/bgpd/bgp_route.c +++ b/bgpd/bgp_route.c @@ -2472,6 +2472,7 @@ bool subgroup_announce_check(struct bgp_dest *dest, struct bgp_path_info *pi, if (IN6_IS_ADDR_LINKLOCAL(&attr->mp_nexthop_local)) global_and_ll = true; } else if (!ibgp_to_ibgp && !transparent && + !CHECK_FLAG(from->af_flags[afi][safi], PEER_FLAG_REFLECTOR_CLIENT) && IN6_IS_ADDR_LINKLOCAL(&peer->nexthop.v6_local) && peer->shared_network && (from == bgp->peer_self || peer->sort == BGP_PEER_EBGP)) global_and_ll = true; diff --git a/tests/topotests/bgp_nexthop_ipv6/r4/show_bgp_ipv6_step2.json b/tests/topotests/bgp_nexthop_ipv6/r4/show_bgp_ipv6_step2.json index 35a31e63f9..5506f07f29 100644 --- a/tests/topotests/bgp_nexthop_ipv6/r4/show_bgp_ipv6_step2.json +++ b/tests/topotests/bgp_nexthop_ipv6/r4/show_bgp_ipv6_step2.json @@ -9,13 +9,7 @@ "ip": "fd00:0:2::1", "hostname": "rr", "afi": "ipv6", - "scope": "global" - }, - { - "ip": "link-local:rr:eth-sw", - "hostname": "rr", - "afi": "ipv6", - "scope": "link-local", + "scope": "global", "used": true } ] @@ -28,13 +22,7 @@ "ip": "fd00:0:2::2", "hostname": "rr", "afi": "ipv6", - "scope": "global" - }, - { - "ip": "link-local:rr:eth-sw", - "hostname": "rr", - "afi": "ipv6", - "scope": "link-local", + "scope": "global", "used": true } ] @@ -47,13 +35,7 @@ "ip": "fd00:0:2::3", "hostname": "rr", "afi": "ipv6", - "scope": "global" - }, - { - "ip": "link-local:rr:eth-sw", - "hostname": "rr", - "afi": "ipv6", - "scope": "link-local", + "scope": "global", "used": true } ] @@ -117,13 +99,7 @@ "ip": "fd00:0:2::1", "hostname": "rr", "afi": "ipv6", - "scope": "global" - }, - { - "ip": "link-local:rr:eth-sw", - "hostname": "rr", - "afi": "ipv6", - "scope": "link-local", + "scope": "global", "used": true } ] @@ -136,13 +112,7 @@ "ip": "fd00:0:2::2", "hostname": "rr", "afi": "ipv6", - "scope": "global" - }, - { - "ip": "link-local:rr:eth-sw", - "hostname": "rr", - "afi": "ipv6", - "scope": "link-local", + "scope": "global", "used": true } ] @@ -155,13 +125,7 @@ "ip": "fd00:0:2::3", "hostname": "rr", "afi": "ipv6", - "scope": "global" - }, - { - "ip": "link-local:rr:eth-sw", - "hostname": "rr", - "afi": "ipv6", - "scope": "link-local", + "scope": "global", "used": true } ] diff --git a/tests/topotests/bgp_nexthop_ipv6/r5/show_bgp_ipv6_step2.json b/tests/topotests/bgp_nexthop_ipv6/r5/show_bgp_ipv6_step2.json index d0875474ae..afcf7c3ffc 100644 --- a/tests/topotests/bgp_nexthop_ipv6/r5/show_bgp_ipv6_step2.json +++ b/tests/topotests/bgp_nexthop_ipv6/r5/show_bgp_ipv6_step2.json @@ -9,13 +9,7 @@ "ip": "fd00:0:3::9", "hostname": "rr", "afi": "ipv6", - "scope": "global" - }, - { - "ip": "link-local:rr:eth-r5", - "hostname": "rr", - "afi": "ipv6", - "scope": "link-local", + "scope": "global", "used": true } ] @@ -28,13 +22,7 @@ "ip": "fd00:0:3::9", "hostname": "rr", "afi": "ipv6", - "scope": "global" - }, - { - "ip": "link-local:rr:eth-r5", - "hostname": "rr", - "afi": "ipv6", - "scope": "link-local", + "scope": "global", "used": true } ] @@ -47,13 +35,7 @@ "ip": "fd00:0:3::9", "hostname": "rr", "afi": "ipv6", - "scope": "global" - }, - { - "ip": "link-local:rr:eth-r5", - "hostname": "rr", - "afi": "ipv6", - "scope": "link-local", + "scope": "global", "used": true } ] @@ -117,13 +99,7 @@ "ip": "fd00:0:3::9", "hostname": "rr", "afi": "ipv6", - "scope": "global" - }, - { - "ip": "link-local:rr:eth-r5", - "hostname": "rr", - "afi": "ipv6", - "scope": "link-local", + "scope": "global", "used": true } ] @@ -136,13 +112,7 @@ "ip": "fd00:0:3::9", "hostname": "rr", "afi": "ipv6", - "scope": "global" - }, - { - "ip": "link-local:rr:eth-r5", - "hostname": "rr", - "afi": "ipv6", - "scope": "link-local", + "scope": "global", "used": true } ] @@ -155,13 +125,7 @@ "ip": "fd00:0:3::9", "hostname": "rr", "afi": "ipv6", - "scope": "global" - }, - { - "ip": "link-local:rr:eth-r5", - "hostname": "rr", - "afi": "ipv6", - "scope": "link-local", + "scope": "global", "used": true } ]