Commit 65237da8 authored by Peter Korsgaard's avatar Peter Korsgaard Committed by carbon

package/busybox/udhcpc.script: ensure action argument is correctly passed to hook scripts

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: default avatar王琦 <wangwangqi2011@gmail.com>
Signed-off-by: default avatarPeter Korsgaard <peter@korsgaard.com>
parent e3bd1e81
...@@ -4,6 +4,7 @@ ...@@ -4,6 +4,7 @@
[ -z "$1" ] && echo "Error: should be called from udhcpc" && exit 1 [ -z "$1" ] && echo "Error: should be called from udhcpc" && exit 1
ACTION="$1"
RESOLV_CONF="/etc/resolv.conf" RESOLV_CONF="/etc/resolv.conf"
[ -e $RESOLV_CONF ] || touch $RESOLV_CONF [ -e $RESOLV_CONF ] || touch $RESOLV_CONF
[ -n "$broadcast" ] && BROADCAST="broadcast $broadcast" [ -n "$broadcast" ] && BROADCAST="broadcast $broadcast"
...@@ -29,7 +30,7 @@ wait_for_ipv6_default_route() { ...@@ -29,7 +30,7 @@ wait_for_ipv6_default_route() {
printf " timeout!\n" printf " timeout!\n"
} }
case "$1" in case "$ACTION" in
deconfig) deconfig)
/sbin/ifconfig $interface up /sbin/ifconfig $interface up
/sbin/ifconfig $interface 0.0.0.0 /sbin/ifconfig $interface 0.0.0.0
...@@ -115,7 +116,7 @@ esac ...@@ -115,7 +116,7 @@ esac
HOOK_DIR="$0.d" HOOK_DIR="$0.d"
for hook in "${HOOK_DIR}/"*; do for hook in "${HOOK_DIR}/"*; do
[ -f "${hook}" -a -x "${hook}" ] || continue [ -f "${hook}" -a -x "${hook}" ] || continue
"${hook}" "${@}" "${hook}" "$ACTION"
done done
exit 0 exit 0
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment