Use dhclient instead of udhcpc

For some reason, the passt/pasta tests and examples use dhclient for
DHCPv6, but in most cases use udhcpc for DHCPv4.  Change it to use dhclient
for both DHCPv4 and DHCPv6.  This means one less tool we need for testing,
plus dhclient is easily available on Fedora whereas udhcpc is not.

Note that the passt tests still rely on udhcpc indirectly because mbuto
wants to put it into the guest images it generates.

Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
This commit is contained in:
David Gibson 2022-06-10 12:32:44 +10:00 committed by Stefano Brivio
parent ca0c33ae5b
commit e48373382f
4 changed files with 8 additions and 16 deletions

12
passt.1
View file

@ -479,11 +479,7 @@ NDP/DHCPv6:
assign: 2a02:6d40:3ca5:2001:b81d:fa4a:8cdd:cf17 assign: 2a02:6d40:3ca5:2001:b81d:fa4a:8cdd:cf17
router: fe80::62e3:27ff:fe33:2b01 router: fe80::62e3:27ff:fe33:2b01
# #
# udhcpc -i eth0 # dhclient -4 --no-pid
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 --no-pid # 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
@ -576,11 +572,7 @@ NDP/DHCPv6:
.fi .fi
.BR " [Back to the original terminal]" .BR " [Back to the original terminal]"
.nf .nf
# udhcpc -i eth0 # dhclient -4 --no-pid
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 --no-pid # 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

View file

@ -29,7 +29,7 @@ on a system, i.e. common utilities such as a shell are not included here.
Example for Debian, and possibly most Debian-based distributions: Example for Debian, and possibly most Debian-based distributions:
build-essential git jq strace iperf3 qemu-system-x86 tmux sipcalc bc build-essential git jq strace iperf3 qemu-system-x86 tmux sipcalc bc
clang-tidy cppcheck isc-dhcp-common udhcpc psmisc linux-cpupower clang-tidy cppcheck isc-dhcp-common psmisc linux-cpupower
netcat-openbsd fakeroot lz4 lm-sensors qemu-system-arm qemu-system-ppc netcat-openbsd fakeroot lz4 lm-sensors qemu-system-arm qemu-system-ppc
qemu-system-misc qemu-system-x86 valgrind qemu-system-misc qemu-system-x86 valgrind

View file

@ -12,7 +12,7 @@
# Author: Stefano Brivio <sbrivio@redhat.com> # Author: Stefano Brivio <sbrivio@redhat.com>
onlyfor pasta onlyfor pasta
nstools ip jq /sbin/udhcpc /sbin/dhclient nstools ip jq /sbin/dhclient
htools ip jq htools ip jq
test Interface name test Interface name
@ -20,7 +20,7 @@ nsout IFNAME ip -j link show | jq -rM '.[] | select(.link_type == "ether").ifnam
check [ -n "__IFNAME__" ] check [ -n "__IFNAME__" ]
test DHCP: address test DHCP: address
ns /sbin/udhcpc -i __IFNAME__ ns /sbin/dhclient -4 --no-pid __IFNAME__
nsout ADDR ip -j -4 addr show|jq -rM '.[] | select(.ifname == "__IFNAME__").addr_info[0].local' nsout 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 == "__IFNAME__").addr_info[0].local' hout HOST_ADDR ip -j -4 addr show|jq -rM '.[] | select(.ifname == "__IFNAME__").addr_info[0].local'
check [ __ADDR__ = __HOST_ADDR__ ] check [ __ADDR__ = __HOST_ADDR__ ]

View file

@ -144,7 +144,7 @@ setup_passt_in_ns() {
pane_run NS "ip -j link show | jq -rM '.[] | select(.link_type == \"ether\").ifname'" pane_run NS "ip -j link show | jq -rM '.[] | select(.link_type == \"ether\").ifname'"
pane_wait NS pane_wait NS
__ifname="$(pane_parse NS)" __ifname="$(pane_parse NS)"
pane_run NS "/sbin/udhcpc -i ${__ifname}" pane_run NS "/sbin/dhclient -4 --no-pid ${__ifname}"
pane_status NS pane_status NS
sleep 2 sleep 2
pane_run NS "/sbin/dhclient -6 --no-pid ${__ifname}" pane_run NS "/sbin/dhclient -6 --no-pid ${__ifname}"
@ -232,8 +232,8 @@ setup_two_guests() {
pane_wait PASST_1 pane_wait PASST_1
__ifname="$(pane_parse PASST_1)" __ifname="$(pane_parse PASST_1)"
pane_run GUEST_1 "/sbin/udhcpc -i ${__ifname}" pane_run GUEST_1 "/sbin/dhclient -4 ${__ifname}"
pane_run GUEST_2 "/sbin/udhcpc -i ${__ifname}" pane_run GUEST_2 "/sbin/dhclient -4 ${__ifname}"
pane_status GUEST_1 pane_status GUEST_1
pane_status GUEST_2 pane_status GUEST_2
sleep 2 sleep 2