On 02/08/2018 02:19 PM, Laine Stump wrote:
The default filterref is still clean-traffic, but we can now set it
to
"no-broadcast-mac" for the test by that same name.
This corrects a problem with the no-mac-broadcast test, which was
checking to see that packets with a destination MAC address of
ff:ff:ff:ff:ff:ff weren't allowed, but was neglecting to add the
"no-mac-broadcast" nwfilter to the domain (the test was erroneously
succeeding because it was checking for a different type of packet than
it was generating, which is fixed in a separate patch).
Signed-off-by: Laine Stump <laine(a)laine.org>
---
Change from V1: keep default filter of "clean-traffic" rather than no filter.
lib/Sys/Virt/TCK.pm | 9 ++++++---
scripts/nwfilter/230-no-mac-broadcast.t | 3 ++-
2 files changed, 8 insertions(+), 4 deletions(-)
diff --git a/lib/Sys/Virt/TCK.pm b/lib/Sys/Virt/TCK.pm
index ce8e81b..01ce3ea 100644
--- a/lib/Sys/Virt/TCK.pm
+++ b/lib/Sys/Virt/TCK.pm
@@ -766,6 +766,7 @@ sub generic_machine_domain {
my $caps = exists $params{caps} ? $params{caps} : die "caps parameter is
required";
my $ostype = exists $params{ostype} ? $params{ostype} : "hvm";
my $fullos = exists $params{fullos} ? $params{fullos} : 0;
+ my $filterref = exists $params{filterref} ? $params{filterref} :
"clean-traffic";
if ($fullos) {
my %config = $self->get_image($caps, $ostype);
@@ -792,7 +793,7 @@ sub generic_machine_domain {
source => "default",
model => "virtio",
mac => "52:54:00:11:11:11",
- filterref => "clean-traffic");
+ filterref => $filterref);
my $xml = $b->as_xml();
# Cleanup the temporary interface
$b->rminterface();
@@ -896,6 +897,7 @@ sub generic_domain {
my $ostype = exists $params{ostype} ? $params{ostype} : "hvm";
my $fullos = exists $params{fullos} ? $params{fullos} : 0;
my $netmode = exists $params{netmode} ? $params{netmode} : undef;
+ my $filterref = exists $params{filterref} ? $params{filterref} :
"clean-traffic";
my $caps = Sys::Virt::TCK::Capabilities->new(xml =>
$self->conn->get_capabilities);
@@ -915,7 +917,8 @@ sub generic_domain {
$b = $self->generic_machine_domain(name => $name,
caps => $caps,
ostype => $ostype,
- fullos => $fullos);
+ fullos => $fullos,
+ filterref => $filterref);
}
if ($netmode) {
if ($netmode eq "vepa") {
@@ -931,7 +934,7 @@ sub generic_domain {
source => "default",
model => "virtio",
mac => "52:54:00:11:11:11",
- filterref => "clean-traffic");
+ filterref => $filterref);
}
}
return $b;
diff --git a/scripts/nwfilter/230-no-mac-broadcast.t
b/scripts/nwfilter/230-no-mac-broadcast.t
index ed6932c..6ab20d8 100644
--- a/scripts/nwfilter/230-no-mac-broadcast.t
+++ b/scripts/nwfilter/230-no-mac-broadcast.t
@@ -43,7 +43,8 @@ END {
# create first domain and start it
my $xml = $tck->generic_domain(name => "tck", fullos => 1,
- netmode => "network")->as_xml();
+ netmode => "network",
+ filterref =>
"no-mac-broadcast")->as_xml();
my $dom;
ok_domain(sub { $dom = $conn->define_domain($xml) }, "created persistent domain
object");
Reviewed-by: Stefan Berger <stefanb(a)linux.vnet.ibm.com>