From: John Crispin Date: Thu, 16 Apr 2026 12:26:11 +0000 (+0200) Subject: netifd: expose udhcpc timeout/retry/tryagain UCI options in dhcp.sh X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=d2f17ddd395ef4717555e5bd2eddb2e787d94f31;p=thirdparty%2Fopenwrt.git netifd: expose udhcpc timeout/retry/tryagain UCI options in dhcp.sh proto/dhcp.sh hardcoded `-t 0` (infinite retries) with no way for UCI / operator to tune per-retry interval (udhcpc -T), retry count (udhcpc -t) or failure retry-loop wait (udhcpc -A). Add three new proto config ints (timeout, retry, tryagain) and thread them into the udhcpc command line. Unset options preserve existing behaviour: retry defaults to 0, timeout and tryagain are omitted so udhcpc uses its own RFC defaults. Signed-off-by: John Crispin Signed-off-by: Felix Fietkau --- diff --git a/package/network/config/netifd/files/lib/netifd/proto/dhcp.sh b/package/network/config/netifd/files/lib/netifd/proto/dhcp.sh index 5d8e0dda5e3..5765efffaa0 100755 --- a/package/network/config/netifd/files/lib/netifd/proto/dhcp.sh +++ b/package/network/config/netifd/files/lib/netifd/proto/dhcp.sh @@ -28,6 +28,9 @@ proto_dhcp_init_config() { proto_config_add_string mtu6rd proto_config_add_string customroutes proto_config_add_boolean classlessroute + proto_config_add_int timeout + proto_config_add_int retry + proto_config_add_int tryagain } proto_dhcp_add_sendopts() { @@ -55,8 +58,8 @@ proto_dhcp_setup() { local config="$1" local iface="$2" - local ipaddr hostname clientid vendorid broadcast norelease reqopts defaultreqopts iface6rd sendopts delegate zone6rd zone mtu6rd customroutes classlessroute - json_get_vars ipaddr hostname clientid vendorid broadcast norelease reqopts defaultreqopts iface6rd delegate zone6rd zone mtu6rd customroutes classlessroute + local ipaddr hostname clientid vendorid broadcast norelease reqopts defaultreqopts iface6rd sendopts delegate zone6rd zone mtu6rd customroutes classlessroute timeout retry tryagain + json_get_vars ipaddr hostname clientid vendorid broadcast norelease reqopts defaultreqopts iface6rd delegate zone6rd zone mtu6rd customroutes classlessroute timeout retry tryagain local opt dhcpopts for opt in $reqopts; do @@ -102,7 +105,9 @@ proto_dhcp_setup() { proto_run_command "$config" udhcpc \ -p /var/run/udhcpc-$iface.pid \ -s /lib/netifd/dhcp.script \ - -f -t 0 -i "$iface" \ + -f -t "${retry:-0}" -i "$iface" \ + ${timeout:+-T "$timeout"} \ + ${tryagain:+-A "$tryagain"} \ ${ipaddr:+-r ${ipaddr/\/*/}} \ ${hostname:+-x "hostname:$hostname"} \ ${emptyvendorid:+-V ""} \