From nobody Sat May 4 04:50:35 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) client-ip=209.132.183.28; envelope-from=libvir-list-bounces@redhat.com; helo=mx1.redhat.com; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 1518055528182515.5072431761789; Wed, 7 Feb 2018 18:05:28 -0800 (PST) Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 0D2B9C065F88; Thu, 8 Feb 2018 02:05:27 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.20]) by smtp.corp.redhat.com (Postfix) with ESMTPS id DD03F609C0; Thu, 8 Feb 2018 02:05:26 +0000 (UTC) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by colo-mx.corp.redhat.com (Postfix) with ESMTP id AA8AB18033E0; Thu, 8 Feb 2018 02:05:26 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.rdu2.redhat.com [10.11.54.6]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id w1825594023188 for ; Wed, 7 Feb 2018 21:05:06 -0500 Received: by smtp.corp.redhat.com (Postfix) id 6269F2156A30; Thu, 8 Feb 2018 02:05:05 +0000 (UTC) Received: from tlap.laine.org.com (ovpn-120-186.rdu2.redhat.com [10.10.120.186]) by smtp.corp.redhat.com (Postfix) with ESMTP id 39BB82166BB3; Thu, 8 Feb 2018 02:05:05 +0000 (UTC) From: Laine Stump To: libvir-list@redhat.com Date: Wed, 7 Feb 2018 21:04:51 -0500 Message-Id: <20180208020459.16928-2-laine@laine.org> In-Reply-To: <20180208020459.16928-1-laine@laine.org> References: <20180208020459.16928-1-laine@laine.org> X-Scanned-By: MIMEDefang 2.78 on 10.11.54.6 X-loop: libvir-list@redhat.com Subject: [libvirt] [tck PATCH 1/9] create vms that use virt-builder images with no graphics and virtio-net X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.31]); Thu, 08 Feb 2018 02:05:27 +0000 (UTC) X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" This is consistent with what is used to create the disk image supplied by virt-builder. It doesn't currently affect the outcome of the test, but it's possible that in the future it could. In particular, the network device name changes depending on whether or not there is a graphics device (due to change in PCI address). The virt-builder image is create by installing Fedora on a guest that has no graphics card, so it sees the network device as "ens2" and creates an appropriate ifcfg-ens2, but if you boot the image with a graphics card, then the network device will be named "ens3". It turns out that NetworkManager is enabled by default on the virt-builder images, and NetworkManager will listen for dhcp on *all* interfaces (not just those with a configuration file), so networking still functions on the guest, but if a test script were to try to use "ifdown ens3" (for example) that wouldn't work. The best solution may be to have the image set "biosdevnames=3D0 net.ifnames=3D0" on the kernel commandline (so that the netdev is always called "eth0" regardless of its PCI address), but that would also need to be done in the kickstart file used to create the image, which is done offline by libguestfs people, so it's not something we have control over here. Reviewed-by: Daniel P. Berrange --- lib/Sys/Virt/TCK.pm | 13 +++---------- 1 file changed, 3 insertions(+), 10 deletions(-) diff --git a/lib/Sys/Virt/TCK.pm b/lib/Sys/Virt/TCK.pm index b39f578..ce8e81b 100644 --- a/lib/Sys/Virt/TCK.pm +++ b/lib/Sys/Virt/TCK.pm @@ -781,11 +781,6 @@ sub generic_machine_domain { =20 $b->boot_disk(); =20 - $b->graphics(type =3D> "vnc", - port =3D> "-1", - autoport =3D> "yes", - listen =3D> "127.0.0.1"); - $b->disk(src =3D> $config{root}, dst =3D> $config{dev}, type =3D> "file"); @@ -795,6 +790,7 @@ sub generic_machine_domain { =20 $b->interface(type =3D> "network", source =3D> "default", + model =3D> "virtio", mac =3D> "52:54:00:11:11:11", filterref =3D> "clean-traffic"); my $xml =3D $b->as_xml(); @@ -840,11 +836,6 @@ sub generic_machine_domain { # XXX boot CDROM or vroot for other HVs $b->boot_kernel($config{kernel}, $config{initrd}); =20 - $b->graphics(type =3D> "vnc", - port =3D> "-1", - autoport =3D> "yes", - listen =3D> "127.0.0.1"); - $b->disk(src =3D> $config{root}, dst =3D> $config{dev}, type =3D> "file"); @@ -930,6 +921,7 @@ sub generic_domain { if ($netmode eq "vepa") { $b->interface(type =3D> "direct", source =3D> "default", + model =3D> "virtio", mac =3D> "52:54:00:11:11:11", dev =3D> $self->get_host_network_device(), mode =3D> "vepa", @@ -937,6 +929,7 @@ sub generic_domain { } else { $b->interface(type =3D> "network", source =3D> "default", + model =3D> "virtio", mac =3D> "52:54:00:11:11:11", filterref =3D> "clean-traffic"); } --=20 2.13.6 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Sat May 4 04:50:35 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) client-ip=209.132.183.28; envelope-from=libvir-list-bounces@redhat.com; helo=mx1.redhat.com; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 1518055531304190.13481819590697; Wed, 7 Feb 2018 18:05:31 -0800 (PST) Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 1C21D8FABB; Thu, 8 Feb 2018 02:05:30 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.20]) by smtp.corp.redhat.com (Postfix) with ESMTPS id C96BB2A2E7; Thu, 8 Feb 2018 02:05:29 +0000 (UTC) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by colo-mx.corp.redhat.com (Postfix) with ESMTP id 8BCDE18033EA; Thu, 8 Feb 2018 02:05:29 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.rdu2.redhat.com [10.11.54.6]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id w18255VY023189 for ; Wed, 7 Feb 2018 21:05:06 -0500 Received: by smtp.corp.redhat.com (Postfix) id A41F22166BB6; Thu, 8 Feb 2018 02:05:05 +0000 (UTC) Received: from tlap.laine.org.com (ovpn-120-186.rdu2.redhat.com [10.10.120.186]) by smtp.corp.redhat.com (Postfix) with ESMTP id 71CDC2166BB3; Thu, 8 Feb 2018 02:05:05 +0000 (UTC) From: Laine Stump To: libvir-list@redhat.com Date: Wed, 7 Feb 2018 21:04:52 -0500 Message-Id: <20180208020459.16928-3-laine@laine.org> In-Reply-To: <20180208020459.16928-1-laine@laine.org> References: <20180208020459.16928-1-laine@laine.org> X-Scanned-By: MIMEDefang 2.78 on 10.11.54.6 X-loop: libvir-list@redhat.com Subject: [libvirt] [tck PATCH 2/9] Use $net->get_dhcp_leases() when available X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.27]); Thu, 08 Feb 2018 02:05:30 +0000 (UTC) X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" Newer versions of libvirt no longer let dnsmasq create a leases file, they keep track of it themselves and provide an API to retrieve the current list of leases. Use that to get the guest's IP address when it's available. Reviewed-by: Daniel P. Berrange --- I later realized that it might be more appropriate to use $dom->get_interface_addresses(), but I'd already rewritten the existing function this way and it works, so I left it. lib/Sys/Virt/TCK/NetworkHelpers.pm | 9 +++++++++ scripts/nwfilter/100-ping-still-working.t | 2 +- scripts/nwfilter/210-no-mac-spoofing.t | 2 +- scripts/nwfilter/220-no-ip-spoofing.t | 2 +- scripts/nwfilter/230-no-mac-broadcast.t | 2 +- scripts/nwfilter/240-no-arp-spoofing.t | 2 +- scripts/nwfilter/nwfilter_concurrent.sh | 4 ++-- 7 files changed, 16 insertions(+), 7 deletions(-) diff --git a/lib/Sys/Virt/TCK/NetworkHelpers.pm b/lib/Sys/Virt/TCK/NetworkH= elpers.pm index 133064b..f6bf8f9 100644 --- a/lib/Sys/Virt/TCK/NetworkHelpers.pm +++ b/lib/Sys/Virt/TCK/NetworkHelpers.pm @@ -10,7 +10,16 @@ sub get_first_macaddress { } =20 sub get_ip_from_leases{ + my $conn =3D shift; + my $netname =3D shift; my $mac =3D shift; + + my $net =3D $conn->get_network_by_name($netname); + if ($net->can('get_dhcp_leases')) { + my @leases =3D $net->get_dhcp_leases($mac); + return @leases ? @leases[0]->{'ipaddr'} : undef; + } + my $tmp =3D `grep $mac /var/lib/libvirt/dnsmasq/default.leases`; my @fields =3D split(/ /, $tmp); my $ip =3D $fields[2]; diff --git a/scripts/nwfilter/100-ping-still-working.t b/scripts/nwfilter/1= 00-ping-still-working.t index a20b95d..dc1efd2 100644 --- a/scripts/nwfilter/100-ping-still-working.t +++ b/scripts/nwfilter/100-ping-still-working.t @@ -69,7 +69,7 @@ sleep(10); my $mac =3D get_first_macaddress($dom); diag "mac is $mac"; =20 -my $guestip =3D get_ip_from_leases($mac); +my $guestip =3D get_ip_from_leases($conn, "default", $mac); diag "ip is $guestip"; =20 # check ebtables entry diff --git a/scripts/nwfilter/210-no-mac-spoofing.t b/scripts/nwfilter/210-= no-mac-spoofing.t index b81fc4a..03001a8 100644 --- a/scripts/nwfilter/210-no-mac-spoofing.t +++ b/scripts/nwfilter/210-no-mac-spoofing.t @@ -69,7 +69,7 @@ sleep(10); my $mac =3D get_first_macaddress($dom); diag "mac is $mac"; =20 -my $guestip =3D get_ip_from_leases($mac); +my $guestip =3D get_ip_from_leases($conn, "default", $mac); diag "ip is $guestip"; =20 # check ebtables entry diff --git a/scripts/nwfilter/220-no-ip-spoofing.t b/scripts/nwfilter/220-n= o-ip-spoofing.t index 3a0213d..d447a19 100644 --- a/scripts/nwfilter/220-no-ip-spoofing.t +++ b/scripts/nwfilter/220-no-ip-spoofing.t @@ -60,7 +60,7 @@ sleep(30); my $mac =3D get_first_macaddress($dom); diag "mac is $mac"; =20 -my $guestip =3D get_ip_from_leases($mac); +my $guestip =3D get_ip_from_leases($conn, "default", $mac); diag "ip is $guestip"; =20 # check ebtables entry diff --git a/scripts/nwfilter/230-no-mac-broadcast.t b/scripts/nwfilter/230= -no-mac-broadcast.t index 16ce60d..9d00dc4 100644 --- a/scripts/nwfilter/230-no-mac-broadcast.t +++ b/scripts/nwfilter/230-no-mac-broadcast.t @@ -68,7 +68,7 @@ sleep(10); my $mac =3D get_first_macaddress($dom); diag "mac is $mac"; =20 -my $guestip =3D get_ip_from_leases($mac); +my $guestip =3D get_ip_from_leases($conn, "default", $mac); diag "ip is $guestip"; =20 # check ebtables entry diff --git a/scripts/nwfilter/240-no-arp-spoofing.t b/scripts/nwfilter/240-= no-arp-spoofing.t index 284033d..f1e6870 100644 --- a/scripts/nwfilter/240-no-arp-spoofing.t +++ b/scripts/nwfilter/240-no-arp-spoofing.t @@ -70,7 +70,7 @@ sleep(10); my $mac =3D get_first_macaddress($dom); diag "mac is $mac"; =20 -my $guestip =3D get_ip_from_leases($mac); +my $guestip =3D get_ip_from_leases($conn, "default", $mac); diag "ip is $guestip"; =20 # check ebtables entry diff --git a/scripts/nwfilter/nwfilter_concurrent.sh b/scripts/nwfilter/nwf= ilter_concurrent.sh index 4c9b878..359e2ab 100644 --- a/scripts/nwfilter/nwfilter_concurrent.sh +++ b/scripts/nwfilter/nwfilter_concurrent.sh @@ -242,9 +242,9 @@ runTest() =20 [ $? -ne 0 ] && rm -rf "${tmpdir}" && return 1; =20 - # Test runs for a maximum of 5 minutes + # Test runs for a maximum of 10 minutes now=3D`date +%s` - test_end=3D$(($now + 5 * 60)) + test_end=3D$(($now + 10 * 60)) =20 while :; do --=20 2.13.6 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Sat May 4 04:50:35 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) client-ip=209.132.183.28; envelope-from=libvir-list-bounces@redhat.com; helo=mx1.redhat.com; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 1518055510726344.661097485946; Wed, 7 Feb 2018 18:05:10 -0800 (PST) Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 93E03356C1; Thu, 8 Feb 2018 02:05:09 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.21]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 387185F703; Thu, 8 Feb 2018 02:05:09 +0000 (UTC) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by colo-mx.corp.redhat.com (Postfix) with ESMTP id 5263A4A46D; Thu, 8 Feb 2018 02:05:07 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.rdu2.redhat.com [10.11.54.6]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id w18255i1023195 for ; Wed, 7 Feb 2018 21:05:06 -0500 Received: by smtp.corp.redhat.com (Postfix) id DE5D42156A37; Thu, 8 Feb 2018 02:05:05 +0000 (UTC) Received: from tlap.laine.org.com (ovpn-120-186.rdu2.redhat.com [10.10.120.186]) by smtp.corp.redhat.com (Postfix) with ESMTP id B4C3A2156A32; Thu, 8 Feb 2018 02:05:05 +0000 (UTC) From: Laine Stump To: libvir-list@redhat.com Date: Wed, 7 Feb 2018 21:04:53 -0500 Message-Id: <20180208020459.16928-4-laine@laine.org> In-Reply-To: <20180208020459.16928-1-laine@laine.org> References: <20180208020459.16928-1-laine@laine.org> X-Scanned-By: MIMEDefang 2.78 on 10.11.54.6 X-loop: libvir-list@redhat.com Subject: [libvirt] [tck PATCH 3/9] Use Net::OpenSSH instead of Net::SSH::Perl X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.30]); Thu, 08 Feb 2018 02:05:10 +0000 (UTC) X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" Net::SSH::Perl is out of date in the Fedora git repos. The version currently supported in Fedora fails to connect to most modern sshd's, and updating to the new version would require adding several new perl packages to Fedora. Instead, this patch switches to using Net::OpenSSH, whose current version in Fedora works properly *EXCEPT* that it is missing the line "Requires: perl(IO:TTy)" in its specfiles (I filed https://bugzilla.redhat.com/1542666 requesting that fix to be applied to Fedora git repos. For now, just run "dnf install perl-IO-Tty" separately) NB: prior to this patch, Net::SSH::Perl was required, but had no Required: line in the specfile, so you would have to install it by hand. If you had done that, you can probably now dnf erase it. Reviewed-by: Daniel P. Berrange --- perl-Sys-Virt-TCK.spec.PL | 3 ++- scripts/nwfilter/100-ping-still-working.t | 1 - scripts/nwfilter/210-no-mac-spoofing.t | 27 ++++++++++++++------------- scripts/nwfilter/220-no-ip-spoofing.t | 23 ++++++++++++----------- scripts/nwfilter/230-no-mac-broadcast.t | 23 ++++++++++++----------- scripts/nwfilter/240-no-arp-spoofing.t | 23 ++++++++++++----------- scripts/nwfilter/300-vsitype.t | 1 - 7 files changed, 52 insertions(+), 49 deletions(-) diff --git a/perl-Sys-Virt-TCK.spec.PL b/perl-Sys-Virt-TCK.spec.PL index 9a10880..4172499 100644 --- a/perl-Sys-Virt-TCK.spec.PL +++ b/perl-Sys-Virt-TCK.spec.PL @@ -37,7 +37,7 @@ __DATA__ Summary: Sys::Virt::TCK - libvirt Technology Compatibility Kit Name: perl-%{appname} Version: @VERSION@ -Release: 1%{_extra_release} +Release: 99%{_extra_release} License: GPLv2 Group: Development/Tools Source: http://libvirt.org/sources/tck/%{appname}-v%{version}.tar.gz @@ -73,6 +73,7 @@ Requires: perl(Test::Exception) Requires: perl(TAP::Formatter::HTML) Requires: perl(TAP::Formatter::JUnit) Requires: perl(TAP::Harness::Archive) +Requires: perl(Net::OpenSSH) Requires: /usr/bin/mkisofs BuildArchitectures: noarch =20 diff --git a/scripts/nwfilter/100-ping-still-working.t b/scripts/nwfilter/1= 00-ping-still-working.t index dc1efd2..5afc6a6 100644 --- a/scripts/nwfilter/100-ping-still-working.t +++ b/scripts/nwfilter/100-ping-still-working.t @@ -32,7 +32,6 @@ use Test::More tests =3D> 4; use Sys::Virt::TCK; use Sys::Virt::TCK::NetworkHelpers; use Test::Exception; -use Net::SSH::Perl; =20 use File::Spec::Functions qw(catfile catdir rootdir); =20 diff --git a/scripts/nwfilter/210-no-mac-spoofing.t b/scripts/nwfilter/210-= no-mac-spoofing.t index 03001a8..eb01d13 100644 --- a/scripts/nwfilter/210-no-mac-spoofing.t +++ b/scripts/nwfilter/210-no-mac-spoofing.t @@ -31,7 +31,7 @@ use Test::More tests =3D> 5; use Sys::Virt::TCK; use Sys::Virt::TCK::NetworkHelpers; use Test::Exception; -use Net::SSH::Perl; +use Net::OpenSSH; =20 use File::Spec::Functions qw(catfile catdir rootdir); =20 @@ -88,9 +88,10 @@ diag $ping; ok($ping =3D~ "10 received", "ping $guestip test"); =20 # log into guest -my $ssh =3D Net::SSH::Perl->new($guestip); diag "ssh'ing into $guestip"; -$ssh->login("root", $tck->root_password()); +my $ssh =3D Net::OpenSSH->new($guestip, + user =3D> "root", + password =3D> $tck->root_password()); =20 # now bring eth0 down, change MAC and bring it up again diag "fiddling with mac"; @@ -108,26 +109,26 @@ echo "DEV=3D`ip link | head -3 | tail -1 | awk '{prin= t \\\$2}' | sed -e 's/://'` /sbin/ip addr show dev \\\$DEV" > /test.sh EOF diag $cmdfile; -my ($stdout, $stderr, $exit) =3D $ssh->cmd($cmdfile); +my ($stdout, $stderr) =3D $ssh->capture2($cmdfile); diag $stdout; diag $stderr; -diag $exit; -($stdout, $stderr, $exit) =3D $ssh->cmd("chmod +x /test.sh"); +diag "Exit Code: $?"; +($stdout, $stderr) =3D $ssh->capture2("chmod +x /test.sh"); diag $stdout; diag $stderr; -diag $exit; -($stdout, $stderr, $exit) =3D $ssh->cmd("/test.sh > /test.log"); +diag "Exit Code: $?"; +($stdout, $stderr) =3D $ssh->capture2("/test.sh > /test.log"); diag $stdout; diag $stderr; -diag $exit; -($stdout, $stderr, $exit) =3D $ssh->cmd("cat /test.sh"); +diag "Exit Code: $?"; +($stdout, $stderr) =3D $ssh->capture2("cat /test.sh"); diag $stdout; diag $stderr; -diag $exit; -($stdout, $stderr, $exit) =3D $ssh->cmd("cat /test.log"); +diag "Exit Code: $?"; +($stdout, $stderr) =3D $ssh->capture2("cat /test.log"); diag $stdout; diag $stderr; -diag $exit; +diag "Exit Code: $?"; ok($stdout =3D~ /100% packet loss|Network is unreachable/, "packet loss ex= pected"); =20 shutdown_vm_gracefully($dom); diff --git a/scripts/nwfilter/220-no-ip-spoofing.t b/scripts/nwfilter/220-n= o-ip-spoofing.t index d447a19..872dcc3 100644 --- a/scripts/nwfilter/220-no-ip-spoofing.t +++ b/scripts/nwfilter/220-no-ip-spoofing.t @@ -31,7 +31,7 @@ use Test::More tests =3D> 4; use Sys::Virt::TCK; use Sys::Virt::TCK::NetworkHelpers; use Test::Exception; -use Net::SSH::Perl; +use Net::OpenSSH; =20 use File::Spec::Functions qw(catfile catdir rootdir); =20 @@ -71,9 +71,10 @@ diag $ebtable; ok($ebtable =3D~ "$guestip", "check ebtables entry"); =20 # log into guest -my $ssh =3D Net::SSH::Perl->new($guestip); diag "ssh'ing into $guestip"; -$ssh->login("root", $tck->root_password()); +my $ssh =3D Net::OpenSSH->new($guestip, + user =3D> "root", + password =3D> $tck->root_password()); =20 # now bring eth0 down, change IP and bring it up again diag "preparing ip spoof"; @@ -95,23 +96,23 @@ MASK=3D`ip addr show \\\$DEV | grep 'inet ' | awk '{pri= nt \\\$2}' | sed -e 's/.*\\ /sbin/ip addr show \\\$DEV" > /test.sh EOF diag $cmdfile; -my ($stdout, $stderr, $exit) =3D $ssh->cmd($cmdfile); +my ($stdout, $stderr) =3D $ssh->capture2($cmdfile); diag $stdout; diag $stderr; -diag $exit; -($stdout, $stderr, $exit) =3D $ssh->cmd("chmod +x /test.sh"); +diag "Exit Code: $?"; +($stdout, $stderr) =3D $ssh->capture2("chmod +x /test.sh"); diag $stdout; diag $stderr; -diag $exit; -($stdout, $stderr, $exit) =3D $ssh->cmd("cat /test.sh"); +diag "Exit Code: $?"; +($stdout, $stderr) =3D $ssh->capture2("cat /test.sh"); diag $stdout; diag $stderr; -diag $exit; +diag "Exit Code: $?"; diag "running ip spoof"; -($stdout, $stderr, $exit) =3D $ssh->cmd("/test.sh"); +($stdout, $stderr) =3D $ssh->capture2("/test.sh"); diag $stdout; diag $stderr; -diag $exit; +diag "Exit Code: $?"; diag "checking result"; ok($stdout =3D~ "100% packet loss", "packet loss expected"); =20 diff --git a/scripts/nwfilter/230-no-mac-broadcast.t b/scripts/nwfilter/230= -no-mac-broadcast.t index 9d00dc4..70c1ab4 100644 --- a/scripts/nwfilter/230-no-mac-broadcast.t +++ b/scripts/nwfilter/230-no-mac-broadcast.t @@ -31,7 +31,7 @@ use Test::More tests =3D> 4; use Sys::Virt::TCK; use Sys::Virt::TCK::NetworkHelpers; use Test::Exception; -use Net::SSH::Perl; +use Net::OpenSSH; use File::Spec::Functions qw(catfile catdir rootdir); =20 my $tck =3D Sys::Virt::TCK->new(); @@ -85,9 +85,10 @@ diag "prepare tcpdump"; system("/usr/sbin/tcpdump -v -i virbr0 -n host 255.255.255.255 2> /tmp/tcp= dump.log &"); =20 # log into guest -my $ssh =3D Net::SSH::Perl->new($guestip); diag "ssh'ing into $guestip"; -$ssh->login("root", $tck->root_password()); +my $ssh =3D Net::OpenSSH->new($guestip, + user =3D> "root", + password =3D> $tck->root_password()); =20 # now generate a mac broadcast paket=20 diag "generate mac broadcast"; @@ -95,22 +96,22 @@ my $cmdfile =3D < /test.sh EOF diag $cmdfile; -my ($stdout, $stderr, $exit) =3D $ssh->cmd($cmdfile); +my ($stdout, $stderr) =3D $ssh->capture2($cmdfile); diag $stdout; diag $stderr; -diag $exit; -($stdout, $stderr, $exit) =3D $ssh->cmd("chmod +x /test.sh"); +diag "Exit Code: $?"; +($stdout, $stderr) =3D $ssh->capture2("chmod +x /test.sh"); diag $stdout; diag $stderr; -diag $exit; -($stdout, $stderr, $exit) =3D $ssh->cmd("/test.sh > /test.log"); +diag "Exit Code: $?"; +($stdout, $stderr) =3D $ssh->capture2("/test.sh > /test.log"); diag $stdout; diag $stderr; -diag $exit; -($stdout, $stderr, $exit) =3D $ssh->cmd("cat /test.log"); +diag "Exit Code: $?"; +($stdout, $stderr) =3D $ssh->capture2("cat /test.log"); diag $stdout; diag $stderr; -diag $exit; +diag "Exit Code: $?"; =20 # now stop tcpdump and verify result diag "stopping tcpdump"; diff --git a/scripts/nwfilter/240-no-arp-spoofing.t b/scripts/nwfilter/240-= no-arp-spoofing.t index f1e6870..141fb92 100644 --- a/scripts/nwfilter/240-no-arp-spoofing.t +++ b/scripts/nwfilter/240-no-arp-spoofing.t @@ -31,7 +31,7 @@ use Test::More tests =3D> 4; use Sys::Virt::TCK; use Sys::Virt::TCK::NetworkHelpers; use Test::Exception; -use Net::SSH::Perl; +use Net::OpenSSH; use File::Spec::Functions qw(catfile catdir rootdir); =20 my $spoofid =3D "192.168.122.183"; @@ -85,9 +85,10 @@ diag "prepare tcpdump"; system("/usr/sbin/tcpdump -v -i virbr0 not ip > /tmp/tcpdump.log &"); =20 # log into guest -my $ssh =3D Net::SSH::Perl->new($guestip); diag "ssh'ing into $guestip"; -$ssh->login("root", $tck->root_password()); +my $ssh =3D Net::OpenSSH->new($guestip, + user =3D> "root", + password =3D> $tck->root_password()); =20 # now generate a arp spoofing packets=20 diag "generate arpspoof"; @@ -100,23 +101,23 @@ EOF diag "content of cmdfile:"; diag $cmdfile; diag "creating cmdfile"; -my ($stdout, $stderr, $exit) =3D $ssh->cmd($cmdfile); +my ($stdout, $stderr) =3D $ssh->capture2($cmdfile); diag $stdout; diag $stderr; -diag $exit; -($stdout, $stderr, $exit) =3D $ssh->cmd("chmod +x /test.sh"); +diag "Exit Code: $?"; +($stdout, $stderr) =3D $ssh->capture2("chmod +x /test.sh"); diag $stdout; diag $stderr; -diag $exit; +diag "Exit Code: $?"; diag "excuting cmdfile"; -($stdout, $stderr, $exit) =3D $ssh->cmd("/test.sh > /test.log"); +($stdout, $stderr) =3D $ssh->capture2("/test.sh > /test.log"); diag $stdout; diag $stderr; -diag $exit; -($stdout, $stderr, $exit) =3D $ssh->cmd("echo test.log\ncat /test.log"); +diag "Exit Code: $?"; +($stdout, $stderr) =3D $ssh->capture2("echo test.log\ncat /test.log"); diag $stdout; diag $stderr; -diag $exit; +diag "Exit Code: $?"; =20 # now stop tcpdump and verify result diag "stopping tcpdump"; diff --git a/scripts/nwfilter/300-vsitype.t b/scripts/nwfilter/300-vsitype.t index 430618f..d169339 100644 --- a/scripts/nwfilter/300-vsitype.t +++ b/scripts/nwfilter/300-vsitype.t @@ -31,7 +31,6 @@ use Test::More; use Sys::Virt::TCK; use Sys::Virt::TCK::NetworkHelpers; use Test::Exception; -use Net::SSH::Perl; use File::Spec::Functions qw(catfile catdir rootdir); =20 my $tck =3D Sys::Virt::TCK->new(); --=20 2.13.6 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Sat May 4 04:50:35 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) client-ip=209.132.183.28; envelope-from=libvir-list-bounces@redhat.com; helo=mx1.redhat.com; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 1518055510805453.26897122954347; Wed, 7 Feb 2018 18:05:10 -0800 (PST) Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 87AF080478; Thu, 8 Feb 2018 02:05:09 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.20]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 32EA46445E; Thu, 8 Feb 2018 02:05:09 +0000 (UTC) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by colo-mx.corp.redhat.com (Postfix) with ESMTP id 55D5E18033DD; Thu, 8 Feb 2018 02:05:07 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.rdu2.redhat.com [10.11.54.6]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id w182567Z023209 for ; Wed, 7 Feb 2018 21:05:06 -0500 Received: by smtp.corp.redhat.com (Postfix) id 273222166BB3; Thu, 8 Feb 2018 02:05:06 +0000 (UTC) Received: from tlap.laine.org.com (ovpn-120-186.rdu2.redhat.com [10.10.120.186]) by smtp.corp.redhat.com (Postfix) with ESMTP id EE7832156A32; Thu, 8 Feb 2018 02:05:05 +0000 (UTC) From: Laine Stump To: libvir-list@redhat.com Date: Wed, 7 Feb 2018 21:04:54 -0500 Message-Id: <20180208020459.16928-5-laine@laine.org> In-Reply-To: <20180208020459.16928-1-laine@laine.org> References: <20180208020459.16928-1-laine@laine.org> X-Scanned-By: MIMEDefang 2.78 on 10.11.54.6 X-loop: libvir-list@redhat.com Subject: [libvirt] [tck PATCH 4/9] Fix no-ip-spoofing test script generation X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.28]); Thu, 08 Feb 2018 02:05:09 +0000 (UTC) X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" The setting of the environment variable MASK was for some reason producing "8" instead of "24". Changing from using back-ticks "`" that resolved at the time the script was created, to using $(blah) resolved when the script is *run* magically fixed the problem. Note that this doesn't change the outcome of the test at all, since the guest never needs to connect outside the local subnet, and is immediately halted after setting the IP using $MASK. It just bothered me that the value was incorrect (and that backticks were being used, when $() is more portable - again it is duly noted that portability doesn't matter in this case, since we know that the script will always be executed on Fedora with bash). Reviewed-by: Daniel P. Berrange --- scripts/nwfilter/220-no-ip-spoofing.t | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/scripts/nwfilter/220-no-ip-spoofing.t b/scripts/nwfilter/220-n= o-ip-spoofing.t index 872dcc3..5903961 100644 --- a/scripts/nwfilter/220-no-ip-spoofing.t +++ b/scripts/nwfilter/220-no-ip-spoofing.t @@ -79,9 +79,10 @@ my $ssh =3D Net::OpenSSH->new($guestip, # now bring eth0 down, change IP and bring it up again diag "preparing ip spoof"; my $cmdfile =3D < Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 1518055528086471.70142493966193; Wed, 7 Feb 2018 18:05:28 -0800 (PST) Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 37FA028211; Thu, 8 Feb 2018 02:05:27 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.20]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 147996049C; Thu, 8 Feb 2018 02:05:27 +0000 (UTC) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by colo-mx.corp.redhat.com (Postfix) with ESMTP id D68E518033E1; Thu, 8 Feb 2018 02:05:26 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.rdu2.redhat.com [10.11.54.6]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id w18255i3023195 for ; Wed, 7 Feb 2018 21:05:06 -0500 Received: by smtp.corp.redhat.com (Postfix) id 604872166BD6; Thu, 8 Feb 2018 02:05:06 +0000 (UTC) Received: from tlap.laine.org.com (ovpn-120-186.rdu2.redhat.com [10.10.120.186]) by smtp.corp.redhat.com (Postfix) with ESMTP id 379412166BDA; Thu, 8 Feb 2018 02:05:06 +0000 (UTC) From: Laine Stump To: libvir-list@redhat.com Date: Wed, 7 Feb 2018 21:04:55 -0500 Message-Id: <20180208020459.16928-6-laine@laine.org> In-Reply-To: <20180208020459.16928-1-laine@laine.org> References: <20180208020459.16928-1-laine@laine.org> X-Scanned-By: MIMEDefang 2.78 on 10.11.54.6 X-loop: libvir-list@redhat.com Subject: [libvirt] [tck PATCH 5/9] Fix no-arp-spoof test script generation X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.30]); Thu, 08 Feb 2018 02:05:27 +0000 (UTC) X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" I'm not sure if or how this ever worked before - what is supposed to happen is that the shell script in $cmdfile is put into the file /test.sh on the guest, then /test.sh is executed. But the code was instead trying to directly execute the text of the entire script as a single command and write the generated output to /test.sh, then execute that. putting echo " ..... " around the whole thing fixed it. Reviewed-by: Daniel P. Berrange --- scripts/nwfilter/240-no-arp-spoofing.t | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/scripts/nwfilter/240-no-arp-spoofing.t b/scripts/nwfilter/240-= no-arp-spoofing.t index 141fb92..45f790a 100644 --- a/scripts/nwfilter/240-no-arp-spoofing.t +++ b/scripts/nwfilter/240-no-arp-spoofing.t @@ -91,11 +91,11 @@ my $ssh =3D Net::OpenSSH->new($guestip, password =3D> $tck->root_password()); =20 # now generate a arp spoofing packets=20 -diag "generate arpspoof"; +diag "generate arpspoof script"; my $cmdfile =3D < /test.sh +kill -15 `/sbin/pidof arpspoof`" > /test.sh EOF =20 diag "content of cmdfile:"; --=20 2.13.6 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Sat May 4 04:50:35 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) client-ip=209.132.183.28; envelope-from=libvir-list-bounces@redhat.com; helo=mx1.redhat.com; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 1518055527680798.6439602545272; Wed, 7 Feb 2018 18:05:27 -0800 (PST) Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id DBFF21752D8; Thu, 8 Feb 2018 02:05:26 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.21]) by smtp.corp.redhat.com (Postfix) with ESMTPS id B6AC160C89; Thu, 8 Feb 2018 02:05:26 +0000 (UTC) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by colo-mx.corp.redhat.com (Postfix) with ESMTP id 83ECC4A472; Thu, 8 Feb 2018 02:05:26 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.rdu2.redhat.com [10.11.54.6]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id w18256ca023219 for ; Wed, 7 Feb 2018 21:05:06 -0500 Received: by smtp.corp.redhat.com (Postfix) id 969A12166BD6; Thu, 8 Feb 2018 02:05:06 +0000 (UTC) Received: from tlap.laine.org.com (ovpn-120-186.rdu2.redhat.com [10.10.120.186]) by smtp.corp.redhat.com (Postfix) with ESMTP id 6EE412166BB3; Thu, 8 Feb 2018 02:05:06 +0000 (UTC) From: Laine Stump To: libvir-list@redhat.com Date: Wed, 7 Feb 2018 21:04:56 -0500 Message-Id: <20180208020459.16928-7-laine@laine.org> In-Reply-To: <20180208020459.16928-1-laine@laine.org> References: <20180208020459.16928-1-laine@laine.org> X-Scanned-By: MIMEDefang 2.78 on 10.11.54.6 X-loop: libvir-list@redhat.com Subject: [libvirt] [tck PATCH 6/9] parameterize filterref in generic_domain X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.38]); Thu, 08 Feb 2018 02:05:27 +0000 (UTC) X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" ...and set it properly in all the nwfilter tests (it's irrelevant for the others). 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). --- lib/Sys/Virt/TCK.pm | 9 ++++++--- scripts/nwfilter/100-ping-still-working.t | 3 ++- scripts/nwfilter/210-no-mac-spoofing.t | 3 ++- scripts/nwfilter/220-no-ip-spoofing.t | 3 ++- scripts/nwfilter/230-no-mac-broadcast.t | 3 ++- scripts/nwfilter/240-no-arp-spoofing.t | 3 ++- 6 files changed, 16 insertions(+), 8 deletions(-) diff --git a/lib/Sys/Virt/TCK.pm b/lib/Sys/Virt/TCK.pm index ce8e81b..2259042 100644 --- a/lib/Sys/Virt/TCK.pm +++ b/lib/Sys/Virt/TCK.pm @@ -766,6 +766,7 @@ sub generic_machine_domain { my $caps =3D exists $params{caps} ? $params{caps} : die "caps paramete= r is required"; my $ostype =3D exists $params{ostype} ? $params{ostype} : "hvm"; my $fullos =3D exists $params{fullos} ? $params{fullos} : 0; + my $filterref =3D exists $params{filterref} ? $params{filterref} : und= ef; =20 if ($fullos) { my %config =3D $self->get_image($caps, $ostype); @@ -792,7 +793,7 @@ sub generic_machine_domain { source =3D> "default", model =3D> "virtio", mac =3D> "52:54:00:11:11:11", - filterref =3D> "clean-traffic"); + filterref =3D> $filterref); my $xml =3D $b->as_xml(); # Cleanup the temporary interface $b->rminterface(); @@ -896,6 +897,7 @@ sub generic_domain { my $ostype =3D exists $params{ostype} ? $params{ostype} : "hvm"; my $fullos =3D exists $params{fullos} ? $params{fullos} : 0; my $netmode =3D exists $params{netmode} ? $params{netmode} : undef; + my $filterref =3D exists $params{filterref} ? $params{filterref} : und= ef; =20 my $caps =3D Sys::Virt::TCK::Capabilities->new(xml =3D> $self->conn->g= et_capabilities); =20 @@ -915,7 +917,8 @@ sub generic_domain { $b =3D $self->generic_machine_domain(name =3D> $name, caps =3D> $caps, ostype =3D> $ostype, - fullos =3D> $fullos); + fullos =3D> $fullos, + filterref =3D> $filterref); } if ($netmode) { if ($netmode eq "vepa") { @@ -931,7 +934,7 @@ sub generic_domain { source =3D> "default", model =3D> "virtio", mac =3D> "52:54:00:11:11:11", - filterref =3D> "clean-traffic"); + filterref =3D> $filterref); } } return $b; diff --git a/scripts/nwfilter/100-ping-still-working.t b/scripts/nwfilter/1= 00-ping-still-working.t index 5afc6a6..1bbd7c5 100644 --- a/scripts/nwfilter/100-ping-still-working.t +++ b/scripts/nwfilter/100-ping-still-working.t @@ -44,7 +44,8 @@ END { =20 # create first domain and start it my $xml =3D $tck->generic_domain(name =3D> "tck", fullos =3D> 1, - netmode =3D> "network")->as_xml(); + netmode =3D> "network", + filterref =3D> "clean-traffic")->as_xml(); =20 my $dom; ok_domain(sub { $dom =3D $conn->define_domain($xml) }, "created persistent= domain object"); diff --git a/scripts/nwfilter/210-no-mac-spoofing.t b/scripts/nwfilter/210-= no-mac-spoofing.t index eb01d13..b4a4990 100644 --- a/scripts/nwfilter/210-no-mac-spoofing.t +++ b/scripts/nwfilter/210-no-mac-spoofing.t @@ -44,7 +44,8 @@ END { =20 # create first domain and start it my $xml =3D $tck->generic_domain(name =3D> "tck", fullos =3D> 1, - netmode =3D> "network")->as_xml(); + netmode =3D> "network", + filterref =3D> "clean-traffic")->as_xml(); =20 my $dom; ok_domain(sub { $dom =3D $conn->define_domain($xml) }, "created persistent= domain object"); diff --git a/scripts/nwfilter/220-no-ip-spoofing.t b/scripts/nwfilter/220-n= o-ip-spoofing.t index 5903961..f3e4a38 100644 --- a/scripts/nwfilter/220-no-ip-spoofing.t +++ b/scripts/nwfilter/220-no-ip-spoofing.t @@ -44,7 +44,8 @@ END { =20 # create first domain and start it my $xml =3D $tck->generic_domain(name =3D> "tck", fullos =3D> 1, - netmode =3D> "network")->as_xml(); + netmode =3D> "network", + filterref =3D> "clean-traffic")->as_xml(); =20 my $dom; ok_domain(sub { $dom =3D $conn->define_domain($xml) }, "created persistent= domain object"); diff --git a/scripts/nwfilter/230-no-mac-broadcast.t b/scripts/nwfilter/230= -no-mac-broadcast.t index 70c1ab4..292c056 100644 --- a/scripts/nwfilter/230-no-mac-broadcast.t +++ b/scripts/nwfilter/230-no-mac-broadcast.t @@ -43,7 +43,8 @@ END { =20 # create first domain and start it my $xml =3D $tck->generic_domain(name =3D> "tck", fullos =3D> 1, - netmode =3D> "network")->as_xml(); + netmode =3D> "network", + filterref =3D> "no-mac-broadcast")->as_xml(= ); =20 my $dom; ok_domain(sub { $dom =3D $conn->define_domain($xml) }, "created persistent= domain object"); diff --git a/scripts/nwfilter/240-no-arp-spoofing.t b/scripts/nwfilter/240-= no-arp-spoofing.t index 45f790a..33febe9 100644 --- a/scripts/nwfilter/240-no-arp-spoofing.t +++ b/scripts/nwfilter/240-no-arp-spoofing.t @@ -45,7 +45,8 @@ END { =20 # create first domain and start it my $xml =3D $tck->generic_domain(name =3D> "tck", fullos =3D> 1, - netmode =3D> "network")->as_xml(); + netmode =3D> "network", + filterref =3D> "clean-traffic")->as_xml(); =20 my $dom; ok_domain(sub { $dom =3D $conn->define_domain($xml) }, "created persistent= domain object"); --=20 2.13.6 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Sat May 4 04:50:35 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) client-ip=209.132.183.28; envelope-from=libvir-list-bounces@redhat.com; helo=mx1.redhat.com; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 1518055530841681.0459280588503; Wed, 7 Feb 2018 18:05:30 -0800 (PST) Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id E1C8128204; Thu, 8 Feb 2018 02:05:29 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.20]) by smtp.corp.redhat.com (Postfix) with ESMTPS id B4606609CC; Thu, 8 Feb 2018 02:05:29 +0000 (UTC) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by colo-mx.corp.redhat.com (Postfix) with ESMTP id 7048218033E8; Thu, 8 Feb 2018 02:05:29 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.rdu2.redhat.com [10.11.54.6]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id w182560I023220 for ; Wed, 7 Feb 2018 21:05:07 -0500 Received: by smtp.corp.redhat.com (Postfix) id CCDDA2166BB3; Thu, 8 Feb 2018 02:05:06 +0000 (UTC) Received: from tlap.laine.org.com (ovpn-120-186.rdu2.redhat.com [10.10.120.186]) by smtp.corp.redhat.com (Postfix) with ESMTP id A52942166BAE; Thu, 8 Feb 2018 02:05:06 +0000 (UTC) From: Laine Stump To: libvir-list@redhat.com Date: Wed, 7 Feb 2018 21:04:57 -0500 Message-Id: <20180208020459.16928-8-laine@laine.org> In-Reply-To: <20180208020459.16928-1-laine@laine.org> References: <20180208020459.16928-1-laine@laine.org> X-Scanned-By: MIMEDefang 2.78 on 10.11.54.6 X-loop: libvir-list@redhat.com Subject: [libvirt] [tck PATCH 7/9] Fix ebtables check in no-mac-broadcast test X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.30]); Thu, 08 Feb 2018 02:05:30 +0000 (UTC) X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" Once the correct filter is enabled for the no-mac-broadcast test, the original test to validate ebtables rules is no longer correct - it was checking for the presence of the test guest's MAC address in the ebtables output on the host, but the no-mac-broadcast filter doesn't have the guest's MAC address anywhere. This patch changes the code to look for "-d Broadcast -j DROP", which actually is added to ebtables for no-mac-broadcast. Reviewed-by: Daniel P. Berrange --- scripts/nwfilter/230-no-mac-broadcast.t | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/scripts/nwfilter/230-no-mac-broadcast.t b/scripts/nwfilter/230= -no-mac-broadcast.t index 292c056..8895a53 100644 --- a/scripts/nwfilter/230-no-mac-broadcast.t +++ b/scripts/nwfilter/230-no-mac-broadcast.t @@ -74,12 +74,9 @@ diag "ip is $guestip"; =20 # check ebtables entry my $ebtables =3D (-e '/sbin/ebtables') ? '/sbin/ebtables' : '/usr/sbin/ebt= ables'; -my $ebtable =3D `$ebtables -L;$ebtables -t nat -L`; +my $ebtable =3D `$ebtables -t nat -L`; diag $ebtable; -# ebtables shortens :00: to :0: so we need to do that too -$_ =3D $mac; -s/00/0/g; -ok($ebtable =3D~ $_, "check ebtables entry"); +ok($ebtable =3D~ "-d Broadcast -j DROP", "check ebtables entry for \"-d Br= oadcast -j DROP\""); =20 # prepare tcpdump diag "prepare tcpdump"; --=20 2.13.6 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Sat May 4 04:50:35 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) client-ip=209.132.183.28; envelope-from=libvir-list-bounces@redhat.com; helo=mx1.redhat.com; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 1518055533930435.00682852550574; Wed, 7 Feb 2018 18:05:33 -0800 (PST) Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id C2136C0587DF; Thu, 8 Feb 2018 02:05:32 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.21]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 9AAF762672; Thu, 8 Feb 2018 02:05:32 +0000 (UTC) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by colo-mx.corp.redhat.com (Postfix) with ESMTP id 632B74A477; Thu, 8 Feb 2018 02:05:32 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.rdu2.redhat.com [10.11.54.6]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id w182567b023209 for ; Wed, 7 Feb 2018 21:05:07 -0500 Received: by smtp.corp.redhat.com (Postfix) id 0ECD12166BB6; Thu, 8 Feb 2018 02:05:07 +0000 (UTC) Received: from tlap.laine.org.com (ovpn-120-186.rdu2.redhat.com [10.10.120.186]) by smtp.corp.redhat.com (Postfix) with ESMTP id DC2E22156A30; Thu, 8 Feb 2018 02:05:06 +0000 (UTC) From: Laine Stump To: libvir-list@redhat.com Date: Wed, 7 Feb 2018 21:04:58 -0500 Message-Id: <20180208020459.16928-9-laine@laine.org> In-Reply-To: <20180208020459.16928-1-laine@laine.org> References: <20180208020459.16928-1-laine@laine.org> X-Scanned-By: MIMEDefang 2.78 on 10.11.54.6 X-loop: libvir-list@redhat.com Subject: [libvirt] [tck PATCH 8/9] filter for proper IP address in tcpdump looking for broadcast packet X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.32]); Thu, 08 Feb 2018 02:05:33 +0000 (UTC) X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" In the no-mac-broadcast test, a ping is sent to 192.168.122.255, but tcpdump is set to look for packets with a destination IP of 255.255.255.255. Change it to check for the correct IP address and also for mac broadcast (which is what the no-mac-broadcast filter actually looks at). This should eliminate the "false success" that was happening because tcpdump wasn't actually seeing the broadcast packet the guest was sending, as well as catching the "false failure" caused by tcpdump seeing other traffic from the guest unrelated to the test (which happened to be broadcasts sent to 255.255.255.255). --- scripts/nwfilter/230-no-mac-broadcast.t | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/nwfilter/230-no-mac-broadcast.t b/scripts/nwfilter/230= -no-mac-broadcast.t index 8895a53..f05a9c2 100644 --- a/scripts/nwfilter/230-no-mac-broadcast.t +++ b/scripts/nwfilter/230-no-mac-broadcast.t @@ -80,7 +80,7 @@ ok($ebtable =3D~ "-d Broadcast -j DROP", "check ebtables = entry for \"-d Broadcast =20 # prepare tcpdump diag "prepare tcpdump"; -system("/usr/sbin/tcpdump -v -i virbr0 -n host 255.255.255.255 2> /tmp/tcp= dump.log &"); +system("/usr/sbin/tcpdump -v -i virbr0 -n host 192.168.122.255 and ether h= ost ff:ff:ff:ff:ff:ff 2> /tmp/tcpdump.log &"); =20 # log into guest diag "ssh'ing into $guestip"; --=20 2.13.6 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Sat May 4 04:50:35 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) client-ip=209.132.183.28; envelope-from=libvir-list-bounces@redhat.com; helo=mx1.redhat.com; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 1518055531535584.2360134677958; Wed, 7 Feb 2018 18:05:31 -0800 (PST) Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 485F719CBB1; Thu, 8 Feb 2018 02:05:30 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.21]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 2543B649A2; Thu, 8 Feb 2018 02:05:30 +0000 (UTC) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by colo-mx.corp.redhat.com (Postfix) with ESMTP id C98F54A470; Thu, 8 Feb 2018 02:05:29 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.rdu2.redhat.com [10.11.54.6]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id w18257eP023237 for ; Wed, 7 Feb 2018 21:05:07 -0500 Received: by smtp.corp.redhat.com (Postfix) id 43C612166BDA; Thu, 8 Feb 2018 02:05:07 +0000 (UTC) Received: from tlap.laine.org.com (ovpn-120-186.rdu2.redhat.com [10.10.120.186]) by smtp.corp.redhat.com (Postfix) with ESMTP id 1D4EB2166BB3; Thu, 8 Feb 2018 02:05:07 +0000 (UTC) From: Laine Stump To: libvir-list@redhat.com Date: Wed, 7 Feb 2018 21:04:59 -0500 Message-Id: <20180208020459.16928-10-laine@laine.org> In-Reply-To: <20180208020459.16928-1-laine@laine.org> References: <20180208020459.16928-1-laine@laine.org> X-Scanned-By: MIMEDefang 2.78 on 10.11.54.6 X-loop: libvir-list@redhat.com Subject: [libvirt] [tck PATCH 9/9] Eliminate unnecessary path specifications in binary names X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.29]); Thu, 08 Feb 2018 02:05:30 +0000 (UTC) X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" The root account in the Fedora image used for the tests has a properly specified path, so the extra verbiage just clutters up the screen. Reviewed-by: Daniel P. Berrange --- scripts/nwfilter/210-no-mac-spoofing.t | 20 ++++++++++---------- scripts/nwfilter/220-no-ip-spoofing.t | 26 +++++++++++++------------- scripts/nwfilter/230-no-mac-broadcast.t | 2 +- scripts/nwfilter/240-no-arp-spoofing.t | 6 +++--- 4 files changed, 27 insertions(+), 27 deletions(-) diff --git a/scripts/nwfilter/210-no-mac-spoofing.t b/scripts/nwfilter/210-= no-mac-spoofing.t index b4a4990..3438f4a 100644 --- a/scripts/nwfilter/210-no-mac-spoofing.t +++ b/scripts/nwfilter/210-no-mac-spoofing.t @@ -98,16 +98,16 @@ my $ssh =3D Net::OpenSSH->new($guestip, diag "fiddling with mac"; my $cmdfile =3D <&1 -/sbin/ip link set \\\$DEV down -/sbin/ip link set \\\$DEV address ${mac} -/sbin/ip link set \\\$DEV up -/sbin/ip addr show dev \\\$DEV" > /test.sh +ip addr show dev \\\$DEV +ip link set \\\$DEV down +ip link set \\\$DEV address ${macfalse} +ip link set \\\$DEV up +ip addr show dev \\\$DEV +ping -c 10 ${gateway} 2>&1 +ip link set \\\$DEV down +ip link set \\\$DEV address ${mac} +ip link set \\\$DEV up +ip addr show dev \\\$DEV" > /test.sh EOF diag $cmdfile; my ($stdout, $stderr) =3D $ssh->capture2($cmdfile); diff --git a/scripts/nwfilter/220-no-ip-spoofing.t b/scripts/nwfilter/220-n= o-ip-spoofing.t index f3e4a38..9e1bb70 100644 --- a/scripts/nwfilter/220-no-ip-spoofing.t +++ b/scripts/nwfilter/220-no-ip-spoofing.t @@ -82,20 +82,20 @@ diag "preparing ip spoof"; my $cmdfile =3D < /test.sh +ip link set \\\$DEV down +ip addr flush dev \\\$DEV +ip addr add 192.168.122.183/\\\$MASK dev \\\$DEV +ip link set \\\$DEV up +ip addr show \\\$DEV +sleep 1 +ping -c 1 192.168.122.1 +ip link set \\\$DEV down +ip addr flush dev \\\$DEV +ip addr add ${guestip}/\\\$MASK dev \\\$DEV +ip link set \\\$DEV up +ip addr show \\\$DEV" > /test.sh EOF diag $cmdfile; my ($stdout, $stderr) =3D $ssh->capture2($cmdfile); diff --git a/scripts/nwfilter/230-no-mac-broadcast.t b/scripts/nwfilter/230= -no-mac-broadcast.t index f05a9c2..758005c 100644 --- a/scripts/nwfilter/230-no-mac-broadcast.t +++ b/scripts/nwfilter/230-no-mac-broadcast.t @@ -91,7 +91,7 @@ my $ssh =3D Net::OpenSSH->new($guestip, # now generate a mac broadcast paket=20 diag "generate mac broadcast"; my $cmdfile =3D < /test.sh +echo 'ping -c 1 192.168.122.255 -b' > /test.sh EOF diag $cmdfile; my ($stdout, $stderr) =3D $ssh->capture2($cmdfile); diff --git a/scripts/nwfilter/240-no-arp-spoofing.t b/scripts/nwfilter/240-= no-arp-spoofing.t index 33febe9..dfc8e08 100644 --- a/scripts/nwfilter/240-no-arp-spoofing.t +++ b/scripts/nwfilter/240-no-arp-spoofing.t @@ -94,9 +94,9 @@ my $ssh =3D Net::OpenSSH->new($guestip, # now generate a arp spoofing packets=20 diag "generate arpspoof script"; my $cmdfile =3D < /test.sh +echo "arpspoof ${spoofid} & +sleep 10 +kill -15 \\\$(pidof arpspoof)" > /test.sh EOF =20 diag "content of cmdfile:"; --=20 2.13.6 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list