diff options
| author | Adrian Freihofer <adrian.freihofer@gmail.com> | 2023-06-22 19:01:27 +0200 |
|---|---|---|
| committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2023-06-24 12:21:48 +0100 |
| commit | 03566537a5a1f01bdc1a923ec41816d91ed8f6ab (patch) | |
| tree | 8f57c3f2d8331b0154f4ba8ac9745cb0e6114107 | |
| parent | 6321e1fe7ab25fef5300986fe5df35fdb6c28bd7 (diff) | |
| download | poky-03566537a5a1f01bdc1a923ec41816d91ed8f6ab.tar.gz | |
runqemu-gen-tapdevs: configurable tap names
Feature: Hard-coding the interface names to tap* is not always a good
idea.
(From OE-Core rev: 739f20481d14a66b23d6195c3837f83d7370434a)
Signed-off-by: Adrian Freihofer <adrian.freihofer@siemens.com>
Signed-off-by: Luca Ceresoli <luca.ceresoli@bootlin.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
| -rwxr-xr-x | scripts/runqemu-gen-tapdevs | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/scripts/runqemu-gen-tapdevs b/scripts/runqemu-gen-tapdevs index 7f67ee5540..cbf8008929 100755 --- a/scripts/runqemu-gen-tapdevs +++ b/scripts/runqemu-gen-tapdevs | |||
| @@ -45,6 +45,10 @@ else | |||
| 45 | fi | 45 | fi |
| 46 | 46 | ||
| 47 | 47 | ||
| 48 | if [ -z "$OE_TAP_NAME" ]; then | ||
| 49 | OE_TAP_NAME=tap | ||
| 50 | fi | ||
| 51 | |||
| 48 | # check if COUNT is a number and >= 0 | 52 | # check if COUNT is a number and >= 0 |
| 49 | if ! [ $COUNT -ge 0 ]; then | 53 | if ! [ $COUNT -ge 0 ]; then |
| 50 | echo "Error: Incorrect count: $COUNT" | 54 | echo "Error: Incorrect count: $COUNT" |
| @@ -64,7 +68,7 @@ if [ ! -x "$RUNQEMU_IFUP" ]; then | |||
| 64 | fi | 68 | fi |
| 65 | 69 | ||
| 66 | if interfaces=`ip tuntap list` 2>/dev/null; then | 70 | if interfaces=`ip tuntap list` 2>/dev/null; then |
| 67 | interfaces=`echo "$interfaces" |cut -f1 -d:` | 71 | interfaces=`echo "$interfaces" |cut -f1 -d: ` |
| 68 | else | 72 | else |
| 69 | echo "Failed to call 'ip tuntap list'" >&2 | 73 | echo "Failed to call 'ip tuntap list'" >&2 |
| 70 | exit 1 | 74 | exit 1 |
| @@ -83,7 +87,7 @@ fi | |||
| 83 | 87 | ||
| 84 | echo "Creating $COUNT tap devices for GID: $GID..." | 88 | echo "Creating $COUNT tap devices for GID: $GID..." |
| 85 | for ((index=0; index < $COUNT; index++)); do | 89 | for ((index=0; index < $COUNT; index++)); do |
| 86 | echo "Creating tap$index" | 90 | echo "Creating $OE_TAP_NAME$index" |
| 87 | if ! ifup=`$RUNQEMU_IFUP $GID 2>&1`; then | 91 | if ! ifup=`$RUNQEMU_IFUP $GID 2>&1`; then |
| 88 | echo "Error bringing up interface: $ifup" | 92 | echo "Error bringing up interface: $ifup" |
| 89 | exit 1 | 93 | exit 1 |
| @@ -95,7 +99,7 @@ echo "Note: that the tap devices be set as unmanaged in the" | |||
| 95 | echo "Note: NetworkManager.conf file. Add the following lines to" | 99 | echo "Note: NetworkManager.conf file. Add the following lines to" |
| 96 | echo "Note: /etc/NetworkManager/NetworkManager.conf" | 100 | echo "Note: /etc/NetworkManager/NetworkManager.conf" |
| 97 | echo "[keyfile]" | 101 | echo "[keyfile]" |
| 98 | echo "unmanaged-devices=interface-name:tap*" | 102 | echo "unmanaged-devices=interface-name:$OE_TAP_NAME*" |
| 99 | 103 | ||
| 100 | # The runqemu script will check for this file, and if it exists, | 104 | # The runqemu script will check for this file, and if it exists, |
| 101 | # will use the existing bank of tap devices without creating | 105 | # will use the existing bank of tap devices without creating |
