1
0
mirror of https://passt.top/passt synced 2024-06-27 13:32:41 +00:00

Tweak dhclient arguments for readability

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@gibson.dropbear.id.au>
This commit is contained in:
David Gibson 2022-06-10 12:32:43 +10:00 committed by Stefano Brivio
parent 2320ac3349
commit ca0c33ae5b
10 changed files with 17 additions and 17 deletions

View File

@ -484,7 +484,7 @@ udhcpc: started, v1.30.1
udhcpc: sending discover udhcpc: sending discover
udhcpc: sending select for 192.168.1.118 udhcpc: sending select for 192.168.1.118
udhcpc: lease of 192.168.1.118 obtained, lease time 4294967295 udhcpc: lease of 192.168.1.118 obtained, lease time 4294967295
# dhclient -6 # dhclient -6 --no-pid
# ip address show # ip address show
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN group default qlen 1000 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 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 discover
udhcpc: sending select for 192.168.1.118 udhcpc: sending select for 192.168.1.118
udhcpc: lease of 192.168.1.118 obtained, lease time 4294967295 udhcpc: lease of 192.168.1.118 obtained, lease time 4294967295
# dhclient -6 # dhclient -6 --no-pid
# ip address show # ip address show
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN group default qlen 1000 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 link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00

View File

@ -73,9 +73,9 @@ sleep 3
passt cd __TEMPDIR__/passt passt cd __TEMPDIR__/passt
passtb ./pasta passtb ./pasta
sleep 3 sleep 3
passt /sbin/dhclient passt /sbin/dhclient -4 --no-pid
sleep 2 sleep 2
passt /sbin/dhclient -6 passt /sbin/dhclient -6 --no-pid
sleep 2 sleep 2
nl nl
@ -112,7 +112,7 @@ guest ip link show
sleep 3 sleep 3
say Guest is up. Let's configure IPv4 first... say Guest is up. Let's configure IPv4 first...
sleep 2 sleep 2
guest dhclient guest dhclient -4
sleep 2 sleep 2
guest ip addr show guest ip addr show
sleep 5 sleep 5

View File

@ -77,7 +77,7 @@ ns ip link show
sleep 3 sleep 3
say Let's configure IPv4 first... say Let's configure IPv4 first...
sleep 2 sleep 2
ns dhclient ns dhclient -4 --no-pid
sleep 2 sleep 2
ns ip addr show ns ip addr show
sleep 5 sleep 5
@ -87,7 +87,7 @@ say SLAAC is already done, but we can also
nl nl
say get another address via DHCPv6. say get another address via DHCPv6.
sleep 3 sleep 3
ns dhclient -6 ns dhclient -6 --no-pid
sleep 3 sleep 3
nl nl
@ -146,7 +146,7 @@ temp TEMP
passtb ./pasta -p __TEMP__.pcap passtb ./pasta -p __TEMP__.pcap
sleep 2 sleep 2
passt passt
passt /sbin/dhclient passt /sbin/dhclient -4 --no-pid
sleep 2 sleep 2
hostb tshark -r __TEMP__.pcap hostb tshark -r __TEMP__.pcap
sleep 5 sleep 5

View File

@ -21,7 +21,7 @@ hout HOST_IFNAME ip -j -4 route show|jq -rM '.[] | select(.dst == "default").dev
check [ -n "__IFNAME__" ] check [ -n "__IFNAME__" ]
test DHCP: address 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' 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' hout HOST_ADDR ip -j -4 addr show|jq -rM '.[] | select(.ifname == "__HOST_IFNAME__").addr_info[0].local'
check [ "__ADDR__" = "__HOST_ADDR__" ] check [ "__ADDR__" = "__HOST_ADDR__" ]

View File

@ -35,7 +35,7 @@ nsout MTU ip -j link show | jq -rM '.[] | select(.ifname == "__IFNAME__").mtu'
check [ __MTU__ = 65520 ] check [ __MTU__ = 65520 ]
test DHCPv6: address 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' 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' hout HOST_ADDR6 ip -j -6 addr show|jq -rM '.[] | select(.ifname == "__IFNAME__").addr_info[] | select(.scope == "global").local'
check [ __ADDR6__ = __HOST_ADDR6__ ] check [ __ADDR6__ = __HOST_ADDR6__ ]

View File

@ -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 ./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 PS1='$ '
host dhclient host dhclient -4
# Skip apt-get update here: some updates to xenial-updates around 2022-01-30 # 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 # broke dependencies for libc6 and gcc-5 -- note that powerpc is not officially
# supported on this version # 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 service systemd-resolved stop
host export DEBIAN_FRONTEND=noninteractive host export DEBIAN_FRONTEND=noninteractive
host apt-get -y remove needrestart snapd host apt-get -y remove needrestart snapd
host dhclient host dhclient -4
sleep 2 sleep 2
host apt-get update host apt-get update
host apt-get -y install make gcc netcat-openbsd host apt-get -y install make gcc netcat-openbsd

View File

@ -147,7 +147,7 @@ setup_passt_in_ns() {
pane_run NS "/sbin/udhcpc -i ${__ifname}" pane_run NS "/sbin/udhcpc -i ${__ifname}"
pane_status NS pane_status NS
sleep 2 sleep 2
pane_run NS "/sbin/dhclient -6 ${__ifname}" pane_run NS "/sbin/dhclient -6 --no-pid ${__ifname}"
pane_status NS pane_status NS
__opts= __opts=

View File

@ -18,7 +18,7 @@ htools bc head sed seq
# In this setup, virtio_net TX queue sometimes hangs, still under investigation # In this setup, virtio_net TX queue sometimes hangs, still under investigation
def virtio_net_workaround 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 endef
test passt: throughput and latency test passt: throughput and latency

View File

@ -18,7 +18,7 @@ htools bc head sed
# In this setup, virtio_net TX queue sometimes hangs, still under investigation # In this setup, virtio_net TX queue sometimes hangs, still under investigation
def virtio_net_workaround 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 endef
test passt: throughput and latency test passt: throughput and latency

View File

@ -23,8 +23,8 @@ check [ -n "__IFNAME1__" ]
check [ -n "__IFNAME2__" ] check [ -n "__IFNAME2__" ]
test DHCP: addresses test DHCP: addresses
guest1 /sbin/dhclient __IFNAME1__ guest1 /sbin/dhclient -4 __IFNAME1__
guest2 /sbin/dhclient __IFNAME1__ guest2 /sbin/dhclient -4 __IFNAME1__
g1out ADDR1 ip -j -4 addr show|jq -rM '.[] | select(.ifname == "__IFNAME1__").addr_info[0].local' 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' 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' hout HOST_ADDR ip -j -4 addr show|jq -rM '.[] | select(.ifname == "__HOST_IFNAME__").addr_info[0].local'