Merge pull request #25 from dpw/24_iptables_w

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

Fixes #24
This commit is contained in:
rade committed 2014-09-05 14:33:29 +01:00
commit 550aa3045d
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
}