summaryrefslogtreecommitdiffstats
path: root/scripts/runqemu-ifup
diff options
context:
space:
mode:
authorRichard Purdie <richard.purdie@linuxfoundation.org>2023-06-15 17:59:06 +0100
committerRichard Purdie <richard.purdie@linuxfoundation.org>2023-06-16 15:40:11 +0100
commit609fc157180778025b2f416736839a7935217731 (patch)
tree493497d19c1d82190bcf39a18c7dfe8031f60d0e /scripts/runqemu-ifup
parent3ee077f991e7810bf515783058be940a4b8f6adc (diff)
downloadpoky-609fc157180778025b2f416736839a7935217731.tar.gz
runqemu/qemu-helper: Drop tunctl
ip tuntap provides the functionality that we obtained from tunctl. We only needed tunctl when ifconfig was more available than ip. That isn't the case now so we can drop tunctl and all the hoops we need to jump through to build and provide it. (From OE-Core rev: 2abfbca690ff00cb58ce08a65cde006578ee3de9) Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'scripts/runqemu-ifup')
-rwxr-xr-xscripts/runqemu-ifup26
1 files changed, 3 insertions, 23 deletions
diff --git a/scripts/runqemu-ifup b/scripts/runqemu-ifup
index 5fdcddeeda..237bf2a07b 100755
--- a/scripts/runqemu-ifup
+++ b/scripts/runqemu-ifup
@@ -1,10 +1,7 @@
1#!/bin/bash 1#!/bin/bash
2# 2#
3# QEMU network interface configuration script. This utility needs to 3# QEMU network interface configuration script. This utility needs to
4# be run as root, and will use the tunctl binary from a native sysroot. 4# be run as root, and will use the ip utility
5# Note: many Linux distros these days still use an older version of
6# tunctl which does not support the group permissions option, hence
7# the need to use build system's version.
8# 5#
9# If you find yourself calling this script a lot, you can add the 6# If you find yourself calling this script a lot, you can add the
10# the following to your /etc/sudoers file to be able to run this 7# the following to your /etc/sudoers file to be able to run this
@@ -39,7 +36,6 @@ fi
39 36
40USERID="-u $1" 37USERID="-u $1"
41GROUP="-g $2" 38GROUP="-g $2"
42STAGING_BINDIR_NATIVE=$3
43 39
44if taps=$(ip tuntap list 2>/dev/null); then 40if taps=$(ip tuntap list 2>/dev/null); then
45 tap_no=$(( $(echo "$taps" |sort -r |sed 's/^tap//; s/:.*//; q') + 1 )) 41 tap_no=$(( $(echo "$taps" |sort -r |sed 's/^tap//; s/:.*//; q') + 1 ))
@@ -47,24 +43,8 @@ if taps=$(ip tuntap list 2>/dev/null); then
47fi 43fi
48 44
49if [ -z $TAP ]; then 45if [ -z $TAP ]; then
50 TUNCTL=$STAGING_BINDIR_NATIVE/tunctl 46 echo "Error: Unable to find a tap device to use"
51 if [ ! -x "$TUNCTL" ]; then 47 exit 1
52 echo "Error: Unable to find tunctl binary in '$STAGING_BINDIR_NATIVE', please bitbake qemu-helper-native"
53 exit 1
54 fi
55
56 TAP=`$TUNCTL -b $GROUP 2>&1`
57 STATUS=$?
58 if [ $STATUS -ne 0 ]; then
59 # If tunctl -g fails, try using tunctl -u, for older host kernels
60 # which do not support the TUNSETGROUP ioctl
61 TAP=`$TUNCTL -b $USERID 2>&1`
62 STATUS=$?
63 if [ $STATUS -ne 0 ]; then
64 echo "tunctl failed:"
65 exit 1
66 fi
67 fi
68fi 48fi
69 49
70IFCONFIG=`which ip 2> /dev/null` 50IFCONFIG=`which ip 2> /dev/null`