mirror of
https://dev.iopsys.eu/feed/iopsys.git
synced 2026-03-14 21:10:11 +01:00
inteno-netmodes: correct uplink after applying wifi settings
This commit is contained in:
parent
16fe48bee8
commit
d91c6aeafb
1 changed files with 39 additions and 3 deletions
|
|
@ -255,11 +255,48 @@ done
|
|||
|
||||
uci commit wireless
|
||||
|
||||
correct_uplink(){
|
||||
|
||||
get_wifi_wet_interface() {
|
||||
handle_interface() {
|
||||
config_get mode "$1" mode
|
||||
if [ "$mode" == "sta" -o "$mode" == "wet" ] ; then
|
||||
config_get ifname "$1" ifname
|
||||
echo "$ifname"
|
||||
fi
|
||||
}
|
||||
config_load wireless
|
||||
config_foreach handle_interface wifi-iface
|
||||
}
|
||||
|
||||
MTK=0
|
||||
[ "$(db -q get hw.board.hardware)" == "EX400" ] && MTK=1
|
||||
|
||||
WANDEV="$(db -q get hw.board.ethernetWanPort).1"
|
||||
[ $MTK -eq 1 ] && WANDEV="eth0.2"
|
||||
|
||||
link=$(cat /sys/class/net/${WANDEV:0:4}/operstate)
|
||||
[ $MTK -eq 1 ] && link=$(swconfig dev switch0 port 0 get link | awk '{print$2}' | cut -d':' -f2)
|
||||
|
||||
wetif="$(get_wifi_wet_interface)"
|
||||
|
||||
if [ "$link" == "up" ]; then
|
||||
ubus call network.device set_state "{\"name\":\"$wetif\", \"defer\":true}"
|
||||
ubus call network.device set_state "{\"name\":\"$WANDEV\", \"defer\":false}"
|
||||
else
|
||||
ubus call network.device set_state "{\"name\":\"$wetif\", \"defer\":false}"
|
||||
ubus call network.device set_state "{\"name\":\"$WANDEV\", \"defer\":true}"
|
||||
ubus call led.internet set '{"state" : "notice"}'
|
||||
fi
|
||||
ubus call leds set '{"state":"normal"}'
|
||||
}
|
||||
|
||||
if [ "$from_gui" == "true" ]; then
|
||||
# check for connectivity
|
||||
wifi reload
|
||||
[ -f /etc/init.d/layer2 ] && /etc/init.d/layer2 reload
|
||||
i=$SLEEPTIME;
|
||||
correct_uplink
|
||||
i=$SLEEPTIME
|
||||
|
||||
while [ $i -gt 0 ]; do
|
||||
ip=`route -n | awk '/^0.0.0.0/{print $2}'`
|
||||
|
|
@ -291,6 +328,5 @@ else
|
|||
wifi reload
|
||||
fi
|
||||
[ -f /etc/init.d/layer2 ] && /etc/init.d/layer2 reload
|
||||
ubus call leds set '{"state":"normal"}'
|
||||
ubus call led.internet set '{"state":"notice"}'
|
||||
correct_uplink
|
||||
fi
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue