-
Notifications
You must be signed in to change notification settings - Fork 753
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
rule: fix parsing zero priority rule #962
Conversation
24401a1
to
37131be
Compare
@@ -222,6 +222,26 @@ func runRuleListFiltered(t *testing.T, family int, srcNet, dstNet *net.IPNet) { | |||
return rs, false | |||
}, | |||
}, | |||
{ | |||
name: "returns one rule filtered by Priority(0) and Table", | |||
ruleFilter: &Rule{Priority: 0, Table: 1}, |
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.
In my opinion, we should also test the situation where the rule priority is not specified by us when we program the kernel. That happens when we client uses the NewRule() method, and Priority is set to -1.
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.
Updated tests to add rule with priority unset, which results into rule creation with priority preceding main table (32766).
Thanks. Please squash your two commits into one. |
Squashed commits into one, thanks! |
LGTM |
Fixes #709 (see issue for repro)
This happens as the rule with priority=0 don't contain
nl.FRA_PRIORITY
attribute, which leaves the priority in the struct as -1 which was set byNewRule
.Wrote a test which fails before the fix: