Check that 'iptables -w' is supported before using it

'-w' was only introduced in a recent version of iptables.  It means
"Wait for the xtables lock", so it seems reasonable to proceed without
it for older versions.
This commit is contained in:
David Wragg committed 2014-09-05 12:51:41 +01:00
1 parent fb2f0f7f23
commit 91268fa0ba
1 file changed
+9 -2
+9 -2
View File
@@ -49,9 +49,16 @@ create_bridge() {
}
add_nat_rule() {
if ! iptables -w -t nat -C $1 >/dev/null 2>&1
if [ -z "$CHECKED_IPTABLES_W" ] ; then
if iptables -S -w >/dev/null 2>&1 ; then
IPTABLES_W=-w
fi
CHECKED_IPTABLES_W=1
fi
if ! iptables $IPTABLES_W -t nat -C $1 >/dev/null 2>&1
then
iptables -w -t nat -A $1 >/dev/null
iptables $IPTABLES_W -t nat -A $1 >/dev/null
fi
}