summaryrefslogtreecommitdiffstats
path: root/scripts
diff options
context:
space:
mode:
authorChen Qi <Qi.Chen@windriver.com>2013-08-28 02:52:03 (GMT)
committerRichard Purdie <richard.purdie@linuxfoundation.org>2013-08-30 15:23:47 (GMT)
commitb2a0e3ad91ddc0d62592a59cf0367be1349170d0 (patch)
treea4d19508593b89bae41e41489fa5c2857f9e1577 /scripts
parent5bffc4ff4dde35d2ceb21242c1372113406369ff (diff)
downloadpoky-b2a0e3ad91ddc0d62592a59cf0367be1349170d0.tar.gz
runqemu-ifdown: clean up the remaining iptables rules
The iptables rules for the tap interface are added by runqemu-ifup everytime we use runqemu to start a qemu target. But it's not cleaned up when runqemu exits. This patch cleans up the remaining iptables rules for the tap interface in runqemu-ifdown. [YOCTO #5047] (From OE-Core rev: ef38a0aed35357d035ca587162158cd2f55b958f) Signed-off-by: Chen Qi <Qi.Chen@windriver.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'scripts')
-rwxr-xr-xscripts/runqemu-ifdown14
1 files changed, 14 insertions, 0 deletions
diff --git a/scripts/runqemu-ifdown b/scripts/runqemu-ifdown
index 8b8c5a4..8f66cfa 100755
--- a/scripts/runqemu-ifdown
+++ b/scripts/runqemu-ifdown
@@ -50,3 +50,17 @@ if [ ! -e "$TUNCTL" ]; then
50fi 50fi
51 51
52$TUNCTL -d $TAP 52$TUNCTL -d $TAP
53
54# cleanup the remaining iptables rules
55IPTABLES=`which iptables 2> /dev/null`
56if [ "x$IPTABLES" = "x" ]; then
57 IPTABLES=/sbin/iptables
58fi
59if [ ! -x "$IPTABLES" ]; then
60 echo "$IPTABLES cannot be executed"
61 exit 1
62fi
63n=$[ (`echo $TAP | sed 's/tap//'` * 2) + 1 ]
64dest=$[ (`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