From 2d7668bc019d5e396ac2a629ba96a924301f7f23 Mon Sep 17 00:00:00 2001 From: Ariadne Conill Date: Thu, 3 Sep 2020 16:07:27 -0600 Subject: [PATCH 1/2] dhcp executor: add support for udhcpc-opts property --- executor-scripts/linux/dhcp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/executor-scripts/linux/dhcp b/executor-scripts/linux/dhcp index fa576e7..783f6e1 100755 --- a/executor-scripts/linux/dhcp +++ b/executor-scripts/linux/dhcp @@ -24,7 +24,8 @@ start() { ${MOCK} /usr/sbin/dhclient -pf /var/run/dhclient.$IFACE.pid $IFACE ;; udhcpc) - ${MOCK} /sbin/udhcpc -b -R -p /var/run/udhcpc.$IFACE.pid -i $IFACE + UDHCPC_OPTS=$(eval echo $IF_UDHCPC_OPTS) + ${MOCK} /sbin/udhcpc -b -R -p /var/run/udhcpc.$IFACE.pid -i $IFACE $UDHCPC_OPTS ;; *) ;; From 7edb29778b17ae4bd45ecd3f3736a700c379600d Mon Sep 17 00:00:00 2001 From: Ariadne Conill Date: Thu, 3 Sep 2020 16:11:41 -0600 Subject: [PATCH 2/2] tests: add udhcp-opts related tests --- tests/linux/dhcp_test | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/tests/linux/dhcp_test b/tests/linux/dhcp_test index 3ff884b..c451e74 100755 --- a/tests/linux/dhcp_test +++ b/tests/linux/dhcp_test @@ -3,7 +3,12 @@ . $(atf_get_srcdir)/../test_env.sh EXECUTOR="$(atf_get_srcdir)/../../executor-scripts/linux/dhcp" -tests_init udhcpc_up dhcpcd_up dhcpcd_down dhclient_up +tests_init udhcpc_up \ + dhcpcd_up \ + dhcpcd_down \ + dhclient_up \ + udhcpc_opts_up \ + udhcpc_opts_up_subshell udhcpc_up_body() { export IFACE=eth0 PHASE=up MOCK=echo IF_DHCP_PROGRAM=udhcpc @@ -28,3 +33,15 @@ dhclient_up_body() { atf_check -s exit:0 -o match:'/usr/sbin/dhclient -pf /var/run/dhclient.eth0.pid eth0' \ ${EXECUTOR} } + +udhcpc_opts_up_body() { + export IFACE=eth0 PHASE=up MOCK=echo IF_DHCP_PROGRAM=udhcpc IF_UDHCPC_OPTS="-O search" + atf_check -s exit:0 -o match:'/sbin/udhcpc -b -R -p /var/run/udhcpc.eth0.pid -i eth0 -O search' \ + ${EXECUTOR} +} + +udhcpc_opts_up_subshell_body() { + export IFACE=eth0 PHASE=up MOCK=echo IF_DHCP_PROGRAM=udhcpc IF_UDHCPC_OPTS="-O search -x hostname:\$(echo test)" + atf_check -s exit:0 -o match:'/sbin/udhcpc -b -R -p /var/run/udhcpc.eth0.pid -i eth0 -O search -x hostname:test' \ + ${EXECUTOR} +}