Skip to content

v1.60.0: multiport-one-option (error) - #84

Merged
DannyRuizB merged 1 commit into
mainfrom
multiport-one-option
Oct 23, 2026
Merged

DannyRuizB merged 1 commit into
mainfrom
multiport-one-option

Conversation

@DannyRuizB

Copy link
Copy Markdown
Owner

New linter smell multiport-one-option (error): one -m multiport match takes one port list (--dports, --sports or --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 its DROP policies never apply.

The trap: the singular

After -m multiport, --sport / --dport are not the tcp match's options. getopt reads them as abbreviations of multiport's --sports / --dports, so the classic client line

-A OUTPUT -p tcp -m multiport --dports 80,443 --sport 1024:65535 -j ACCEPT

is 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 conntrack in 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 --dport ahead of the multiport). A second -m multiport takes 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 udp loaded first is fine).

Tests

  • 5 new tests (both messages, the swallowed singular, a match in between, 11 lines that load and must stay quiet, ip6tables, nft never judged); 372 → 377, eslint clean.
  • Negative control: with src/linter.js from main, the 4 positive tests and the 2 guards (README list, every smell exercised by a sample) fail.
  • README: release line 72 → 73 smells (the guard checks it), roadmap entry v1.60.0. package.json 1.60.0.

🤖 Generated with Claude Code

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>
@DannyRuizB
DannyRuizB merged commit 03c6524 into main Oct 23, 2026
1 check passed
@DannyRuizB
DannyRuizB deleted the multiport-one-option branch October 23, 2026 06:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant