iptables: detect and validate nf_tables mode for all zero rules#43415
Merged
YutaroHayakawa merged 1 commit intocilium:mainfrom Jan 14, 2026
Merged
Conversation
1630952 to
173c317
Compare
Contributor
Author
|
/test |
Member
|
I've tentatively shifted this to |
if we have ipv4NativeRoutingCIDR: 0.0.0.0/0 configured though helm, agent may have following complain level=error msg="iptables rules full reconciliation failed, will retry another one later" error="failed to install rules: cannot install masquerade rules: unable to run 'iptables -t nat -A CILIUM_POST_nat ! -d 0.0.0.0/0 -s 10.0.2.0/24 ! -o cilium_+ -m comment --comment cilium masquerade non-cluster -j MASQUERADE' iptables command: exit status 4 stderr=\"iptables v1.8.8 (nf_tables): RULE_APPEND failed (Invalid argument): rule in chain CILIUM_POST_nat\\n\"" subsys=iptables That's because nf_tables doesn't allow 0.0.0.0/0 but iptable legacy and our bpf masquerade can support it. Here is the test from my laptop root@kind-worker3:/# iptables -t nat -A POSTROUTING ! -d 0.0.0.0/0 -o eth0 -j MASQUERADE iptables v1.8.9 (nf_tables): RULE_APPEND failed (Invalid argument): rule in chain POSTROUTING root@kind-worker3:/# iptables-legacy -t nat -A POSTROUTING ! -d 0.0.0.0/0 -o eth0 -j MASQUERADE root@kind-worker3:/# iptables-legacy-save *nat :PREROUTING ACCEPT [0:0] :INPUT ACCEPT [0:0] :OUTPUT ACCEPT [10:592] :POSTROUTING ACCEPT [10:592] -A POSTROUTING ! -d 0.0.0.0/0 -o eth0 -j MASQUERADE This PR will detect the iptable mode and tell users to use enable-ipv4-masquerade or enable-ipv6-masquerade: false in nft mode Signed-off-by: Liyi Huang <liyi.huang@isovalent.com>
173c317 to
4bb7575
Compare
Contributor
Author
|
/test |
YutaroHayakawa
approved these changes
Jan 14, 2026
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.
see commit message