diff --git a/iup/files/etc/init.d/iup b/iup/files/etc/init.d/iup index f6f0fb27c..436045e8f 100755 --- a/iup/files/etc/init.d/iup +++ b/iup/files/etc/init.d/iup @@ -29,6 +29,38 @@ init_iup() { config_load provisioning config_get interval polling interval config_get starttime polling starttime + + ### Ask for IUP related DHCP options only if IUP is enabled ### + local enabled + local newreqopts= + local baseopts= + local reqopts="$(uci -q get network.wan.reqopts)" + local proto="$(uci -q get network.wan.proto)" + local iupopts="66 67 128" + local ropt iopt + config_get enabled iup enabled "off" + for ropt in $reqopts; do + case $ropt in + 66|67|128) ;; + *) baseopts="$baseopts $ropt" ;; + esac + done + ropt="" + reqopts="$baseopts $iupopts" + for ropt in $reqopts; do + case $ropt in + 66|67|128) [ $enabled == "on" ] && newreqopts="$newreqopts $ropt" ;; + *) newreqopts="$newreqopts $ropt" ;; + esac + done + if [ $proto == "dhcp" ]; then + newreqopts="$(echo $newreqopts | sed "s/^[ \t]*//")" + uci -q set network.wan.reqopts="$newreqopts" + uci commit network + ubus call network reload + fi + ################################################################# + if [ $interval == "weekly" ]; then interval="0" elif [ $interval == "hourly" ]; then