diff --git a/src/agent.c b/src/agent.c index 6dd565700bd0093df17fbe6a7765ba63ce99afc0..5f3f2c94db789762d9b71d35063e2bccbad240e2 100644 --- a/src/agent.c +++ b/src/agent.c @@ -2974,7 +2974,6 @@ static void wifi_radio_event_handler(void *c, struct blob_attr *msg) /* completely re-init data */ timer_set(&a->init_ifaces_scheduler, IFACE_TIMEOUT * 1000); - if (may_enable_fhs(a)) /* Enable fronthauls */ timer_set(&a->enable_fhs_scheduler, @@ -5906,6 +5905,7 @@ void agent_init_interfaces_post_actions(struct agent *a) update_neighbors_from_scancache(a, &re->scanresults); } } + agent_exec_platform_scripts("update_acs"); } int agent_get_system_info(struct agent *a) diff --git a/src/script/multiap b/src/script/multiap index 0ebace58ce716cb00b25bd705503fdc326fbe8ed..a123353fed9dfc9c962341d24fcb32da66650cec 100755 --- a/src/script/multiap +++ b/src/script/multiap @@ -1116,7 +1116,56 @@ update_isolate_ebtables() { } +update_acs() { + local band=$1 + local brcm_setup="$(uci -q get mapagent.agent.brcm_setup)" + local bk_type + + + [ "$brcm_setup" != "1" ] && return; # today only supported for brcm + + set_acs() { + local section=$1 + local mode=$2 + local tband=$3 + local channel + + config_get type $section type + config_get band $section band + config_get ifname $section ifname + config_get device $section device + + [ "$device" = "" ] && return + + channel="$(uci -q get wireless.${device}.channel)" + + [ "$channel" != "auto" ] && return + + [ "$tband" = "" -o "$band" = "$tband" ] || return + + [ "$type" != "fronthaul" ] && return + + acs_cli2 -i $ifname mode $mode > /dev/null 2>&1 + } + + bk_type=$( + flock -x 200 + json_load "$(cat $MAPFILE)" + json_get_var bk_type type + json_cleanup + echo $bk_type + ) 200>/var/lock/map.backhaul.lock + + config_load mapagent + if [ "$bk_type" = "eth" ]; then + config_foreach set_acs ap "2" $band + elif [ "$bk_type" = "wifi" ]; then + config_foreach set_acs ap "0" $band + fi +} + set_uplink() { + local island_prevention="$(uci -q get mapagent.agent.island_prevention)" local type=$1 local ifname=$2 local hwaddr @@ -1135,11 +1184,10 @@ set_uplink() { ) 200>/var/lock/map.backhaul.lock json_cleanup - island_prevention="$(uci -q get mapagent.agent.island_prevention)" - if [ "$island_prevention" = "1" -a "$type" = "eth" ]; then ubus call map.agent toggle_fh '{"enable":true, "prevent_island":true, "ifname":"all"}' fi + update_acs update_isolate_ebtables } @@ -1220,6 +1268,7 @@ case "$func" in bsta_use_link) bsta_use_link $@;; bsta_swap_to_link) bsta_swap_to_link $@;; bsta_set_channel) bsta_set_channel $@;; + update_acs) update_acs $@;; set_uplink) set_uplink $@;; set_uplink_backhaul_info) set_uplink_backhaul_info $@;; unset_uplink) unset_uplink $@;;