diff options
Diffstat (limited to 'scripts/runqemu-ifdown')
| -rwxr-xr-x | scripts/runqemu-ifdown | 20 |
1 files changed, 17 insertions, 3 deletions
diff --git a/scripts/runqemu-ifdown b/scripts/runqemu-ifdown index 710d2975c5..ffbc9de442 100755 --- a/scripts/runqemu-ifdown +++ b/scripts/runqemu-ifdown @@ -41,12 +41,26 @@ if [ $# -ne 2 ]; then fi TAP=$1 -NATIVE_SYSROOT_DIR=$2 +STAGING_BINDIR_NATIVE=$2 -TUNCTL=$NATIVE_SYSROOT_DIR/usr/bin/tunctl +TUNCTL=$STAGING_BINDIR_NATIVE/tunctl if [ ! -e "$TUNCTL" ]; then - echo "Error: Unable to find tunctl binary in '$NATIVE_SYSROOT_DIR/usr/bin'" + echo "Error: Unable to find tunctl binary in '$STAGING_BINDIR_NATIVE', please bitbake qemu-helper-native" exit 1 fi $TUNCTL -d $TAP + +# cleanup the remaining iptables rules +IPTABLES=`which iptables 2> /dev/null` +if [ "x$IPTABLES" = "x" ]; then + IPTABLES=/sbin/iptables +fi +if [ ! -x "$IPTABLES" ]; then + echo "$IPTABLES cannot be executed" + exit 1 +fi +n=$[ (`echo $TAP | sed 's/tap//'` * 2) + 1 ] +dest=$[ (`echo $TAP | sed 's/tap//'` * 2) + 2 ] +$IPTABLES -D POSTROUTING -t nat -j MASQUERADE -s 192.168.7.$n/32 +$IPTABLES -D POSTROUTING -t nat -j MASQUERADE -s 192.168.7.$dest/32 |
