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

Laine Stump posted 4 patches 7 years ago
[libvirt] [tck PATCH 4/4] nwfilter: allow for ebtables *not* removing leading 0 from mac addresses
Posted by Laine Stump 7 years ago
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@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

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list
Re: [libvirt] [tck PATCH 4/4] nwfilter: allow for ebtables *not* removing leading 0 from mac addresses
Posted by Daniel P. Berrangé 6 years, 12 months ago
On Thu, Feb 07, 2019 at 10:08:31PM -0500, Laine Stump wrote:
> 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@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(-)


Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>


Regards,
Daniel
-- 
|: https://berrange.com      -o-    https://www.flickr.com/photos/dberrange :|
|: https://libvirt.org         -o-            https://fstop138.berrange.com :|
|: https://entangle-photo.org    -o-    https://www.instagram.com/dberrange :|

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list