Merge pull request #55 from ifupdown-ng/feature/udhcpc-opts

add support for udhcpc-opts
This commit is contained in:
Ariadne Conill 2020-09-03 15:15:31 -07:00 committed by GitHub
commit 2311316bfe
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 20 additions and 2 deletions

View file

@ -24,7 +24,8 @@ start() {
${MOCK} /usr/sbin/dhclient -pf /var/run/dhclient.$IFACE.pid $IFACE ${MOCK} /usr/sbin/dhclient -pf /var/run/dhclient.$IFACE.pid $IFACE
;; ;;
udhcpc) 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
;; ;;
*) *)
;; ;;

View file

@ -3,7 +3,12 @@
. $(atf_get_srcdir)/../test_env.sh . $(atf_get_srcdir)/../test_env.sh
EXECUTOR="$(atf_get_srcdir)/../../executor-scripts/linux/dhcp" 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() { udhcpc_up_body() {
export IFACE=eth0 PHASE=up MOCK=echo IF_DHCP_PROGRAM=udhcpc 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' \ atf_check -s exit:0 -o match:'/usr/sbin/dhclient -pf /var/run/dhclient.eth0.pid eth0' \
${EXECUTOR} ${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}
}