mirror of
https://dev.iopsys.eu/feed/iopsys.git
synced 2026-03-14 21:10:11 +01:00
Add support for DHCP ACS discovery
Signed-off-by: Orr Mazor <o.mazor@genexis.eu>
This commit is contained in:
parent
77c7475cc7
commit
ee4d70ba6d
1 changed files with 43 additions and 4 deletions
|
|
@ -10,8 +10,15 @@ handle_icwmp_update() {
|
|||
|
||||
log "Handling dhcp option value ${vendorspecinf}"
|
||||
[ -n "$vendorspecinf" ] && {
|
||||
local update=""
|
||||
local url=""
|
||||
local old_url="$(uci -q get cwmp.acs.dhcp_url)"
|
||||
local prov_code=""
|
||||
local old_prov_code="$(uci -q get cwmp.cpe.dhcp_provisioning_code)"
|
||||
local min_wait_interval=""
|
||||
local old_min_wait_interval="$(uci -q get cwmp.acs.dhcp_retry_min_wait_interval)"
|
||||
local retry_interval_multiplier=""
|
||||
local old_retry_interval_multiplier="$(uci -q get cwmp.acs.dhcp_retry_interval_multiplier)"
|
||||
|
||||
case $vendorspecinf in
|
||||
http://*|https://*)
|
||||
|
|
@ -23,20 +30,52 @@ handle_icwmp_update() {
|
|||
1=*)
|
||||
url="$(echo $optval | cut -d"=" -f2-)"
|
||||
;;
|
||||
2=*)
|
||||
prov_code="$(echo $optval | cut -d"=" -f2-)"
|
||||
;;
|
||||
3=*)
|
||||
min_wait_interval="$(echo $optval | cut -d"=" -f2-)"
|
||||
;;
|
||||
4=*)
|
||||
retry_interval_multiplier="$(echo $optval | cut -d"=" -f2-)"
|
||||
;;
|
||||
esac
|
||||
done
|
||||
;;
|
||||
esac
|
||||
|
||||
if [ -n "$url" ]; then
|
||||
log "## icwmp url[${old_url}] changed to [${url}]"
|
||||
if [ "${url}" != "${old_url}" ]; then
|
||||
log "Restarting icwmp url[${old_url}] changed to [${url}]"
|
||||
log "## icwmp url[${old_url}] changed to [${url}]"
|
||||
uci -q set cwmp.acs.dhcp_url="$url"
|
||||
uci commit cwmp
|
||||
ubus call uci commit '{"config":"cwmp"}'
|
||||
update=1
|
||||
fi
|
||||
fi
|
||||
if [ -n "$prov_code" ]; then
|
||||
if [ "${prov_code}" != "${old_prov_code}" ]; then
|
||||
log "## icwmp prov_code[${old_prov_code}] changed to [${prov_code}]"
|
||||
uci -q set cwmp.cpe.dhcp_provisioning_code="$prov_code"
|
||||
update=1
|
||||
fi
|
||||
fi
|
||||
if [ -n "$min_wait_interval" ]; then
|
||||
if [ "${min_wait_interval}" != "${old_min_wait_interval}" ]; then
|
||||
log "## icwmp min_wait_interval[${old_min_wait_interval}] changed to [${min_wait_interval}]"
|
||||
uci -q set cwmp.acs.dhcp_retry_min_wait_interval="$min_wait_interval"
|
||||
update=1
|
||||
fi
|
||||
fi
|
||||
if [ -n "$retry_interval_multiplier" ]; then
|
||||
if [ "${retry_interval_multiplier}" != "${old_retry_interval_multiplier}" ]; then
|
||||
log "## icwmp retry_interval_multiplier[${old_retry_interval_multiplier}] changed to [${retry_interval_multiplier}]"
|
||||
uci -q set cwmp.acs.dhcp_retry_interval_multiplier="$retry_interval_multiplier"
|
||||
update=1
|
||||
fi
|
||||
fi
|
||||
if [ -n "$update" ]; then
|
||||
log "Restarting icwmp"
|
||||
ubus call uci commit '{"config":"cwmp"}'
|
||||
fi
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue