From: Matthias Hanft <mh@hanft.de>
To: gentoo-user@lists.gentoo.org
Subject: Re: [gentoo-user] Strange behaviour of iptables
Date: Fri, 3 Jan 2025 11:30:54 +0100 [thread overview]
Message-ID: <666afc76-2625-ece1-719f-e377446e3b33@hanft.de> (raw)
In-Reply-To: <87ldvtef19.fsf@gmail.com>
Alexis wrote:
>
>
> So what happens if you instead do:
>
> ```
> exec("/usr/bin/xtables-legacy-multi iptables-legacy -L COUNT -n -v
> -x -w", $iptables);
> ```
>
> ?
Just the same:
iptables v1.8.11 (legacy): Illegal option `--numeric' with this command
Try `iptables -h' or 'iptables --help' for more information.
If I omit "-n", I get the message "Illegal option `--exact' with this command",
and if I omit "-n" and "-x", it seems to work, but without "-x" I get "2M" bytes
(instead of 2048000 bytes) which is hard to calculate with.
Anyway, I omitted one parameter after another, and the problem seems
to be "-Z" when I want to clear the counters - and it has nothing to do
with PHP; I had overlooked that the monthly PHP cronjob clears the
counters (of course), while an interactive COUNT does not.
So after some tests (without PHP, just from bash) I get the following:
/sbin/iptables -L COUNT -n -v -x -w
does work, while
/sbin/iptables -L -Z COUNT -n -v -x -w
does *not*.
"man iptables" says for the "-L" option:
"It is legal to specify the -Z (zero) option as well, in which case the
chain(s) will be atomically listed and zeroed." (which is what I want and
worked for years).
Just "iptables -Z COUNT" does work, but obviously not in combination with
"-n" and "-x" (which I need for "-L").
I could run "-L -x -n" and "-Z" one after another, but that would not be
atomic any more (which wouldn't be fatal in my case, though).
Could it be an iptables bug since last update? Should I file a bug report?
-Matt
next prev parent reply other threads:[~2025-01-03 10:32 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-01-01 17:33 [gentoo-user] Strange behaviour of iptables Matthias Hanft
2025-01-02 4:34 ` Matt Connell
2025-01-02 8:13 ` Matthias Hanft
2025-01-02 9:33 ` Alexis
2025-01-03 10:30 ` Matthias Hanft [this message]
2025-01-02 19:25 ` Matt Connell
2025-01-02 23:00 ` Ro Bra
2025-01-02 23:03 ` Ro Bra
2025-01-03 1:15 ` Matt Connell
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=666afc76-2625-ece1-719f-e377446e3b33@hanft.de \
--to=mh@hanft.de \
--cc=gentoo-user@lists.gentoo.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox