mirror of
https://dev.iopsys.eu/feed/iopsys.git
synced 2025-12-10 07:44:50 +01:00
set iup dhcp opts on all management interfaces
This commit is contained in:
parent
a17f3718af
commit
048546b175
1 changed files with 25 additions and 7 deletions
|
|
@ -13,6 +13,23 @@ include /lib/network
|
||||||
CRONPATH="/etc/crontabs/root"
|
CRONPATH="/etc/crontabs/root"
|
||||||
RANGE=60
|
RANGE=60
|
||||||
|
|
||||||
|
management_interfaces() {
|
||||||
|
local DHCP_IFACES=""
|
||||||
|
|
||||||
|
is_notbridged_dhcp() {
|
||||||
|
local config="$1"
|
||||||
|
local proto="$(uci -q get network.$config.proto)"
|
||||||
|
local typ="$(uci -q get network.$config.type)"
|
||||||
|
if [ "$proto" == "dhcp" -a "$typ" != "bridge" ]; then
|
||||||
|
DHCP_IFACES="$DHCP_IFACES $config"
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
config_load network
|
||||||
|
config_foreach is_notbridged_dhcp interface
|
||||||
|
echo $DHCP_IFACES
|
||||||
|
}
|
||||||
|
|
||||||
init_iup() {
|
init_iup() {
|
||||||
local interval
|
local interval
|
||||||
local starttime
|
local starttime
|
||||||
|
|
@ -35,9 +52,9 @@ init_iup() {
|
||||||
local newreqopts=
|
local newreqopts=
|
||||||
local baseopts=
|
local baseopts=
|
||||||
local reqopts="$(uci -q get network.wan.reqopts)"
|
local reqopts="$(uci -q get network.wan.reqopts)"
|
||||||
local proto="$(uci -q get network.wan.proto)"
|
|
||||||
local iupopts="66 67 128 224"
|
local iupopts="66 67 128 224"
|
||||||
local ropt iopt
|
local ropt iopt
|
||||||
|
local net
|
||||||
config_get enabled iup enabled "on"
|
config_get enabled iup enabled "on"
|
||||||
for ropt in $reqopts; do
|
for ropt in $reqopts; do
|
||||||
case $ropt in
|
case $ropt in
|
||||||
|
|
@ -53,12 +70,13 @@ init_iup() {
|
||||||
*) newreqopts="$newreqopts $ropt" ;;
|
*) newreqopts="$newreqopts $ropt" ;;
|
||||||
esac
|
esac
|
||||||
done
|
done
|
||||||
if [ "$proto" == "dhcp" ]; then
|
|
||||||
newreqopts="$(echo $newreqopts | tr ' ' '\n' | sort -n | tr '\n' ' ' | sed 's/^[ \t]*//;s/[ \t]*$//')"
|
newreqopts="$(echo $newreqopts | tr ' ' '\n' | sort -n | tr '\n' ' ' | sed 's/^[ \t]*//;s/[ \t]*$//')"
|
||||||
uci -q set network.wan.reqopts="$newreqopts"
|
for net in $(management_interfaces); do
|
||||||
uci commit network
|
uci -q set network.$net.reqopts="$newreqopts"
|
||||||
ubus call network reload
|
done
|
||||||
fi
|
uci commit network
|
||||||
|
ubus call network reload
|
||||||
#################################################################
|
#################################################################
|
||||||
|
|
||||||
if [ $interval == "weekly" ]; then
|
if [ $interval == "weekly" ]; then
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue