diff mbox series

[4/9] runqemu-ifup: remove only our taps

Message ID 20230622170946.10082-5-adrian.freihofer@siemens.com
State Accepted, archived
Commit f65fb5fce45d13c2881acd8295d417635449c52d
Headers show
Series fixes for runqemu-gen-tapdevs | expand

Commit Message

Adrian Freihofer June 22, 2023, 5:01 p.m. UTC
If there are other tap interfaces than the interfaces created by the
runqemu-* scripts, these interfaces are not ignored. This is now fixed
by filtering the interfaces for a specific prefix in the interface name.

Signed-off-by: Adrian Freihofer <adrian.freihofer@siemens.com>
---
 scripts/runqemu-ifup | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Jörg Sommer June 23, 2023, 9:44 a.m. UTC | #1
On 22 June 2023 19:01, openembedded-core@lists.openembedded.org wrote:
> If there are other tap interfaces than the interfaces created by the
> runqemu-* scripts, these interfaces are not ignored. This is now fixed
> by filtering the interfaces for a specific prefix in the interface name.
>
> Signed-off-by: Adrian Freihofer <adrian.freihofer@siemens.com>
> ---
>  scripts/runqemu-ifup | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/scripts/runqemu-ifup b/scripts/runqemu-ifup
> index fe4492e78b7..c65ceaf1c83 100755
> --- a/scripts/runqemu-ifup
> +++ b/scripts/runqemu-ifup
> @@ -45,7 +45,7 @@ if [ -z "$OE_TAP_NAME" ]; then
>  fi
>
>  if taps=$(ip tuntap list 2>/dev/null); then
> -       tap_no_last=$(echo "$taps" |cut -f 1 -d ":" |sed "s/$OE_TAP_NAME//g" | sort -rn | head -n 1)
> +       tap_no_last=$(echo "$taps" |cut -f 1 -d ":" |grep -E "^$OE_TAP_NAME.*" |sed "s/$OE_TAP_NAME//g" | sort -rn | head -n 1)

You can combine the cut+grep+sed to `sed "/^$OE_TAP_NAME/!d; s///; s/:.*//"`


Regards,

Jörg Sommer

Software Developer / Programmierer
--

Navimatix GmbH

Tatzendpromenade 2

07745 Jena
      

T: 03641 - 327 99 0

F: 03641 - 526 306

M: joerg.sommer@navimatix.de

www.navimatix.de
      



Geschäftsführer: Steffen Späthe, Jan Rommeley

Registergericht: Amtsgericht Jena, HRB 501480
diff mbox series

Patch

diff --git a/scripts/runqemu-ifup b/scripts/runqemu-ifup
index fe4492e78b7..c65ceaf1c83 100755
--- a/scripts/runqemu-ifup
+++ b/scripts/runqemu-ifup
@@ -45,7 +45,7 @@  if [ -z "$OE_TAP_NAME" ]; then
 fi
 
 if taps=$(ip tuntap list 2>/dev/null); then
-	tap_no_last=$(echo "$taps" |cut -f 1 -d ":" |sed "s/$OE_TAP_NAME//g" | sort -rn | head -n 1)
+	tap_no_last=$(echo "$taps" |cut -f 1 -d ":" |grep -E "^$OE_TAP_NAME.*" |sed "s/$OE_TAP_NAME//g" | sort -rn | head -n 1)
 	if [ -z "$tap_no_last" ]; then
 		tap_no=0
 	else