[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: iptables -Z option



On 2/9/2021 11:18 PM, Will Mengarini wrote:
Your issue looks like this bug, but I don't know how to fix it:
<https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=947689>.

* Bonno Bloksma <b.bloksma@tio.nl> [21-02/09=Tue 15:52 +0000]:
For years I have had a firewall script the sets and/or resets my
firewall rules.  [It starts near] the top with some lines that have
been there for ever.  After upgrading to buster I got an error
executing this script and I cannot find out why.  Using the extra echo
lines I have been able to pinpoint the error to the iptables -Z line

[...]
IPTABLES=/usr/sbin/iptables
echo flush
# Flush all rules in all chains and then delete all chains
chains=`cat /proc/net/ip_tables_names 2>/dev/null`
for i in $chains; do $IPTABLES -t $i -F; done
for i in $chains; do $IPTABLES -t $i -X; done
echo counters
# Reset all counters for default chains
$IPTABLES -Z
echo "return traffic"
[...]

This will produce the following output.
flush
counters
iptables v1.8.2 (nf_tables):  RULE_REPLACE failed (Invalid argument): rule in chain INPUT
return traffic

Can anyone tell me why the re reset counter line fails

The backend is 'nftables' starting with Buster.

Maybe (1) could be of interest to you.


1)  https://wiki.debian.org/nftables#Reverting_to_legacy_xtables

--
John Doe


Reply to: