Open
Conversation
The unnumbered manager needs bidirectional lookup between scope_id and interface name. The prod code used a single HashMap with O(n) reverse scans; the mock maintained two manually synchronized HashMaps. Replace both with a ScopeMap newtype wrapping iddqd::BiHashMap.
Updates Router.sessions to be a new SessionMap which wraps an IdOrdMap, allowing us to use the SessionRunner's PeerId as a HashMap key. This ensures the map keys are borrowed from the values, so it's impossible to insert a SessionRunner into the map using a key that isn't derived from itself, i.e. you can't insert a SessionRunner behind the wrong PeerId.
The peer_to_session map was very similar to the SessionMap in its uses. It mapped a PeerId to a SessionEndpoint, which was just a lightweight wrapper for a SessionRunner's event_tx (FSM event sender) and config (SessionInfo) used by the dispatcher during lookups for incoming TCP connections. Since both event_tx and SessionInfo are info coming from SessionRunner, this can all be accessed using the existing SessionMap without needing to maintain two separate maps. This gets rid of the peer_to_session map in lieu of using the SessionMap.
Contributor
Author
|
I have this in a4x2 currently and BGP unnumbered peers have all come up, but nexus hasn't fully come online. I don't suspect the issues are related to these changes, but I will resume troubleshooting this tomorrow. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Updates some of the map data structures we use in mgd/bgp. In particular:
UnnumberedManagertrait impls over to usingiddqd::BiHashMapfor the interface name to scope id mapping. This ensures we only have to maintain a single map (instead of 2 like what was used by UnnumberedManagerMock) and that we get consistent O(1) lookups (instead of the O(n) lookups in the UnnumberedManagerNdp impl).Router.sessionsover to a new SessionMap type which wraps aniddqd::IdOrdMap, which ensures we can't ever insert a SessionRunner into a map behind an invalid PeerId key since it is derived from the SessionRunner being inserted. There was not a known issue with the existing impl, but this provides some more type safety to prevent anything bad from happening in the future.