[libvirt] [tck PATCH 4/4] nwfilter: allow for ebtables *not* removing leading 0 from mac addresses

Laine Stump laine at laine.org
Fri Feb 8 03:08:31 UTC 2019


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: Laine Stump <laine at laine.org>
---
 scripts/nwfilter/100-ping-still-working.t | 4 ++--
 scripts/nwfilter/210-no-mac-spoofing.t    | 4 ++--
 2 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/scripts/nwfilter/100-ping-still-working.t b/scripts/nwfilter/100-ping-still-working.t
index a88eb02..656722d 100644
--- a/scripts/nwfilter/100-ping-still-working.t
+++ b/scripts/nwfilter/100-ping-still-working.t
@@ -76,9 +76,9 @@ diag "ip is $guestip";
 my $ebtables = (-e '/sbin/ebtables') ? '/sbin/ebtables' : '/usr/sbin/ebtables';
 my $ebtable = `$ebtables -L;$ebtables -t nat -L`;
 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;
-s/00/0/g;
+s/0([0-9])/0{0,1}$1/g;
 ok($ebtable =~ $_, "check ebtables entry");
 
 # ping guest1
diff --git a/scripts/nwfilter/210-no-mac-spoofing.t b/scripts/nwfilter/210-no-mac-spoofing.t
index 78c500c..95f003a 100644
--- a/scripts/nwfilter/210-no-mac-spoofing.t
+++ b/scripts/nwfilter/210-no-mac-spoofing.t
@@ -81,9 +81,9 @@ diag "guest ip is $guestip";
 my $ebtables = (-e '/sbin/ebtables') ? '/sbin/ebtables' : '/usr/sbin/ebtables';
 my $ebtable = `$ebtables -L;$ebtables -t nat -L`;
 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;
-s/00/0/g; 
+s/0([0-9])/0{0,1}$1/g;
 ok($ebtable =~ $_, "check ebtables entry");
 
 my $macfalse = "52:54:00:f9:21:22";
-- 
2.20.1




More information about the libvir-list mailing list