remove WEAVE iptable chain on 'weave stop'
No point keeping it around. Also, simplify idempotence of masquerading setup. Follow-up to issue #48.
This commit is contained in:
1 parent
2f1359ae9f
commit
8297fef53d
1 file changed
+4
-5
+4
-5
@@ -80,17 +80,16 @@ add_nat_rule() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
setup_masquerading() {
|
setup_masquerading() {
|
||||||
if ! run_iptables -t nat -S WEAVE >/dev/null 2>&1
|
run_iptables -t nat -N WEAVE >/dev/null 2>&1 || true
|
||||||
then
|
add_nat_rule POSTROUTING -j WEAVE
|
||||||
run_iptables -t nat -N WEAVE
|
|
||||||
add_nat_rule POSTROUTING -j WEAVE
|
|
||||||
fi
|
|
||||||
add_nat_rule WEAVE -o $BRIDGE ! -s $1 -j MASQUERADE
|
add_nat_rule WEAVE -o $BRIDGE ! -s $1 -j MASQUERADE
|
||||||
add_nat_rule WEAVE -s $1 ! -o $BRIDGE -j MASQUERADE
|
add_nat_rule WEAVE -s $1 ! -o $BRIDGE -j MASQUERADE
|
||||||
}
|
}
|
||||||
|
|
||||||
stop_masquerading() {
|
stop_masquerading() {
|
||||||
run_iptables -t nat -F WEAVE >/dev/null 2>&1 || true
|
run_iptables -t nat -F WEAVE >/dev/null 2>&1 || true
|
||||||
|
run_iptables -t nat -D POSTROUTING -j WEAVE >/dev/null 2>&1 || true
|
||||||
|
run_iptables -t nat -X WEAVE >/dev/null 2>&1 || true
|
||||||
}
|
}
|
||||||
|
|
||||||
# the following borrows from https://github.com/jpetazzo/pipework
|
# the following borrows from https://github.com/jpetazzo/pipework
|
||||||
|
|||||||
Reference in new issue
Block a user