-
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
Embiggen the goodness of maghemite #385
Conversation
rib_in key behavior before:
rib_in key behavior after:
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This seems fine to me, but can we add a test demonstrating the example you showed for removing the prefix from the rib?
Fixes: #369 Signed-off-by: Trey Aspelund <[email protected]>
Signed-off-by: Trey Aspelund <[email protected]>
Import/Export filters are meant to modify which advertised prefixes are allowed. For Import, this is simply an allow-list that accepts a subset of the advertised nlri in a received update. For Export, this is an allow-list that accepts a subset of the locally originated nlri. In neither case do you want to apply these filters to the list of withdrawn nlri, as this can result in stale routes if a legitimate withdrawal is not sent or received. Fixes: #330 Signed-off-by: Trey Aspelund <[email protected]>
Removes an unused function. Guards an illumos-specific import. Consolidates (bfd) nexthop enabled functions into one that takes a bool. Moves RIB locking and looping of prefixes and PrefixChangeNotifications into RIB removal helper functions to improve pcn batching and consolidate locations for future RIB batch work. Removes re-processing of BGP path attributes. Removes re-looping over routes/paths in a few places. Eliminates some return types when no callers handled Result. Adds some TODOs. Signed-off-by: Trey Aspelund <[email protected]>
334fbdb
to
eb07d9d
Compare
I added two more commits + rebased off main. The second commit adds the requested tests, plus additional unit testing for rdb::Db methods. The first commit is a refactor of various rdb::Db methods and their callers. Highlights below:
Other refactoring we might consider later:
edit: Addressed the logging helpers and updates to use lock!() in new commits |
Signed-off-by: Trey Aspelund <[email protected]>
eb07d9d
to
67b520a
Compare
c546a03
to
d3dd364
Compare
mgd/src/bgp_admin.rs was re-defining lock! identically to the one in mg-common. Remove this dupe definition and just import from mg-common. Signed-off-by: Trey Aspelund <[email protected]>
Replace all old instances of .lock().unwrap() with lock!() Signed-off-by: Trey Aspelund <[email protected]>
Signed-off-by: Trey Aspelund <[email protected]>
Signed-off-by: Trey Aspelund <[email protected]>
Actually run the same cargo clippy command as CI, so I can see errors locally :/ Signed-off-by: Trey Aspelund <[email protected]>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks Trey! Some great improvements here. Just a few comments.
Signed-off-by: Trey Aspelund <[email protected]>
Move over to using transaction semantics for static route db updates. Also change remove_static_routes to take a reference, aligning with add_static_routes. Signed-off-by: Trey Aspelund <[email protected]>
This addresses a few different items found in Maghemite.
remove_prefix_path() did not delete the prefix key from
rib_in
after the last path was removed.Fixes: Static route key retained despite deleting all paths #369
remove_prefix_path() was removing all paths for a prefix that happened to share a nexthop. This is bad because a single call to
static_remove_v4_route()
would delete all paths with that nexthop even when fields like rib_priority didn't match. This would likely also allow the deletion of a floating static route to inadvertently clobber a BGP route via the same next-hop.apply_update() and send_update() were incorrectly applying the relevant ImportExportPolicy to the list of withdrawn routes. Filtering route withdrawals causes stale routing information, as we can end up ignoring a legitimate withdrawal from a peer or we could forget to inform a peer that we're no longer originating a route (e.g. if we first set an export policy matching N routes in an announce-set, then removed a route from that announce-set). In either case, this is incorrect behavior that can lead to forwarding issues.
Fixes: When Export Policy is configured, withdrawn NLRI can only ever contain routes allowed by Export Policy #330