--- a/src/ap/ubus.c +++ b/src/ap/ubus.c @@ -530,6 +530,7 @@ enum { CSA_HT, CSA_VHT, CSA_BLOCK_TX, + CSA_REASON, __CSA_MAX }; @@ -543,6 +544,7 @@ static const struct blobmsg_policy csa_p [CSA_HT] = { "ht", BLOBMSG_TYPE_BOOL }, [CSA_VHT] = { "vht", BLOBMSG_TYPE_BOOL }, [CSA_BLOCK_TX] = { "block_tx", BLOBMSG_TYPE_BOOL }, + [CSA_REASON] = { "reason", BLOBMSG_TYPE_INT32 }, }; #ifdef NEED_AP_MLME @@ -810,7 +812,7 @@ void hostapd_dfs_csa_timeout(void *eloop iface->conf->ieee80211ac, iface->conf->ieee80211ax); ret = hostapd_enable_iface(iface); - if (ret == 0) + if (ret == 0 && css->reason == 0) hostapd_ubus_handle_channel_switch_event(iface, HOSTAPD_UBUS_HIGH_INTERFERENCE, iface->freq); @@ -994,6 +996,7 @@ hostapd_switch_chan(struct ubus_context SET_CSA_SETTING(CSA_HT, freq_params.ht_enabled, bool); SET_CSA_SETTING(CSA_VHT, freq_params.vht_enabled, bool); SET_CSA_SETTING(CSA_BLOCK_TX, block_tx, bool); + SET_CSA_SETTING(CSA_REASON, reason, u32); wpa_printf(MSG_INFO, "%s: CSS freq=%d chan=%d sec_chan_off=%d, width=%d, seg0=%d, seg1=%d", __func__, css.freq_params.freq, @@ -1015,7 +1018,9 @@ hostapd_switch_chan(struct ubus_context return UBUS_STATUS_NOT_SUPPORTED; } - hostapd_ubus_handle_channel_switch_event(hapd->iface,HOSTAPD_UBUS_HIGH_INTERFERENCE, css.freq_params.freq); + if (css.reason == 0) { + hostapd_ubus_handle_channel_switch_event(hapd->iface, HOSTAPD_UBUS_HIGH_INTERFERENCE, css.freq_params.freq); + } return UBUS_STATUS_OK; #undef SET_CSA_SETTING --- a/src/drivers/driver.h +++ b/src/drivers/driver.h @@ -2291,6 +2291,7 @@ struct beacon_data { * @freq_params: Next channel frequency parameter * @beacon_csa: Beacon/probe resp/asooc resp info for CSA period * @beacon_after: Next beacon/probe resp/asooc resp info + * @reason: The reason why we are switching the channel * @counter_offset_beacon: Offset to the count field in beacon's tail * @counter_offset_presp: Offset to the count field in probe resp. */ @@ -2301,6 +2302,7 @@ struct csa_settings { struct hostapd_freq_params freq_params; struct beacon_data beacon_csa; struct beacon_data beacon_after; + u32 reason; u16 counter_offset_beacon[2]; u16 counter_offset_presp[2];