ask for dhcp options 66 67 128 only if iup is enabled

This commit is contained in:
Sukru Senli 2016-02-04 14:30:25 +01:00
parent a17530309f
commit 8a2939ddde

View file

@ -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