Repository navigation
v1.60.0: multiport-one-option (error) - #84
Merged
Merged
Conversation
One -m multiport takes one port list. --dports + --sports (or --ports, or a repeat) in the same match is refused - "multiport: option "--source-ports" cannot be used together with "--destination-ports"" - and the table loads nothing. The trap is the singular: after -m multiport, --sport/--dport are read as multiport's --sports/--dports unless a loaded tcp/udp match owns the exact name (-m tcp, or an earlier option multiport does not know, like --syn). A -m comment in between changes nothing. Measured with iptables-restore on 34 variants (iptables 1.8.11, nf_tables and legacy agree on all); the detector replays the option binding and agrees with the kernel on all 34. New sample iptables-multiport-two-lists.txt (rc 2, 0 rules, policies left ACCEPT). 73 smells, tests 377. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
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.
New linter smell
multiport-one-option(error): one-m multiportmatch takes one port list (--dports,--sportsor--ports). A second one in the same match is refused and, like the rest of the won't-load family, the table loads nothing and itsDROPpolicies never apply.The trap: the singular
After
-m multiport,--sport/--dportare not the tcp match's options. getopt reads them as abbreviations of multiport's--sports/--dports, so the classic client lineis refused with
multiport: option "--source-ports" cannot be used together with "--destination-ports". Options bind to whichever loaded match knows them, not by position: a-m comment/-m conntrackin between changes nothing, while an exact name in a loaded tcp/udp match wins (loaded by-m tcp, or by an earlier option multiport does not know:--syn,--tcp-flags, a--dportahead of the multiport). A second-m multiporttakes the options after it.Measured
iptables-restore(iptables 1.8.11, nf_tables and legacy, debian:13 with NET_ADMIN) on 34 variants; the two backends agree on every one. The detector replays that option binding and was checked mechanically against those 34 results: 34/34 agree, 13 refused with the multiport error (flagged), 19 that load (not flagged), and 2 refused for a different reason (a tcp/udp option given twice: not claimed).New sample
iptables-multiport-two-lists.txt(button iptables (--dports + --sport in one multiport — won't load)), measured as written: rc 2 on both backends, 0 rules, policies left at ACCEPT; without the web line, 6 rules load (the DNS line with-m udploaded first is fine).Tests
src/linter.jsfrom main, the 4 positive tests and the 2 guards (README list, every smell exercised by a sample) fail.🤖 Generated with Claude Code