From 3943873cb4d51928e8d7cc7b6c6bb552f71da210 Mon Sep 17 00:00:00 2001 From: Alexander Bluhm Date: Sun, 24 Dec 2023 01:49:40 +0100 Subject: [PATCH] Add SKIP_IF to netlink environment to ignore certain interfaces. --- env-ot41.sh | 4 +++- env-ot42.sh | 2 ++ net.pl | 14 +++++++------- netlink.pl | 4 ++-- 4 files changed, 14 insertions(+), 10 deletions(-) diff --git a/env-ot41.sh b/env-ot41.sh index e02f8f07..df37086b 100644 --- a/env-ot41.sh +++ b/env-ot41.sh @@ -1,4 +1,6 @@ +# em2 is management, em3 and em4 have no link to switch export MANAGEMENT_IF=em2 +export SKIP_IF=em2,em3,em4 export NETLINK_LINE=1 # allow to manually run perform tests frag and splice on netlink hosts @@ -11,7 +13,7 @@ REMOTE_ADDR=undef REMOTE_ADDR6=undef REMOTE_SSH=undef export LOCAL_ADDR LOCAL_NET LOCAL_ADDR6 LOCAL_NET6 -export REMOTE_ADDR REMOTE_ADDR6 REMOTE_SSH +export REMOTE_ADDR REMOTE_ADDR6 REMOTE_SSH LOCAL_ADDR_RANGE=10.10.11.20 LOCAL_ADDR6_RANGE=fdd7:e83e:66bd:1011::20 diff --git a/env-ot42.sh b/env-ot42.sh index 0815dd36..6b681524 100644 --- a/env-ot42.sh +++ b/env-ot42.sh @@ -1,4 +1,6 @@ +# em4 is management, em5 is left over export MANAGEMENT_IF=em4 +export SKIP_IF=em4,em5 export NETLINK_LINE=2 # allow to manually run perform tests frag and splice on netlink hosts diff --git a/net.pl b/net.pl index f7b7b574..6ab1953f 100755 --- a/net.pl +++ b/net.pl @@ -139,10 +139,10 @@ print $fh "TESTMODES ", join(" ", sort keys %testmode), "\n"; close($fh); -delete $ENV{MANAGEMENT_IF}; +delete $ENV{SKIP_IF}; environment("$netlinkdir/bin/env-$host.sh"); -my $management_if = $ENV{MANAGEMENT_IF} - or die "MANAGEMENT_IF is not in 'env-$host.sh'"; +my $skip_if = $ENV{SKIP_IF} || ""; +$skip_if =~ s/,/|/; # setup remote machines @@ -218,14 +218,14 @@ END my %ifnums; @ifnums{ map { /^$iftype(\d+)$/ } - grep { ! /^($management_if)$/ } + grep { ! /^($skip_if)$/ } map { /^($iftype\d+) at / ? $1 : () } @dmesg} = (); foreach my $ifnum (defined($num) ? ($num + 0) : pairkeys sort { $a <=> $b } keys %ifnums) { - if (($iftype.($ifnum + 0)) =~ /^($management_if)$/ || - ($iftype.($ifnum + 1)) =~ /^($management_if)$/) { - die "Cannot use inferface '$if', conflicts management"; + if (($iftype.($ifnum + 0)) =~ /^($skip_if)$/ || + ($iftype.($ifnum + 1)) =~ /^($skip_if)$/) { + die "Cannot use inferface '$if', conflicts skip interface"; } if (!exists($ifnums{$ifnum + 0}) || !exists($ifnums{$ifnum + 1})) { if (defined($num)) { diff --git a/netlink.pl b/netlink.pl index 60b4e608..ab0b89e0 100755 --- a/netlink.pl +++ b/netlink.pl @@ -70,8 +70,8 @@ $left_ifidx = 0; $right_ifidx = 1; } -if (($iftype.$left_ifidx) =~ /^($management_if$/ || - ($iftype.$right_ifidx) =~ /^($management_if$/) { +if (($iftype.$left_ifidx) eq $management_if || + ($iftype.$right_ifidx) eq $management_if) { if (defined($ifnum)) { die "Cannot use inferface '$iface', conflicts management"; } else {