diff options
author | Richard Purdie <richard.purdie@linuxfoundation.org> | 2023-06-15 17:59:06 +0100 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2023-06-16 15:40:11 +0100 |
commit | 609fc157180778025b2f416736839a7935217731 (patch) | |
tree | 493497d19c1d82190bcf39a18c7dfe8031f60d0e /scripts/runqemu-gen-tapdevs | |
parent | 3ee077f991e7810bf515783058be940a4b8f6adc (diff) | |
download | poky-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-gen-tapdevs')
-rwxr-xr-x | scripts/runqemu-gen-tapdevs | 26 |
1 files changed, 5 insertions, 21 deletions
diff --git a/scripts/runqemu-gen-tapdevs b/scripts/runqemu-gen-tapdevs index ffb82adce6..4f8ea979d2 100755 --- a/scripts/runqemu-gen-tapdevs +++ b/scripts/runqemu-gen-tapdevs | |||
@@ -1,11 +1,7 @@ | |||
1 | #!/bin/bash | 1 | #!/bin/bash |
2 | # | 2 | # |
3 | # Create a "bank" of tap network devices that can be used by the | 3 | # Create a "bank" of tap network devices that can be used by the |
4 | # runqemu script. This script needs to be run as root, and will | 4 | # runqemu script. This script needs to be run as root |
5 | # use the tunctl binary from the build system sysroot. Note: many Linux | ||
6 | # distros these days still use an older version of tunctl which does not | ||
7 | # support the group permissions option, hence the need to use the build | ||
8 | # system provided version. | ||
9 | # | 5 | # |
10 | # Copyright (C) 2010 Intel Corp. | 6 | # Copyright (C) 2010 Intel Corp. |
11 | # | 7 | # |
@@ -62,29 +58,17 @@ if [ ! -x "$RUNQEMU_IFUP" ]; then | |||
62 | exit 1 | 58 | exit 1 |
63 | fi | 59 | fi |
64 | 60 | ||
65 | TUNCTL=$STAGING_BINDIR_NATIVE/tunctl | ||
66 | ip_supports_tuntap=false | ||
67 | if interfaces=`ip tuntap list` 2>/dev/null; then | 61 | if interfaces=`ip tuntap list` 2>/dev/null; then |
68 | ip_supports_tuntap=true | ||
69 | interfaces=`echo "$interfaces |cut -f1 -d:` | 62 | interfaces=`echo "$interfaces |cut -f1 -d:` |
70 | elif [[ ! -x "$TUNCTL" || -d "$TUNCTL" ]]; then | ||
71 | echo "Error: $TUNCTL is not an executable" | ||
72 | usage | ||
73 | elif interfaces=`ip link` 2>/dev/null; then | ||
74 | interfaces=`echo "$interfaces" | sed '/^[0-9]\+: \(docker[0-9]\+\):.*/!d; s//\1/'` | ||
75 | else | 63 | else |
76 | echo "Failed to call 'ip link'" >&2 | 64 | echo "Failed to call 'ip tuntap list'" >&2 |
77 | exit 1 | 65 | exit 1 |
78 | fi | 66 | fi |
79 | 67 | ||
80 | # Ensure we start with a clean slate | 68 | # Ensure we start with a clean slate |
81 | for tap in $interfaces; do | 69 | for tap in $interfaces; do |
82 | echo "Note: Destroying pre-existing tap interface $tap..." | 70 | echo "Note: Destroying pre-existing tap interface $tap..." |
83 | if $ip_supports_tuntap; then | 71 | ip tuntap del $tap mode tap |
84 | ip tuntap del $tap mode tap | ||
85 | else | ||
86 | $TUNCTL -d $tap | ||
87 | fi | ||
88 | done | 72 | done |
89 | rm -f /etc/runqemu-nosudo | 73 | rm -f /etc/runqemu-nosudo |
90 | 74 | ||
@@ -95,8 +79,8 @@ fi | |||
95 | echo "Creating $COUNT tap devices for UID: $TUID GID: $GID..." | 79 | echo "Creating $COUNT tap devices for UID: $TUID GID: $GID..." |
96 | for ((index=0; index < $COUNT; index++)); do | 80 | for ((index=0; index < $COUNT; index++)); do |
97 | echo "Creating tap$index" | 81 | echo "Creating tap$index" |
98 | if ! ifup=`$RUNQEMU_IFUP $TUID $GID $STAGING_BINDIR_NATIVE 2>&1`; then | 82 | if ! ifup=`$RUNQEMU_IFUP $TUID $GID 2>&1`; then |
99 | echo "Error running tunctl: $ifup" | 83 | echo "Error bringing up interface: $ifup" |
100 | exit 1 | 84 | exit 1 |
101 | fi | 85 | fi |
102 | done | 86 | done |