]> git.ipfire.org Git - thirdparty/hostap.git/commitdiff
nl80211: AP MLD: Parse link ID to determine the BSS for radar event
authorChenming Huang <quic_chenhuan@quicinc.com>
Thu, 21 Mar 2024 01:39:45 +0000 (07:09 +0530)
committerJouni Malinen <j@w1.fi>
Mon, 15 Apr 2024 08:38:42 +0000 (11:38 +0300)
Link ID is more accurate to specify the BSS for a radar event in some
corner cases, e.g., when there is a radar detection event and the driver
then switches to another DFS channel. There will then be two events
coming from the driver (CAC start and channel switch complete). In case
the CAC-start event comes first, hostapd still stores the previous
frequency and cannot find the correct link by calling
nl80211_get_mld_link_by_freq() with the new frequency.

Signed-off-by: Chenming Huang <quic_chenhuan@quicinc.com>
src/drivers/driver_nl80211_event.c

index 61b49c1d5fed8f90ca185d91aabd9529e20587a8..143a53288abdccd7dab08cdaa8b4560dc04249d4 100644 (file)
@@ -2461,7 +2461,10 @@ static void nl80211_radar_event(struct wpa_driver_nl80211_data *drv,
        data.dfs_event.freq = nla_get_u32(tb[NL80211_ATTR_WIPHY_FREQ]);
        event_type = nla_get_u32(tb[NL80211_ATTR_RADAR_EVENT]);
 
-       if (data.dfs_event.freq) {
+       if (tb[NL80211_ATTR_MLO_LINK_ID]) {
+               data.dfs_event.link_id =
+                       nla_get_u8(tb[NL80211_ATTR_MLO_LINK_ID]);
+       } else if (data.dfs_event.freq) {
                data.dfs_event.link_id =
                        nl80211_get_link_id_by_freq(drv->first_bss,
                                                    data.dfs_event.freq);
@@ -2848,7 +2851,10 @@ static void qca_nl80211_dfs_offload_radar_event(
        data.dfs_event.freq = nla_get_u32(tb[NL80211_ATTR_WIPHY_FREQ]);
        data.dfs_event.link_id = NL80211_DRV_LINK_ID_NA;
 
-       if (data.dfs_event.freq) {
+       if (tb[NL80211_ATTR_MLO_LINK_ID]) {
+               data.dfs_event.link_id =
+                       nla_get_u8(tb[NL80211_ATTR_MLO_LINK_ID]);
+       } else if (data.dfs_event.freq) {
                data.dfs_event.link_id =
                        nl80211_get_link_id_by_freq(drv->first_bss,
                                                    data.dfs_event.freq);