Repository navigation
Routed network ACL: match protocol-number rules with ip protocol, not ip nexthdr - #14352
Open
bhouse-nexthop wants to merge 3 commits into
Open
bhouse-nexthop wants to merge 3 commits into
bhouse-nexthop wants to merge 3 commits into
Conversation
In routed mode the VR renders IPv4 ACL rules as nftables, and a rule for a protocol number (e.g. 47, GRE) came out as "ip nexthdr 47". nexthdr is an IPv6 header field; nft rejects it in an ip rule with a syntax error, which is only logged, so the rule was silently missing from ip4_acl. Use the IPv4 field, "ip protocol". The IPv6 path's "ip6 nexthdr" is correct and unchanged. Fixes: apache#14351 Signed-off-by: Brad House <bhouse@nexthop.ai>
bhouse-nexthop
requested review from
DaanHoogland,
sureshanaparti,
vladimirpetrov and
weizhouapache
October 8, 2026 00:49
Collaborator
Author
|
@vladimirpetrov @sureshanaparti could you take a look at this one? We'd like this fix to make it into the upcoming 4.22.2 release. |
Codecov Report✅ All modified and coverable lines are covered by tests.
Additional details and impacted files@@ Coverage Diff @@
## 4.22 #14352 +/- ##
=============================================
- Coverage 18.02% 4.04% -13.99%
=============================================
Files 5936 449 -5487
Lines 535823 38240 -497583
Branches 65612 7082 -58530
=============================================
- Hits 96582 1546 -95036
+ Misses 428242 36482 -391760
+ Partials 10999 212 -10787
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
Signed-off-by: Brad House <bhouse@nexthop.ai>
Check only that the IPv4 match does not reach the IPv6 rule. Signed-off-by: Brad House <bhouse@nexthop.ai>
This branch has not been deployed
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.
Description
On a network in routed mode, a network ACL rule that uses a protocol number (e.g.
47for GRE) is never applied on the VR.Fixes #14351
Why it breaks
In routed mode the VR renders IPv4 ACL rules as nftables, in
CsAcl.AclDevice.__process_routing_ip4(). A protocol-number rule was rendered asip nexthdr 47.nexthdris an IPv6 header field, so nft rejects it in aniprule:The rules are added one
nft add ruleat a time, and the failure is only logged:/var/log/cloud.logrecords that the command exited with status 1, while nft's error message goes to stderr. So the rule is silently missing fromip4_aclwhile the rest of the list loads:This was introduced with routed mode in #9470 (4.20).
How it is fixed
The IPv4 match now uses the IPv4 field,
ip protocol <n>. The IPv6 path in__process_ip6()is not touched by this change.How to reproduce the old behaviour
47, CIDR1.2.3.4/32, action Allow. Add a TCP 22 rule from the same CIDR for contrast.nft list chain ip ip4_acl ethX_ingress_policy.Before (the GRE rule is missing;
/var/log/cloud.loghasCommand 'nft add rule ... ip nexthdr 47 accept' returned non-zero exit status 1):After:
Types of changes
Feature/Enhancement Scale or Bug Severity
Bug Severity
How Has This Been Tested?
systemvm/test/TestCsAclRouting.pychecks the rendered IPv4 rule in both directions (ip saddringress,ip daddregress), and that the IPv4 match does not reach the IPv6 rule. It fails on the current4.22code and passes with this change. (Nothing in.github/workflowsrunssystemvm/test, so it runs viasystemvm/test/runtests.sh.)AclDevicegenerates through the unmodifiedCsNetfilters.apply_nft_ipv4_rules()into real nft (1.0.9) in a network namespace.ip protocol 47was also checked on nft 1.0.6, the version in the Debian 12 systemvm template.pycodestyleandpylint(as inruntests.sh) report nothing new.How did you try to break this feature and the system with this change?
type == "protocol"rules go through this line. tcp, udp, icmp and all rules render exactly as before.