Re: [PATCH tck 1/6] Retrieve ip address from arp instead of leases

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Mon, 2015-10-05 at 17:18 -0600, Mike Latimer wrote:
> Libvirt commit 0f87054b adds the --leasefile-ro option to dnsmasq. This change
> results in the default.leases no longer containing the ip address for the test
> domain. Instead of using the leases file, use arp to provide the ip address.
> 
> Signed-off-by: Mike Latimer <mlatimer@xxxxxxxx>
> ---
>  lib/Sys/Virt/TCK/NetworkHelpers.pm        | 6 +++---
>  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 +-
>  6 files changed, 8 insertions(+), 8 deletions(-)
> 
> diff --git a/lib/Sys/Virt/TCK/NetworkHelpers.pm b/lib/Sys/Virt/TCK/NetworkHelpers.pm
> index 133064b..deda0f3 100644
> --- a/lib/Sys/Virt/TCK/NetworkHelpers.pm
> +++ b/lib/Sys/Virt/TCK/NetworkHelpers.pm
> @@ -9,11 +9,11 @@ sub get_first_macaddress {
>      return $mac;
>  }
>  
> -sub get_ip_from_leases{
> +sub get_ip_from_arp{
>      my $mac = shift;
> -    my $tmp = `grep $mac /var/lib/libvirt/dnsmasq/default.leases`;
> +    my $tmp = `arp -n | grep $mac`;
>      my @fields = split(/ /, $tmp);
> -    my $ip = $fields[2];
> +    my $ip = $fields[0];
>      return $ip;
>  }
>  
> diff --git a/scripts/nwfilter/100-ping-still-working.t b/scripts/nwfilter/100-ping-still-working.t
> index a20b95d..cf03d90 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 = get_first_macaddress($dom);
>  diag "mac is $mac";
>  
> -my $guestip = get_ip_from_leases($mac);
> +my $guestip = get_ip_from_arp($mac);
>  diag "ip is $guestip";
>  
>  # check ebtables entry
> diff --git a/scripts/nwfilter/210-no-mac-spoofing.t b/scripts/nwfilter/210-no-mac-spoofing.t
> index b81fc4a..14c54db 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 =  get_first_macaddress($dom);
>  diag "mac is $mac";
>  
> -my $guestip = get_ip_from_leases($mac);
> +my $guestip = get_ip_from_arp($mac);
>  diag "ip is $guestip";
>  
>  # check ebtables entry
> diff --git a/scripts/nwfilter/220-no-ip-spoofing.t b/scripts/nwfilter/220-no-ip-spoofing.t
> index 3a0213d..1217c52 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 =  get_first_macaddress($dom);
>  diag "mac is $mac";
>  
> -my $guestip = get_ip_from_leases($mac);
> +my $guestip = get_ip_from_arp($mac);
>  diag "ip is $guestip";
>  
>  # check ebtables entry
> diff --git a/scripts/nwfilter/230-no-mac-broadcast.t b/scripts/nwfilter/230-no-mac-broadcast.t
> index 16ce60d..cdf08fe 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 =  get_first_macaddress($dom);
>  diag "mac is $mac";
>  
> -my $guestip = get_ip_from_leases($mac);
> +my $guestip = get_ip_from_arp($mac);
>  diag "ip is $guestip";
>  
>  # check ebtables entry
> diff --git a/scripts/nwfilter/240-no-arp-spoofing.t b/scripts/nwfilter/240-no-arp-spoofing.t
> index 284033d..5590ed5 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 =  get_first_macaddress($dom);
>  diag "mac is $mac";
>  
> -my $guestip = get_ip_from_leases($mac);
> +my $guestip = get_ip_from_arp($mac);
>  diag "ip is $guestip";
>  
>  # check ebtables entry

ACK

--
Cedric

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



[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]