I've been using a bash shell script to set complex iptables
rules for years. However, on Debian Stretch
when I tried to use a script, it became sluggish and left iptables in a bad state.
When I tried to do an iptables -L -v
it came back with an error...
Another app is currently holding the xtables lock; still -9s 0us time ahead to have a chance to grab the lock...
Google'ing led me to this bug which suggests using the "-w" switch. The man page doesn't really clear up how this switch might affect the issue.
My script uses a loop for admin convenience, which causes it to make a lot of calls to iptables.
# This actually sets the allowed incoming iptables lines
setincoming() {
for port in ${2}; do
for ip in ${1}; do
if [ `echo "$ip" | grep -P "(^|\s)[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}(/[0-9]*)*(\s*)$"` ]; then
iptables -I INPUT -p tcp -s $ip --dport $port -m state --state NEW,ESTABLISHED,RELATED -j ACCEPT
else
ip6tables -I INPUT -p tcp -s $ip --dport $port -m state --state NEW,ESTABLISHED,RELATED -j ACCEPT
fi
done
done
}
#####
# APIs
setincoming "123.123.123.10 123.123.123.11 fe80::xxxx:xxx:xxxx:xxxx" "4200 4300"
Can anyone help me understand how "-w" is used to fix this issue?
EDIT:
For clarification I did, of course, look at the man page - and tried using the switches -w
and combined as -w -W1
but this had no effect on the issue (neither fixed it nor changed the symptoms).
SO, I'm still at a loss as to how to resolve.