]> git.ipfire.org Git - thirdparty/openembedded/openembedded-core-contrib.git/commitdiff
runqemu-ifup: fix tap index
authorAdrian Freihofer <adrian.freihofer@gmail.com>
Thu, 22 Jun 2023 17:01:23 +0000 (19:01 +0200)
committerRichard Purdie <richard.purdie@linuxfoundation.org>
Sat, 24 Jun 2023 11:19:52 +0000 (12:19 +0100)
Recent patches changed the index of the tap interfaces. They start now
with tap1 instead of tap0. Also the IP address starts with 192.168.7.3
instead of 192.168.7.1. This gets reverted to the previous behavior.

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>
scripts/runqemu-ifup

index 9820dc535c9e4bdc9dee41cdc7b207b4cdf40fca..fe4492e78b71463c391c22e5f2b67b37d1a9606a 100755 (executable)
@@ -45,8 +45,13 @@ if [ -z "$OE_TAP_NAME" ]; then
 fi
 
 if taps=$(ip tuntap list 2>/dev/null); then
-       tap_no=$(( $(echo "$taps" |cut -f 1 -d ":" | sed "s/$OE_TAP_NAME//g" | sort -rn | head -n 1) + 1 ))
-       ip tuntap add "$OE_TAP_NAME$tap_no" mode tap group "$GROUP" && TAP="$OE_TAP_NAME$tap_no"
+       tap_no_last=$(echo "$taps" |cut -f 1 -d ":" |sed "s/$OE_TAP_NAME//g" | sort -rn | head -n 1)
+       if [ -z "$tap_no_last" ]; then
+               tap_no=0
+       else
+               tap_no=$(("$tap_no_last" + 1))
+       fi
+       ip tuntap add "$OE_TAP_NAME$tap_no" mode tap group "$GROUP" && TAP=$OE_TAP_NAME$tap_no
 fi
 
 if [ -z "$TAP" ]; then