mirror of
https://dev.iopsys.eu/feed/iopsys.git
synced 2026-03-14 21:10:11 +01:00
map-agent: map-loop-detection: speed up interface removal from bridge and harmonize disconnection
This commit is contained in:
parent
40a1a45412
commit
d9ae18761b
1 changed files with 21 additions and 5 deletions
|
|
@ -5,6 +5,12 @@ wan=$(db -q get hw.board.ethernetWanPort)
|
|||
[ -z "$wan" ] && exit 1 # no configuration
|
||||
[ "$PORT" != "$wan" ] && exit 0
|
||||
|
||||
remove_from_bridge() {
|
||||
config_get ifname "$section" ifname
|
||||
|
||||
ubus call network.interface.$bridge remove_device '{"name":"$ifname"}'
|
||||
}
|
||||
|
||||
update_bstas() {
|
||||
local section="$1"
|
||||
local action="$2"
|
||||
|
|
@ -13,17 +19,27 @@ update_bstas() {
|
|||
config_get ifname "$section" ifname
|
||||
config_get_bool enabled "$section" enabled 0
|
||||
|
||||
[ "$enabled" -eq 0 ] && return
|
||||
|
||||
wpa_cli -i "$ifname" "$action" > /dev/null 2>&1
|
||||
if [ "$action" = "down" ]; then
|
||||
wpa_cli -i "$ifname" disconnect > /dev/null 2>&1
|
||||
wpa_cli -i "$ifname" disable_network 0 > /dev/null 2>&1
|
||||
# wpa_cli -i "$ifname" save_config > /dev/null 2>&1
|
||||
elif [ "$action" = "up" ]; then
|
||||
[ "$enabled" -eq 0 ] && return
|
||||
wpa_cli -i "$ifname" reconnect > /dev/null 2>&1
|
||||
wpa_cli -i "$ifname" enable_network 0 > /dev/null 2>&1
|
||||
# wpa_cli -i "$ifname" save_config > /dev/null 2>&1
|
||||
fi
|
||||
}
|
||||
|
||||
if [ "$LINK" = "up" ]; then
|
||||
touch /tmp/map.agent.bsta_global_disable
|
||||
|
||||
config_load "mapagent"
|
||||
config_foreach update_bstas bk-iface disconnect
|
||||
bridge=$(uci get mapagent.agent.al_bridge | cut -d '-' -f2)
|
||||
config_foreach remove_from_bridge bk-iface $bridge
|
||||
config_foreach update_bstas bk-iface down
|
||||
else
|
||||
rm -f /tmp/map.agent.bsta_global_disable
|
||||
config_load "mapagent"
|
||||
config_foreach update_bstas bk-iface reconnect
|
||||
config_foreach update_bstas bk-iface up
|
||||
fi
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue