A number of tests and examples use dhclient in both IPv4 and IPv6 modes. We use "dhclient -6" for IPv6, but usually just "dhclient" for IPv4. Add an explicit "-4" argument to make it more clear and explicit. In addition, when dhclient is run from within pasta it usually won't be "real" root, and so will not have access to write the default global pid file. This results in a mostly harmless but irritating error: Can't create /var/run/dhclient.pid: Permission denied We can avoid that by using the --no-pid flag to dhclient. Signed-off-by: David Gibson <david(a)gibson.dropbear.id.au> --- passt.1 | 4 ++-- test/demo/passt | 6 +++--- test/demo/pasta | 6 +++--- test/dhcp/passt | 2 +- test/dhcp/pasta | 2 +- test/distro/ubuntu | 4 ++-- test/lib/setup | 2 +- test/perf/passt_tcp | 2 +- test/perf/passt_udp | 2 +- test/two_guests/basic | 4 ++-- 10 files changed, 17 insertions(+), 17 deletions(-) diff --git a/passt.1 b/passt.1 index d3af916..28704e9 100644 --- a/passt.1 +++ b/passt.1 @@ -484,7 +484,7 @@ udhcpc: started, v1.30.1 udhcpc: sending discover udhcpc: sending select for 192.168.1.118 udhcpc: lease of 192.168.1.118 obtained, lease time 4294967295 -# dhclient -6 +# dhclient -6 --no-pid # ip address show 1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN group default qlen 1000 link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00 @@ -581,7 +581,7 @@ udhcpc: started, v1.30.1 udhcpc: sending discover udhcpc: sending select for 192.168.1.118 udhcpc: lease of 192.168.1.118 obtained, lease time 4294967295 -# dhclient -6 +# dhclient -6 --no-pid # ip address show 1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN group default qlen 1000 link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00 diff --git a/test/demo/passt b/test/demo/passt index d394a08..ee4e7c2 100644 --- a/test/demo/passt +++ b/test/demo/passt @@ -73,9 +73,9 @@ sleep 3 passt cd __TEMPDIR__/passt passtb ./pasta sleep 3 -passt /sbin/dhclient +passt /sbin/dhclient -4 --no-pid sleep 2 -passt /sbin/dhclient -6 +passt /sbin/dhclient -6 --no-pid sleep 2 nl @@ -112,7 +112,7 @@ guest ip link show sleep 3 say Guest is up. Let's configure IPv4 first... sleep 2 -guest dhclient +guest dhclient -4 sleep 2 guest ip addr show sleep 5 diff --git a/test/demo/pasta b/test/demo/pasta index 8b13b5e..e2517ed 100644 --- a/test/demo/pasta +++ b/test/demo/pasta @@ -77,7 +77,7 @@ ns ip link show sleep 3 say Let's configure IPv4 first... sleep 2 -ns dhclient +ns dhclient -4 --no-pid sleep 2 ns ip addr show sleep 5 @@ -87,7 +87,7 @@ say SLAAC is already done, but we can also nl say get another address via DHCPv6. sleep 3 -ns dhclient -6 +ns dhclient -6 --no-pid sleep 3 nl @@ -146,7 +146,7 @@ temp TEMP passtb ./pasta -p __TEMP__.pcap sleep 2 passt -passt /sbin/dhclient +passt /sbin/dhclient -4 --no-pid sleep 2 hostb tshark -r __TEMP__.pcap sleep 5 diff --git a/test/dhcp/passt b/test/dhcp/passt index ca76846..4648821 100644 --- a/test/dhcp/passt +++ b/test/dhcp/passt @@ -21,7 +21,7 @@ hout HOST_IFNAME ip -j -4 route show|jq -rM '.[] | select(.dst == "default").dev check [ -n "__IFNAME__" ] test DHCP: address -guest /sbin/dhclient __IFNAME__ +guest /sbin/dhclient -4 __IFNAME__ gout ADDR ip -j -4 addr show|jq -rM '.[] | select(.ifname == "__IFNAME__").addr_info[0].local' hout HOST_ADDR ip -j -4 addr show|jq -rM '.[] | select(.ifname == "__HOST_IFNAME__").addr_info[0].local' check [ "__ADDR__" = "__HOST_ADDR__" ] diff --git a/test/dhcp/pasta b/test/dhcp/pasta index 77e9e42..e76454a 100644 --- a/test/dhcp/pasta +++ b/test/dhcp/pasta @@ -35,7 +35,7 @@ nsout MTU ip -j link show | jq -rM '.[] | select(.ifname == "__IFNAME__").mtu' check [ __MTU__ = 65520 ] test DHCPv6: address -ns /sbin/dhclient -6 __IFNAME__ +ns /sbin/dhclient -6 --no-pid __IFNAME__ nsout ADDR6 ip -j -6 addr show|jq -rM '.[] | select(.ifname == "__IFNAME__").addr_info[] | select(.prefixlen == 128).local' hout HOST_ADDR6 ip -j -6 addr show|jq -rM '.[] | select(.ifname == "__IFNAME__").addr_info[] | select(.scope == "global").local' check [ __ADDR6__ = __HOST_ADDR6__ ] diff --git a/test/distro/ubuntu b/test/distro/ubuntu index 3ce156d..c9a2b4d 100644 --- a/test/distro/ubuntu +++ b/test/distro/ubuntu @@ -150,7 +150,7 @@ host guestfish --rw -a __IMG__ -i copy-in __GUEST_FILES__ /root/ host ./qrap 5 qemu-system-ppc64 -m 1024 -M pseries -nographic -nodefaults -serial stdio -no-reboot -nographic -vga none -hda __IMG__ -net socket,fd=5 -net nic,model=virtio host PS1='$ ' -host dhclient +host dhclient -4 # Skip apt-get update here: some updates to xenial-updates around 2022-01-30 # broke dependencies for libc6 and gcc-5 -- note that powerpc is not officially # supported on this version @@ -185,7 +185,7 @@ host ./qrap 5 qemu-system-s390x -m 2048 -smp 2 -serial stdio -nodefaults -nograp host service systemd-resolved stop host export DEBIAN_FRONTEND=noninteractive host apt-get -y remove needrestart snapd -host dhclient +host dhclient -4 sleep 2 host apt-get update host apt-get -y install make gcc netcat-openbsd diff --git a/test/lib/setup b/test/lib/setup index ffc4171..32515bf 100755 --- a/test/lib/setup +++ b/test/lib/setup @@ -147,7 +147,7 @@ setup_passt_in_ns() { pane_run NS "/sbin/udhcpc -i ${__ifname}" pane_status NS sleep 2 - pane_run NS "/sbin/dhclient -6 ${__ifname}" + pane_run NS "/sbin/dhclient -6 --no-pid ${__ifname}" pane_status NS __opts= diff --git a/test/perf/passt_tcp b/test/perf/passt_tcp index 5f017db..c97178e 100644 --- a/test/perf/passt_tcp +++ b/test/perf/passt_tcp @@ -18,7 +18,7 @@ htools bc head sed seq # In this setup, virtio_net TX queue sometimes hangs, still under investigation def virtio_net_workaround -guest modprobe -r virtio_net; modprobe virtio_net napi_tx=1; dhclient; dhclient -6; sleep 3 +guest modprobe -r virtio_net; modprobe virtio_net napi_tx=1; dhclient -4; dhclient -6; sleep 3 endef test passt: throughput and latency diff --git a/test/perf/passt_udp b/test/perf/passt_udp index 0515f00..5155099 100644 --- a/test/perf/passt_udp +++ b/test/perf/passt_udp @@ -18,7 +18,7 @@ htools bc head sed # In this setup, virtio_net TX queue sometimes hangs, still under investigation def virtio_net_workaround -guest modprobe -r virtio_net; modprobe virtio_net napi_tx=1; dhclient; dhclient -6; sleep 3 +guest modprobe -r virtio_net; modprobe virtio_net napi_tx=1; dhclient -4; dhclient -6; sleep 3 endef test passt: throughput and latency diff --git a/test/two_guests/basic b/test/two_guests/basic index 09a06da..afe104b 100644 --- a/test/two_guests/basic +++ b/test/two_guests/basic @@ -23,8 +23,8 @@ check [ -n "__IFNAME1__" ] check [ -n "__IFNAME2__" ] test DHCP: addresses -guest1 /sbin/dhclient __IFNAME1__ -guest2 /sbin/dhclient __IFNAME1__ +guest1 /sbin/dhclient -4 __IFNAME1__ +guest2 /sbin/dhclient -4 __IFNAME1__ g1out ADDR1 ip -j -4 addr show|jq -rM '.[] | select(.ifname == "__IFNAME1__").addr_info[0].local' g2out ADDR2 ip -j -4 addr show|jq -rM '.[] | select(.ifname == "__IFNAME2__").addr_info[0].local' hout HOST_ADDR ip -j -4 addr show|jq -rM '.[] | select(.ifname == "__HOST_IFNAME__").addr_info[0].local' -- 2.36.1