diff --git a/src/agent.c b/src/agent.c index e8b1d7aa22fb457739a574952c27075479aaceb2..7229f75246d6634a915de0f266fa8c37a5224130 100644 --- a/src/agent.c +++ b/src/agent.c @@ -3662,13 +3662,40 @@ static void wifi_radio_event_handler(void *c, struct blob_attr *msg) timer_set(&a->init_ifaces_scheduler, IFACE_TIMEOUT * 1000); } else if (!strcmp(event, "radar")) { - struct cmdu_buff *cmdu; + struct netif_ap *ap; + struct netif_bk *bk; + struct wifi_radio_element *re; - cmdu = agent_gen_channel_preference_report(a, NULL); - if (cmdu) { - agent_send_cmdu(a, cmdu); - cmdu_free(cmdu); + ap = agent_get_ap_by_ifname(a, ifname); + if (WARN_ON(!ap)) { + dbg("%s: No AP with ifname %s.\n", __func__, ifname); + return; + } + + re = agent_get_radio_by_name(a, ap->radio_name); + if (WARN_ON(re)) { + dbg("%s: Current radio_element not found.\n", __func__); + return; } + + /* Only handle radar events on 5G radios */ + if (re->band != BAND_5) + return; + + /* Switch BH immediatelly */ + bk = &re->bk; + if (!bk) + return; + + bk->connected = false; + if (if_isbridge_interface(bk->ifname)) + wifi_mod_bridge(a, bk, false); + agent_handle_bh_lost(a, bk, true); + a->connected = agent_is_bsta_connected(a); + + /* Send channel preference report (after BH switch) */ + timer_set(&re->preference_report_timer, 30); + } else if (!strcmp(event, "scan_finished")) { struct wifi_radio_element *re = agent_get_radio_with_ifname(a, ifname);