runqemu-internal: don't bring down preconfigured tap interface
authorChen Qi <Qi.Chen@windriver.com>
Wed, 28 Aug 2013 02:52:04 +0000 (10:52 +0800)
committerRichard Purdie <richard.purdie@linuxfoundation.org>
Fri, 30 Aug 2013 15:23:47 +0000 (16:23 +0100)
runqemu-ifup and runqemu-ifdown should be pairs. If we're using a
preconfigured tap interface, the runqemu-ifdown should not be invoked
to bring it down.

(From OE-Core rev: f60f215f74b5fe5a43943c9d3ccdbe0fa06b7828)

Signed-off-by: Chen Qi <Qi.Chen@windriver.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
scripts/runqemu-internal

index 8a6e551..8165e13 100755 (executable)
@@ -175,12 +175,14 @@ else
         POSSIBLE=`$IFCONFIG link | grep 'tap' | awk '{print $2}' | sed s/://`
         TAP=""
         LOCKFILE=""
+        USE_PRECONF_TAP="no"
         for tap in $POSSIBLE; do
             LOCKFILE="$LOCKDIR/$tap"
             echo "Acquiring lockfile for $tap..."
             acquire_lock $LOCKFILE
             if [ $? -eq 0 ]; then
                 TAP=$tap
+                USE_PRECONF_TAP="yes"
                 break
             fi
         done
@@ -215,7 +217,7 @@ else
         fi
 
         cleanup() {
-            if [ ! -e "$NOSUDO_FLAG" ]; then
+            if [ ! -e "$NOSUDO_FLAG" -a "$USE_PRECONF_TAP" = "no" ]; then
                 # Redirect stderr since we could see a LD_PRELOAD warning here if pseudo is loaded
                 # but inactive. This looks scary but is harmless
                 sudo $QEMUIFDOWN $TAP $OECORE_NATIVE_SYSROOT 2> /dev/null