Commit 5f22b7f7 authored by Laine Stump's avatar Laine Stump

nwfilter: allow for ebtables *not* removing leading 0 from mac addresses

The ebtables command in RHEL8 prints 00 in a MAC address as.... "00",
unlike e.g. Fedora 29, which prints it as "0". Allow for both.
Signed-off-by: default avatarLaine Stump <laine@laine.org>
Reviewed-by: default avatarDaniel P. Berrangé <berrange@redhat.com>
parent 42f798b6
...@@ -76,9 +76,9 @@ diag "ip is $guestip"; ...@@ -76,9 +76,9 @@ diag "ip is $guestip";
my $ebtables = (-e '/sbin/ebtables') ? '/sbin/ebtables' : '/usr/sbin/ebtables'; my $ebtables = (-e '/sbin/ebtables') ? '/sbin/ebtables' : '/usr/sbin/ebtables';
my $ebtable = `$ebtables -L;$ebtables -t nat -L`; my $ebtable = `$ebtables -L;$ebtables -t nat -L`;
diag $ebtable; diag $ebtable;
# ebtables shortens :00: to :0: so we need to do that too # ebtables *might* shorten :00: to :0: so we need to allow for both when searching
$_ = $mac; $_ = $mac;
s/00/0/g; s/0([0-9])/0{0,1}$1/g;
ok($ebtable =~ $_, "check ebtables entry"); ok($ebtable =~ $_, "check ebtables entry");
# ping guest1 # ping guest1
......
...@@ -81,9 +81,9 @@ diag "guest ip is $guestip"; ...@@ -81,9 +81,9 @@ diag "guest ip is $guestip";
my $ebtables = (-e '/sbin/ebtables') ? '/sbin/ebtables' : '/usr/sbin/ebtables'; my $ebtables = (-e '/sbin/ebtables') ? '/sbin/ebtables' : '/usr/sbin/ebtables';
my $ebtable = `$ebtables -L;$ebtables -t nat -L`; my $ebtable = `$ebtables -L;$ebtables -t nat -L`;
diag $ebtable; diag $ebtable;
# ebtables shortens :00: to :0: so we need to do that too # ebtables *might* shorten :00: to :0: so we need to allow for both when searching
$_ = $mac; $_ = $mac;
s/00/0/g; s/0([0-9])/0{0,1}$1/g;
ok($ebtable =~ $_, "check ebtables entry"); ok($ebtable =~ $_, "check ebtables entry");
my $macfalse = "52:54:00:f9:21:22"; my $macfalse = "52:54:00:f9:21:22";
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment