]> git.ipfire.org Git - thirdparty/hostap.git/commitdiff
nl80211: Send link ID when starting CAC for radar detection
authorAditya Kumar Singh <quic_adisi@quicinc.com>
Fri, 6 Sep 2024 13:23:56 +0000 (18:53 +0530)
committerJouni Malinen <j@w1.fi>
Mon, 7 Oct 2024 19:18:43 +0000 (22:18 +0300)
For MLO, link ID needs to be sent along with the nl80211 command to
start CAC for radar detection. Pass the link ID if operating as an AP
MLD.

Signed-off-by: Aditya Kumar Singh <quic_adisi@quicinc.com>
src/ap/ap_drv_ops.c
src/drivers/driver_nl80211.c

index f82bfd077ca371c303a997bdfdc1f7df6cadb3a3..7b571bdb08be8b2784fff68dc35600866c97a8a0 100644 (file)
@@ -1040,6 +1040,12 @@ int hostapd_start_dfs_cac(struct hostapd_iface *iface,
        }
        data.radar_background = radar_background;
 
+       data.link_id = -1;
+#ifdef CONFIG_IEEE80211BE
+       if (hapd->conf->mld_ap)
+               data.link_id = hapd->mld_link_id;
+#endif /* CONFIG_IEEE80211BE */
+
        res = hapd->driver->start_dfs_cac(hapd->drv_priv, &data);
        if (!res) {
                if (radar_background)
index 1356d325d5e751dd90977ba30bd752532254cc37..715f60df1b2035e1c0725eb1a90c2ade80807656 100644 (file)
@@ -10599,9 +10599,23 @@ static int nl80211_start_radar_detection(void *priv,
                return -1;
        }
 
+       if (nl80211_link_valid(bss->valid_links, freq->link_id)) {
+               wpa_printf(MSG_DEBUG,
+                          "nl80211: Radar detection (CAC) on link_id=%d",
+                          freq->link_id);
+
+               if (nla_put_u8(msg, NL80211_ATTR_MLO_LINK_ID, freq->link_id)) {
+                       nlmsg_free(msg);
+                       return -1;
+               }
+       }
+
        ret = send_and_recv_cmd(drv, msg);
-       if (ret == 0)
+       if (ret == 0) {
+               nl80211_link_set_freq(bss, freq->link_id, freq->freq);
                return 0;
+       }
+
        wpa_printf(MSG_DEBUG, "nl80211: Failed to start radar detection: "
                   "%d (%s)", ret, strerror(-ret));
        return -1;