summaryrefslogtreecommitdiffstats
path: root/scripts/runqemu-ifdown
diff options
context:
space:
mode:
authorJörg Sommer <joerg.sommer@navimatix.de>2023-06-09 10:51:06 +0200
committerRichard Purdie <richard.purdie@linuxfoundation.org>2023-06-13 22:10:29 +0100
commit424ede206baae1c228583aab1df6c18513ac104f (patch)
tree388f993787320288dc81575405a3a1aa207a5a5b /scripts/runqemu-ifdown
parent351577761d0712a005eda9dde9215558ca9a1fe9 (diff)
downloadopenembedded-core-contrib-424ede206baae1c228583aab1df6c18513ac104f.tar.gz
runqemu-ifupdown/get-tapdevs: Add support for ip tuntap
The *ip* command supports the creation and destruction of TAP devices since 2009 and might be more likely installed on systems then *tunctl*. Therefore it should be tried to setup or teardown the TAP interface with *ip* before falling back to *tunctl*. https://git.kernel.org/pub/scm/network/iproute2/iproute2.git/commit/?id=580fbd88f75cc9eea0d28a48c025b090eb9419a7 Signed-off-by: Jörg Sommer <joerg.sommer@navimatix.de> Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
Diffstat (limited to 'scripts/runqemu-ifdown')
-rwxr-xr-xscripts/runqemu-ifdown14
1 files changed, 8 insertions, 6 deletions
diff --git a/scripts/runqemu-ifdown b/scripts/runqemu-ifdown
index e0eb5344c6..f72166b32b 100755
--- a/scripts/runqemu-ifdown
+++ b/scripts/runqemu-ifdown
@@ -33,13 +33,15 @@ fi
TAP=$1
STAGING_BINDIR_NATIVE=$2
-TUNCTL=$STAGING_BINDIR_NATIVE/tunctl
-if [ ! -e "$TUNCTL" ]; then
- echo "Error: Unable to find tunctl binary in '$STAGING_BINDIR_NATIVE', please bitbake qemu-helper-native"
- exit 1
-fi
+if !ip tuntap del $TAP mode tap 2>/dev/null; then
+ TUNCTL=$STAGING_BINDIR_NATIVE/tunctl
+ if [ ! -e "$TUNCTL" ]; then
+ echo "Error: Unable to find tunctl binary in '$STAGING_BINDIR_NATIVE', please bitbake qemu-helper-native"
+ exit 1
+ fi
-$TUNCTL -d $TAP
+ $TUNCTL -d $TAP
+fi
IFCONFIG=`which ip 2> /dev/null`
if [ "x$IFCONFIG" = "x" ]; then