Skip to contentSkip to conversation

Bug: iptables -L and -Z at the same time now refuses other options

DISCUSSION Adam Nielsen 1 participant 1 message Apr 23, 2025 netfilter

lore
Share & tools
lore
#0 lore raw

Hi all,

I don't have a Bugzilla account so would someone mind logging this bug for me?

I just updated iptables and now this command fails:

  $ iptables -L -v -n -x -Z
  iptables v1.8.11 (legacy): Illegal option `--numeric' with this command

The manpage says that it is valid to use -Z with -L, which displays the values before zeroing them. However the latest iptables release doesn't allow you to specify -n if you are including -Z, which means if you want to display AND zero the counters at the same time, you can't have the raw numeric values shown.

It works fine if you omit -Z but then you end up losing precision, having to run two commands (one to show the counters and then another one to zero them, with any change in the counters occurring between the two commands lost).

If you remove the -n option, it then also complains about -x:

  $ iptables -L -v -x -Z
  iptables v1.8.11 (legacy): Illegal option `--exact' with this command

This used to work so hopefully it's a small bug that can be easily fixed. It looks like while -L and -Z are still permitted at the same time, most of the options for -L are now being incorrectly refused if -Z is also specified.

Many thanks,
Adam.

(Not subscribed, please CC)