diff options
Diffstat (limited to 'scripts')
-rwxr-xr-x | scripts/runqemu-ifdown | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/scripts/runqemu-ifdown b/scripts/runqemu-ifdown index 8b8c5a4a7a..8f66cfa2a9 100755 --- a/scripts/runqemu-ifdown +++ b/scripts/runqemu-ifdown | |||
@@ -50,3 +50,17 @@ if [ ! -e "$TUNCTL" ]; then | |||
50 | fi | 50 | fi |
51 | 51 | ||
52 | $TUNCTL -d $TAP | 52 | $TUNCTL -d $TAP |
53 | |||
54 | # cleanup the remaining iptables rules | ||
55 | IPTABLES=`which iptables 2> /dev/null` | ||
56 | if [ "x$IPTABLES" = "x" ]; then | ||
57 | IPTABLES=/sbin/iptables | ||
58 | fi | ||
59 | if [ ! -x "$IPTABLES" ]; then | ||
60 | echo "$IPTABLES cannot be executed" | ||
61 | exit 1 | ||
62 | fi | ||
63 | n=$[ (`echo $TAP | sed 's/tap//'` * 2) + 1 ] | ||
64 | dest=$[ (`echo $TAP | sed 's/tap//'` * 2) + 2 ] | ||
65 | $IPTABLES -D POSTROUTING -t nat -j MASQUERADE -s 192.168.7.$n/32 | ||
66 | $IPTABLES -D POSTROUTING -t nat -j MASQUERADE -s 192.168.7.$dest/32 | ||