-
Notifications
You must be signed in to change notification settings - Fork 2
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
Stop using Router-ID to distinguish between BGP sessions #398
base: main
Are you sure you want to change the base?
Conversation
35e9257
to
8e5d38f
Compare
8735a28
to
8e5d38f
Compare
I'd be interested in some feedback on whether or not it would be worth destructuring the Option wrapping the local sockaddr.
I'm not sure if this is a reasonable approach or if there's a more idiomatic way to do this. I'm just not sure if there's a better way to handle this, or if leaving it as an Option makes the most sense. |
This could make sense. In what situations do we expect the |
It looks like local_addr() is the top of a bunch of layers wrapping libc So if the illumos man page is to be trusted on this:
It seems like the only time we'd realistically expect this to fail for reasons within our control is if we call local_addr() for an invalid fd/socket... which I'd guess would only happen if the connect() call fails or if the socket gets closed out from under us? From the API handler side, mgd checks whether or not there's a valid
It looks like the only time mgd calls into the kernel to query the local sockaddr is during Update generation -- to figure out what next-hop to set on routes we originate. I don't imagine we need to do this more than once (store the local sockaddr after a successful |
BGP-ID is insufficient to distinguish between BGP sessions, as it's perfectly valid/reasonable to have multiple sessions to the same peer. Or an operator can (incorrectly or otherwise) assign the same BGP-ID to multiple routers. This ensures that Session-A to Peer-A going down does not impact Session-B to Peer-A. Fixes: #241 Signed-off-by: Trey Aspelund <trey@oxidecomputer.com>
Signed-off-by: Trey Aspelund <trey@oxidecomputer.com>
Add test case to simulate multiple BGP sessions to same peer Also refactor rdb's test_rib() to be a bit more clean and clear. Signed-off-by: Trey Aspelund <trey@oxidecomputer.com>
Switch from SocketAddrPair to IpAddr for distinguishing between BGP sessions. A BGP peer is identified by the IP we are connecting to, and multiple TCP sessions via the same IP isn't something we're looking to support. So instead of trying to handle all the cases where the local SocketAddr may or may not be available, simplify things by using the configured peer IP which will always be present regardless of the peer's FSM State. Signed-off-by: Trey Aspelund <trey@oxidecomputer.com>
774c5e6
to
6f41d48
Compare
@rcgoodfellow apparently I just needed a week or so to let the thoughts percolate, but I think you were right about using the peer IP as the distinguisher... The biggest benefit I see to this is that the IP a stateless object (it's either configured/present or it's not) so we won't have to think about socket state changing. No error handling if we can't query the socket state from the kernel. No changes to the hash input, possibly leaving us unable to cleanup entries inserted with the old socket state (mainly the ephemeral port). I've updated the code to use an IpAddr instead of a SocketAddrPair, which I think has simplified things quite a bit. Another review over the latest changes would be appreciated. |
move rdb over to using mg_common logging functions, rather than its own re-implementation. Also add a .gitignore for *.log so nextest doesn't pollute the repo. Signed-off-by: Trey Aspelund <trey@oxidecomputer.com>
6f41d48
to
da93056
Compare
One other comment I'll leave regarding the session discriminator: if we ever decide to support peering to the same address multiple times (e.g. via explicit ipv6 link-local addresses), this will likely need to be updated again to include a "scope" in addition to the peer address |
BGP-ID is insufficient to distinguish between BGP sessions, as it's perfectly valid/reasonable to have multiple sessions to the same peer. Or an operator can (incorrectly or otherwise) assign the same BGP-ID to multiple routers.
This ensures that Session-A to Peer-A going down does not impact Session-B to Peer-A.
Fixes: #241