Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

bgpd: fix updating ipv6 global nexthop #17152

Draft
wants to merge 8 commits into
base: master
Choose a base branch
from

Conversation

louis-6wind
Copy link
Contributor

bgpd keeps on advertising IPv6 prefixes with a IPv6 link-local nexthop
after a valid IPv6 global appears.

At bgpd startup, the IPv6 global is announced by zebra after the
link-local. Only the link-local is advertised. Clearing the BGP sessions
make the global to to be announced.

Update the nexthops with the global IPv6 when available.

@louis-6wind
Copy link
Contributor Author

@leonshaw. Here is the fix for the unsent global nexthop that was mentionned here #17073 (comment)

Please open an issue or publish a fix for the similar issue with link-local nexthop

@leonshaw
Copy link
Contributor

@leonshaw. Here is the fix for the unsent global nexthop that was mentionned here #17073 (comment)

Please open an issue or publish a fix for the similar issue with link-local nexthop

Link-local address is complicated as it affects the number of next-hops. I'd like to have a general discussion on this (#17128) before seeking a fix.

bgpd/bgp_zebra.c Outdated
for (ALL_LIST_ELEMENTS(bgp->peer, node, nnode, peer)) {
v6_ll_in_nh_global = false;

if (IN6_IS_ADDR_LINKLOCAL(&peer->nexthop.v6_global)) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If the address is removed and re-added, peer->nexthop.v6_global may have been zeroed in bgp_interface_address_delete(). Can we also handle this case?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fixed

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have also fixed the bgp_interface_address_delete() for global

bgpd/bgp_zebra.c Outdated
if (connected->address->family != AF_INET6)
continue;
if (!IPV6_ADDR_SAME(&connected->address->u.prefix6,
&peer->nexthop.v6_global))
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Different interfaces may have identical link-local address. How about comparing interface name with peer->nexthop.ifp->name?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fixed. I now compare nexthop.ifp and ifc->ifp

Move common checks outside of the loop.

Signed-off-by: Louis Scalbert <[email protected]>
Reduce bgp_interface_address_add indentation

Signed-off-by: Louis Scalbert <[email protected]>
Log new IPv6 global address in bgp_interface_address_add

Signed-off-by: Louis Scalbert <[email protected]>
bgpd keeps on advertising IPv6 prefixes with a IPv6 link-local nexthop
or a IPv4-mapped IPv6 after a valid IPv6 global appears.

For example, at bgpd startup, the IPv6 global is announced by zebra
after the link-local. Only the link-local is advertised. Clearing the
BGP sessions make the global to to be announced.

Update the nexthops with the global IPv6 when available. Do not override
any previous global address that is still valid.

Signed-off-by: Louis Scalbert <[email protected]>
Add bgp_nexthop_mp_ipv4_6 topotest to test to nexhop value with
MP-BGP IPv4 and IPv6 on IPv4 peering. The test has route-reflector,
route-server, iBGP and eBGP peers.

Signed-off-by: Louis Scalbert <[email protected]>
Move common checks outside of the loop.

Signed-off-by: Louis Scalbert <[email protected]>
When the IPv6 global is removed on an interface towards a peer, the
IPv6 nexthop global is reset. It should be another global or a
link-local.

At removal, replace the global by the next global address or the
link-local as last resort.

Signed-off-by: Louis Scalbert <[email protected]>
Check that we can set back the ipv6 global nexthop.

Signed-off-by: Louis Scalbert <[email protected]>
@frrbot frrbot bot added the tests Topotests, make check, etc label Oct 18, 2024
@louis-6wind louis-6wind changed the title bgpd: fix sending ipv6 local nexthop if global present bgpd: fix updating ipv6 global nexthop Oct 18, 2024
@leonshaw
Copy link
Contributor

Looks good to me. But seems a test case is failing... I'm not sure whether the next-hop should be IPv4-mapped or link-local in the absence of global address.

@louis-6wind louis-6wind marked this pull request as draft October 22, 2024 07:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants