Patchwork [2/4] runqemu-internal: don't bring down preconfigured tap interface

login
register
mail settings
Submitter Qi.Chen@windriver.com
Date Aug. 27, 2013, 7:08 a.m.
Message ID <55b4bd6190564b24e99a5e2969ba86db07ca95f7.1377587203.git.Qi.Chen@windriver.com>
Download mbox | patch
Permalink /patch/56689/
State Accepted
Commit f60f215f74b5fe5a43943c9d3ccdbe0fa06b7828
Headers show

Comments

Qi.Chen@windriver.com - Aug. 27, 2013, 7:08 a.m.
From: Chen Qi <Qi.Chen@windriver.com>

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.

Signed-off-by: Chen Qi <Qi.Chen@windriver.com>
---
 scripts/runqemu-internal |    4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

Patch

diff --git a/scripts/runqemu-internal b/scripts/runqemu-internal
index 8a6e551..8165e13 100755
--- a/scripts/runqemu-internal
+++ b/scripts/runqemu-internal
@@ -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