[tck PATCH 4/9] Fix no-ip-spoofing test script generation

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

 



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).

---
 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-no-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 = Net::OpenSSH->new($guestip,
 # now bring eth0 down, change IP and bring it up again
 diag "preparing ip spoof";
 my $cmdfile = <<EOF;
-echo "DEV=`ip link | head -3 | tail -1 | awk '{print \\\$2}' | sed -e 's/://'`
-MASK=`ip addr show \\\$DEV | grep 'inet ' | awk '{print \\\$2}' | sed -e 's/.*\\///;q'`
+echo "DEV=\\\$(ip link | head -3 | tail -1 | awk '{print \\\$2}' | sed -e 's/://')
+MASK=\\\$(ip addr show \\\$DEV | grep 'inet ' | awk '{print \\\$2}' | sed -e 's/.*\\///;q')
 /sbin/ip addr show \\\$DEV
+kill \\\$(pidof dhclient)
 /sbin/ip link set \\\$DEV down
 /sbin/ip addr flush dev \\\$DEV
 /sbin/ip addr add 192.168.122.183/\\\$MASK dev \\\$DEV
-- 
2.13.6

--
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]

  Powered by Linux