fix: handle default routes in brutalctl - #39
Open
morecola wants to merge 1 commit into
Open
Conversation
Handle 0.0.0.0/0 and ::/0 without resolving the prefix address through `ip route get`. Update the existing default route in place so attributes such as gateway, device, metric and onlink are preserved, and make del/flush remove only the Brutal congestion-control setting instead of deleting the default route.
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.
fix: handle default routes in brutalctl
Summary
Fix
brutalctlhandling of0.0.0.0/0and::/0rules.The kernel rule can be created successfully for a default prefix while the route that selects
brutalfails to install, leavingbrutalctl listwithROUTE=no,MEMBERS=0, and no traffic using the rule.Root cause
For IPv4,
route_lookup()strips the prefix and runsip -4 route get 0.0.0.0. On systems where this resolves to the local route,brutalctltreats the destination as local and never installs a route-levelcongctl brutalsetting.For default routes, reconstructing a route from only
viaanddevis also insufficient. Attributes such asonlinkandmetriccan be required, especially on VPS IPv6 configurations.Default routes also need different delete semantics: deleting a
/0Brutal rule must not delete the system default route itself.Changes
ip route.congctl brutalsetting for default routes.brutalctl listdetectbrutaldirectly on the default route.delandflushpreserve the underlying default route.Reproduction before the fix
The IPv6 default rule similarly failed on a route requiring
onlink.Verification
Tested against upstream
mastercommit377d2a0e9324ef585ff90ea91779baf276cf6a50on:Default route shapes used for the test:
Build check:
Regression checks passed for both IPv4 and IPv6:
add 0.0.0.0/0/add ::/0results inROUTE=yes.metric,onlink, and other attributes.delremovescongctl brutalbut leaves the default route intact.congctl lock brutal.brutal, and rule membership / sent-byte counters increased during traffic.