-
Notifications
You must be signed in to change notification settings - Fork 903
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
Introduce a messageHandler object for bgp #329
Conversation
The messageHandler will be used for ipv6 support while leaving the existing and working ipv4 code untouched.
All addresses are assumed to be /128
This PR is updated with support for update messages for announce/withdraw for ipv6. The speaker is now functional for ipv6 but with a limitation; all addresses are assumed to be /128. I.e. no ranges are announced. This is the normal case for load-balancer addresses I think but needs to be addresses anyway in the future. Testing is done manually on xcluster. The failed CI tests does not seem related to this PR. |
I've looked at the code, and I have one problem: it segments BGP sessions into "ipv4 or ipv6", but the BGP protocol itself allows any combination of {ipv4, ipv6} announcements over {ipv4, ipv6} BGP sessions, based on the advertised capabilities of the peer. So, instead of segmenting this codebase into one message handler for v4 and one for v6, I would prefer if we track the capabilities the peer sent us, and when we're sending update messages filter based on which address families the peer wants. This would reduce a bunch of code duplication (the messages are the same except for one enum value and some field lengths), and support more types of BGP deployments. This is especially important because k8s is finally working on dual-stack support, so some day we might have completely hybrid environments at the IP layer, and we want the BGP speaker to handle it. WDYT? |
You are right. I thought of it but when I alter somebody elses code I try very hard to leave the existing (presumably working) code as intact as I possibly can. I'll try a more itrusive approach. To be able to use the same code for ipv4 and ipv6 the current ipv4 implementation must be altered to use bgp-mp. I have not an array of 3pp routers to test against (same as yourself I think) so I am a bit worried to mess things up. |
Here is my new plan;
Then it is possible to keep the current implementation while developing support for bgp-mp. Maybe a bit cowardly... |
The non-mp (ipv4 only) bgp implementation is kept and is default.
Here is a trace (narrowed
The peer router is |
To enable bgb-mp in the manifest specify;
This is a temporary solution for testing the bgp-mp function. |
The mask when using bgp-mp is hardcoded to /128 for ipv6 and /32 for ipv4. |
Is there anything I can do to improve this PR? The failing tests does not seem related. I make local ipv6 tests for basic function and externalTrafficPolicy:Local (does not work due to kubernetes/kubernetes#71596). The received OPEN message is not checked for AFI-ipv6. Do you think it should? |
Sorry, this change is fairly complex, and I simply no longer have enough time to review this kind of change :(. I do still want to make IPv6 work at some point, but right now for my own sanity I need to close this PR because realistically, I'm never going to get to it. I'm very sorry for the effort you wasted. I wish I could spend more time and energy on MetalLB, but it's simply no longer possible for me :( |
Ipv6 support for the metallb speaker NYI, see; metallb/metallb#329
The messageHandler will be used for ipv6 support while leaving
the existing and working ipv4 code untouched.
What this PR does / why we need it:
This PR addresses a code separation problem when support for ipv6 in the speaker is introduced. The message handling should be handled by an object
messageHandler
rather than a set of functions. A ipv6 messageHandler can be introduced while leaving ipv4 code as-is.The current ipv4 code for bgp must not be altered when support for ipv6 is introduced. This would cause maintenance problems and likely bugs.
Which issue(s) this PR fixes
This is yet another step on the way for #7
Special notes for your reviewer:
The PR is not complete and contains only updates for the setup and the
sendUpdate
function. The intention with this PR is to propose a way of adding ipv6 support in a non-intrusive way and come to an agreement about how to add ipv6 support.In the existing
messages.go
only object variables are added in front of selected (every?) function. The rest of the code is not altered.A skeleton
messages-ipv6.go
is added to show the concept. It return ok (nil) to prevent re-start of the session while developing. For ipv6 it is stable but not working. Themessages-ipv6.go
will later contain the ipv6 support for bgp.If the proposed approach is acceptable this PR can be merged as-is, or it can be filled with more code to be more complete.