Skip to contentSkip to conversation

iptables: considers incomplete rule in -C and finds an erroneous match

DISCUSSION Roman Mamedov 2 participants 3 messages Feb 4, 2024 – Feb 6, 2024 netfilter

lore
Share & tools
lore
#0 lore raw

Hello,

According to my ip6tables, a rule like this already exists:

  # ip6tables -C INPUT -p tcp -m multiport --dports 80,443 -j ACCEPT && echo Exists
  Exists

Except that it doesn't, and an extra IP filter is present:

  # ip6tables-save | grep 80,443
  -A INPUT -s fd39::/16 -p tcp -m multiport --dports 80,443 -j ACCEPT

Is that the expected behaviour?

ip6tables v1.8.9 (legacy)

Thanks

Signature · 2 lines
With respect,
Roman
#1 lore raw
Quoted 2 lines · On Mon, 5 Feb 2024 04:45:19 +0500 Roman Mamedov <[email protected]> wrote:
  # ip6tables-save | grep 80,443
  -A INPUT -s fd39::/16 -p tcp -m multiport --dports 80,443 -j ACCEPT

Actually the 2nd rule doesn't matter at all, it just returns success (rule exists) on anything.

  # ip6tables -C INPUT -p udp --dport 12345 -j ACCEPT && echo Exists
  Exists
  # ip6tables-save | grep 12345
  #
Signature · 2 lines
With respect,
Roman
reviewer
#2 lore raw
In reply to Roman Mamedov

Hi,

Quoted 7 lines · Roman Mamedov

Hello,

According to my ip6tables, a rule like this already exists:

  # ip6tables -C INPUT -p tcp -m multiport --dports 80,443 -j ACCEPT && echo Exists
  Exists
Quoted 8 lines

Except that it doesn't, and an extra IP filter is present:

  # ip6tables-save | grep 80,443
  -A INPUT -s fd39::/16 -p tcp -m multiport --dports 80,443 -j ACCEPT

Is that the expected behaviour?

ip6tables v1.8.9 (legacy)

This is already fixed in v1.8.10 by commit 78850e7dba64a ("ip6tables:
Fix checking existence of rule").

Cheers, Phil