Skip to content

Commit

Permalink
Add SKIP_IF to netlink environment to ignore certain interfaces.
Browse files Browse the repository at this point in the history
  • Loading branch information
bluhm committed Dec 24, 2023
1 parent d81d281 commit 3943873
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 10 deletions.
4 changes: 3 additions & 1 deletion env-ot41.sh
Original file line number Diff line number Diff line change
@@ -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
Expand All @@ -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
Expand Down
2 changes: 2 additions & 0 deletions env-ot42.sh
Original file line number Diff line number Diff line change
@@ -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
Expand Down
14 changes: 7 additions & 7 deletions net.pl
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down Expand Up @@ -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)) {
Expand Down
4 changes: 2 additions & 2 deletions netlink.pl
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down

0 comments on commit 3943873

Please sign in to comment.