mirror of
https://dev.iopsys.eu/feed/iopsys.git
synced 2025-12-10 07:44:50 +01:00
icwmp: do not use local out of function
This commit is contained in:
parent
cf5327b44c
commit
019d6c3a00
1 changed files with 33 additions and 27 deletions
|
|
@ -4,39 +4,45 @@
|
|||
|
||||
[ "$ACTION" == "ifup" ] || exit 0
|
||||
|
||||
local islan="$(uci -q get network.$INTERFACE.is_lan)"
|
||||
[ "$islan" == "1" ] && exit 0
|
||||
[ -f /etc/config/cwmp ] || exit 0
|
||||
|
||||
local proto="$(uci -q get network.$INTERFACE.proto)"
|
||||
[ "$proto" == "none" ] && exit 0
|
||||
handle_icwmp_reload() {
|
||||
local islan="$(uci -q get network.$INTERFACE.is_lan)"
|
||||
[ "$islan" == "1" ] && exit 0
|
||||
|
||||
local ifname="$(uci -q get network.$INTERFACE.ifname)"
|
||||
[ "${ifname:0:1}" == "@" ] && exit 0
|
||||
local proto="$(uci -q get network.$INTERFACE.proto)"
|
||||
[ "$proto" == "none" ] && exit 0
|
||||
|
||||
mkdir -p /tmp/ipv4
|
||||
local ifname="$(uci -q get network.$INTERFACE.ifname)"
|
||||
[ "${ifname:0:1}" == "@" ] && exit 0
|
||||
|
||||
local previpaddr=""
|
||||
local curipaddr=""
|
||||
local ipaddrfile=/tmp/ipv4/$INTERFACE-ipaddr
|
||||
previpaddr=$(cat $ipaddrfile 2>/dev/null)
|
||||
network_get_ipaddr curipaddr $INTERFACE
|
||||
[ -n "$curipaddr" ] && echo $curipaddr > $ipaddrfile || rm -f $ipaddrfile
|
||||
mkdir -p /tmp/ipv4
|
||||
|
||||
local prevgateway=""
|
||||
local curgateway=""
|
||||
local gatewayfile=/tmp/ipv4/$INTERFACE-gateway
|
||||
prevgateway=$(cat $gatewayfile 2>/dev/null)
|
||||
network_get_gateway curgateway $INTERFACE
|
||||
[ -n "$curgateway" ] && echo $curgateway > $gatewayfile || rm -f $gatewayfile
|
||||
local previpaddr=""
|
||||
local curipaddr=""
|
||||
local ipaddrfile=/tmp/ipv4/$INTERFACE-ipaddr
|
||||
previpaddr=$(cat $ipaddrfile 2>/dev/null)
|
||||
network_get_ipaddr curipaddr $INTERFACE
|
||||
[ -n "$curipaddr" ] && echo $curipaddr > $ipaddrfile || rm -f $ipaddrfile
|
||||
|
||||
local prevsubnets=""
|
||||
local cursubnets=""
|
||||
local subnetsfile=/tmp/ipv4/$INTERFACE-subnets
|
||||
prevsubnets=$(cat $subnetsfile 2>/dev/null)
|
||||
network_get_subnets cursubnets $INTERFACE
|
||||
[ -n "$cursubnets" ] && echo $cursubnets > $subnetsfile || rm -f $subnetsfile
|
||||
local prevgateway=""
|
||||
local curgateway=""
|
||||
local gatewayfile=/tmp/ipv4/$INTERFACE-gateway
|
||||
prevgateway=$(cat $gatewayfile 2>/dev/null)
|
||||
network_get_gateway curgateway $INTERFACE
|
||||
[ -n "$curgateway" ] && echo $curgateway > $gatewayfile || rm -f $gatewayfile
|
||||
|
||||
[ "$previpaddr" = "$curipaddr" -a "$prevgateway" = "$curgateway" -a "$prevsubnets" = "$cursubnets" ] && exit 0
|
||||
local prevsubnets=""
|
||||
local cursubnets=""
|
||||
local subnetsfile=/tmp/ipv4/$INTERFACE-subnets
|
||||
prevsubnets=$(cat $subnetsfile 2>/dev/null)
|
||||
network_get_subnets cursubnets $INTERFACE
|
||||
[ -n "$cursubnets" ] && echo $cursubnets > $subnetsfile || rm -f $subnetsfile
|
||||
|
||||
[ -f /etc/config/cwmp ] && /etc/init.d/icwmpd reload &
|
||||
[ "$previpaddr" = "$curipaddr" -a "$prevgateway" = "$curgateway" -a "$prevsubnets" = "$cursubnets" ] && exit 0
|
||||
|
||||
/etc/init.d/icwmpd reload &
|
||||
}
|
||||
|
||||
handle_icwmp_reload
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue