Fix iptables rendering for combined icmp/icmpv6 protocols - #369
Draft
rootkiller6788 wants to merge 1 commit into
Draft
Fix iptables rendering for combined icmp/icmpv6 protocols#369rootkiller6788 wants to merge 1 commit into
rootkiller6788 wants to merge 1 commit into
Conversation
The iptables generator dropped a term whenever its protocol list contained any protocol that did not match the term's address family, so a term with `protocol:: icmp icmpv6` rendered no rules for either inet or inet6. Filter the protocol list down to the matching address family instead, and skip the term only when no protocols remain.
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.
Fixes #303.
The iptables generator skipped a term whenever any single protocol in its list did not match the term's address family:
For a term such as
protocol:: icmp icmpv6this means the whole term is dropped for both address families, producing no iptables rules at all (while the packetfilter generator handles the same policy correctly).This change filters the protocol list to the matching address family instead, returning early only when no protocols remain. With the fix, an
inetfilter renders-p icmpand aninet6filter renders-p ipv6-icmpfor the same term.Testing
testIcmpAndIcmpv6ProtocolandtestIcmpAndIcmpv6ProtocolInet6totests/lib/iptables_test.py.python -m pytest tests/lib/iptables_test.pypasses (61 passed;testExpiringTermfails independently of this change due to a local-vs-UTC date mismatch).