From 94c41eef615bb33ad26fff71d341f66e35286f5d Mon Sep 17 00:00:00 2001 From: Peter Korsgaard Date: Tue, 17 Aug 2021 12:19:22 +0200 Subject: [PATCH] package/busybox/udhcpc.script: ensure action argument is correctly passed to hook scripts MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit commit f79a420825479c47d (package/busybox/udhcpc.script: support RFC3442 static routes) used 'set --' clobbering the positional arguments, causing the action argument to not be correctly forwarded to hook scripts for the renew / bound cases if static routes are provided by the server. As a workaround, save the action argument at the beginning of the script and use that when calling hook scripts. Reported-by: 王琦 Signed-off-by: Peter Korsgaard --- package/busybox/udhcpc.script | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/package/busybox/udhcpc.script b/package/busybox/udhcpc.script index c73ad6c2ef..74dc5532b9 100755 --- a/package/busybox/udhcpc.script +++ b/package/busybox/udhcpc.script @@ -4,6 +4,7 @@ [ -z "$1" ] && echo "Error: should be called from udhcpc" && exit 1 +ACTION="$1" RESOLV_CONF="/etc/resolv.conf" [ -e $RESOLV_CONF ] || touch $RESOLV_CONF [ -n "$broadcast" ] && BROADCAST="broadcast $broadcast" @@ -29,7 +30,7 @@ wait_for_ipv6_default_route() { printf " timeout!\n" } -case "$1" in +case "$ACTION" in deconfig) /sbin/ifconfig $interface up /sbin/ifconfig $interface 0.0.0.0 @@ -115,7 +116,7 @@ esac HOOK_DIR="$0.d" for hook in "${HOOK_DIR}/"*; do [ -f "${hook}" -a -x "${hook}" ] || continue - "${hook}" "${@}" + "${hook}" "$ACTION" done exit 0 -- 2.30.2