]> git.ipfire.org Git - thirdparty/hostap.git/commitdiff
AP: Ignore radar event when frequency range is mismatched
authorAditya Kumar Singh <aditya.kumar.singh@oss.qualcomm.com>
Thu, 25 Sep 2025 16:49:34 +0000 (22:19 +0530)
committerJouni Malinen <j@w1.fi>
Fri, 26 Sep 2025 19:44:23 +0000 (22:44 +0300)
In split-MAC enabled cases, radar events which don't have the interface
ID set (like NOP_FINISHED) will be sent to matching 5 GHz frequency BSSs
if the AP MLD has a 5 GHz link. Though, the frequency info is not
matching that of the event received, the event gets currently parsed for
these cases as well. Because of this, other applications might
misinterpret the event wrongly for other interface as well.

Address this by checking that the frequency info received lies within
the interface start and end frequency, and ignore the event if it
doesn't match the interface frequency range.

Signed-off-by: Aditya Kumar Singh <aditya.kumar.singh@oss.qualcomm.com>
Signed-off-by: Manish Dharanenthiran <manish.dharanenthiran@oss.qualcomm.com>
src/ap/dfs.c

index 0cac194b267bcdee215638ac73331ec3f4e0b814..9900092b41a96988bec4c7235f0de7be31ed45c4 100644 (file)
@@ -1113,6 +1113,25 @@ static void hostapd_dfs_update_background_chain(struct hostapd_iface *iface)
 }
 
 
+static bool
+hostapd_is_freq_in_current_hw_info(struct hostapd_iface *iface, int freq)
+{
+       struct hostapd_channel_data *chan;
+
+       if (!iface->current_mode)
+               return false;
+
+       chan = hw_mode_get_channel(iface->current_mode, freq, NULL);
+
+       /* If channel data is not found for the given frequency, consider it is
+        * out of the current hardware info. */
+       if (!chan)
+               return false;
+
+       return chan_in_current_hw_info(iface->current_hw_info, chan);
+}
+
+
 static bool
 hostapd_dfs_is_background_event(struct hostapd_iface *iface, int freq)
 {
@@ -1150,6 +1169,14 @@ int hostapd_dfs_complete_cac(struct hostapd_iface *iface, int success, int freq,
                             int ht_enabled, int chan_offset, int chan_width,
                             int cf1, int cf2)
 {
+       if (!hostapd_is_freq_in_current_hw_info(iface, freq)) {
+               wpa_msg(iface->bss[0]->msg_ctx, MSG_INFO,
+                       DFS_EVENT_CAC_COMPLETED
+                       "Ignoring since freq=%d info is out of own range",
+                       freq);
+               return 0;
+       }
+
        wpa_msg(iface->bss[0]->msg_ctx, MSG_INFO, DFS_EVENT_CAC_COMPLETED
                "success=%d freq=%d ht_enabled=%d chan_offset=%d chan_width=%d cf1=%d cf2=%d radar_detected=%d",
                success, freq, ht_enabled, chan_offset, chan_width, cf1, cf2,
@@ -1221,6 +1248,14 @@ int hostapd_dfs_pre_cac_expired(struct hostapd_iface *iface, int freq,
                                int ht_enabled, int chan_offset, int chan_width,
                                int cf1, int cf2)
 {
+       if (!hostapd_is_freq_in_current_hw_info(iface, freq)) {
+               wpa_msg(iface->bss[0]->msg_ctx, MSG_INFO,
+                       DFS_EVENT_PRE_CAC_EXPIRED
+                       "Ignoring since freq=%d info is out of own range",
+                       freq);
+               return 0;
+       }
+
        wpa_msg(iface->bss[0]->msg_ctx, MSG_INFO, DFS_EVENT_PRE_CAC_EXPIRED
                "freq=%d ht_enabled=%d chan_offset=%d chan_width=%d cf1=%d cf2=%d",
                freq, ht_enabled, chan_offset, chan_width, cf1, cf2);
@@ -1452,6 +1487,14 @@ int hostapd_dfs_radar_detected(struct hostapd_iface *iface, int freq,
                               int ht_enabled, int chan_offset, int chan_width,
                               int cf1, int cf2)
 {
+       if (!hostapd_is_freq_in_current_hw_info(iface, freq)) {
+               wpa_msg(iface->bss[0]->msg_ctx, MSG_INFO,
+                       DFS_EVENT_RADAR_DETECTED
+                       "Ignoring since freq=%d info is out of own range",
+                       freq);
+               return 0;
+       }
+
        wpa_msg(iface->bss[0]->msg_ctx, MSG_INFO, DFS_EVENT_RADAR_DETECTED
                "freq=%d ht_enabled=%d chan_offset=%d chan_width=%d cf1=%d cf2=%d",
                freq, ht_enabled, chan_offset, chan_width, cf1, cf2);
@@ -1490,6 +1533,14 @@ int hostapd_dfs_nop_finished(struct hostapd_iface *iface, int freq,
                             int ht_enabled, int chan_offset, int chan_width,
                             int cf1, int cf2)
 {
+       if (!hostapd_is_freq_in_current_hw_info(iface, freq)) {
+               wpa_msg(iface->bss[0]->msg_ctx, MSG_INFO,
+                       DFS_EVENT_NOP_FINISHED
+                       "Ignoring since freq=%d info is out of own range",
+                       freq);
+               return 0;
+       }
+
        wpa_msg(iface->bss[0]->msg_ctx, MSG_INFO, DFS_EVENT_NOP_FINISHED
                "freq=%d ht_enabled=%d chan_offset=%d chan_width=%d cf1=%d cf2=%d",
                freq, ht_enabled, chan_offset, chan_width, cf1, cf2);
@@ -1547,6 +1598,13 @@ int hostapd_dfs_start_cac(struct hostapd_iface *iface, int freq,
                          int ht_enabled, int chan_offset, int chan_width,
                          int cf1, int cf2)
 {
+       if (!hostapd_is_freq_in_current_hw_info(iface, freq)) {
+               wpa_msg(iface->bss[0]->msg_ctx, MSG_INFO, DFS_EVENT_CAC_START
+                       "Ignoring since freq=%d info is out of own range",
+                       freq);
+               return 0;
+       }
+
        if (hostapd_dfs_is_background_event(iface, freq)) {
                iface->radar_background.cac_started = 1;
        } else {