]> git.ipfire.org Git - thirdparty/hostap.git/commitdiff
More generic unsolicited broadcast Probe Response template setup
authorRathees Kumar R Chinannan <quic_rrchinan@quicinc.com>
Mon, 8 Apr 2024 06:35:16 +0000 (12:05 +0530)
committerJouni Malinen <j@w1.fi>
Wed, 24 Apr 2024 18:58:49 +0000 (21:58 +0300)
When AP is beaconing only on the 6 GHz band and unsol_bcast_presp
interval is set, AP sends unsolicited broadcast Probe Response frames
for in-band discovery. hostapd sent the Probe Response template for this
frame only when setting a new beacon.

As a preparation for extending this functionality to other cases, move
the generation of the unsolicited broadcast Probe Response template into
a more generic function and data structure.

Signed-off-by: Rathees Kumar R Chinannan <quic_rrchinan@quicinc.com>
src/ap/beacon.c
src/ap/beacon.h
src/drivers/driver.h
src/drivers/driver_nl80211.c

index c214f52274ae5f2538779db77cc3b63c20fa694b..cec0c9829fd954c6f655cb3fda5815ff6a861991 100644 (file)
@@ -1712,15 +1712,15 @@ static u8 * hostapd_probe_resp_offloads(struct hostapd_data *hapd,
 
 #ifdef CONFIG_IEEE80211AX
 /* Unsolicited broadcast Probe Response transmission, 6 GHz only */
-static u8 * hostapd_unsol_bcast_probe_resp(struct hostapd_data *hapd,
-                                          struct wpa_driver_ap_params *params)
+u8 * hostapd_unsol_bcast_probe_resp(struct hostapd_data *hapd,
+                                   struct unsol_bcast_probe_resp *ubpr)
 {
        struct probe_resp_params probe_params;
 
        if (!is_6ghz_op_class(hapd->iconf->op_class))
                return NULL;
 
-       params->unsol_bcast_probe_resp_interval =
+       ubpr->unsol_bcast_probe_resp_interval =
                hapd->conf->unsol_bcast_probe_resp_interval;
 
        os_memset(&probe_params, 0, sizeof(probe_params));
@@ -1733,7 +1733,7 @@ static u8 * hostapd_unsol_bcast_probe_resp(struct hostapd_data *hapd,
        probe_params.mld_info = NULL;
 
        hostapd_gen_probe_resp(hapd, &probe_params);
-       params->unsol_bcast_probe_resp_tmpl_len = probe_params.resp_len;
+       ubpr->unsol_bcast_probe_resp_tmpl_len = probe_params.resp_len;
        return (u8 *) probe_params.resp;
 }
 #endif /* CONFIG_IEEE80211AX */
@@ -2546,8 +2546,8 @@ void ieee802_11_free_ap_params(struct wpa_driver_ap_params *params)
        params->fd_frame_tmpl = NULL;
 #endif /* CONFIG_FILS */
 #ifdef CONFIG_IEEE80211AX
-       os_free(params->unsol_bcast_probe_resp_tmpl);
-       params->unsol_bcast_probe_resp_tmpl = NULL;
+       os_free(params->ubpr.unsol_bcast_probe_resp_tmpl);
+       params->ubpr.unsol_bcast_probe_resp_tmpl = NULL;
 #endif /* CONFIG_IEEE80211AX */
        os_free(params->allowed_freqs);
        params->allowed_freqs = NULL;
@@ -2608,8 +2608,8 @@ static int __ieee802_11_set_beacon(struct hostapd_data *hapd)
        params.he_bss_color = hapd->iface->conf->he_op.he_bss_color;
        twt_he_responder = hostapd_get_he_twt_responder(hapd,
                                                        IEEE80211_MODE_AP);
-       params.unsol_bcast_probe_resp_tmpl =
-               hostapd_unsol_bcast_probe_resp(hapd, &params);
+       params.ubpr.unsol_bcast_probe_resp_tmpl =
+               hostapd_unsol_bcast_probe_resp(hapd, &params.ubpr);
 #endif /* CONFIG_IEEE80211AX */
        params.twt_responder =
                twt_he_responder || hostapd_get_ht_vht_twt_responder(hapd);
index b32b2a7d0ecca1f4e61acb86d21ddb6f48bebf8b..e381542a8030eb255802d7dbdea926215e46ee6c 100644 (file)
@@ -33,4 +33,7 @@ void sta_track_claim_taxonomy_info(struct hostapd_iface *iface, const u8 *addr,
 
 const u8 * hostapd_wpa_ie(struct hostapd_data *hapd, u8 eid);
 
+u8 * hostapd_unsol_bcast_probe_resp(struct hostapd_data *hapd,
+                                   struct unsol_bcast_probe_resp *ubpr);
+
 #endif /* BEACON_H */
index 52632154ee4b512e368c97e5ce495b3125bce55c..e2fc8548273e2a7f5a27cda8f6f54fa896680bbe 100644 (file)
@@ -1386,6 +1386,23 @@ struct wowlan_triggers {
        u8 rfkill_release;
 };
 
+struct unsol_bcast_probe_resp {
+       /**
+        * Unsolicited broadcast Probe Response interval in TUs
+        */
+       unsigned int unsol_bcast_probe_resp_interval;
+
+       /**
+        * Unsolicited broadcast Probe Response template data
+        */
+       u8 *unsol_bcast_probe_resp_tmpl;
+
+       /**
+        * Unsolicited broadcast Probe Response template length
+        */
+       size_t unsol_bcast_probe_resp_tmpl_len;
+};
+
 struct wpa_driver_ap_params {
        /**
         * head - Beacon head from IEEE 802.11 header to IEs before TIM IE
@@ -1728,21 +1745,6 @@ struct wpa_driver_ap_params {
         */
        size_t fd_frame_tmpl_len;
 
-       /**
-        * Unsolicited broadcast Probe Response interval in TUs
-        */
-       unsigned int unsol_bcast_probe_resp_interval;
-
-       /**
-        * Unsolicited broadcast Probe Response template data
-        */
-       u8 *unsol_bcast_probe_resp_tmpl;
-
-       /**
-        * Unsolicited broadcast Probe Response template length
-        */
-       size_t unsol_bcast_probe_resp_tmpl_len;
-
        /**
         * mbssid_tx_iface - Transmitting interface of the MBSSID set
         */
@@ -1809,6 +1811,9 @@ struct wpa_driver_ap_params {
         */
        u8 **rnr_elem_offset;
 
+       /* Unsolicited broadcast Probe Response data */
+       struct unsol_bcast_probe_resp ubpr;
+
        /**
         * allowed_freqs - List of allowed 20 MHz channel center frequencies in
         * MHz for AP operation. Drivers which support this parameter will
index c6af0f02f619eba3adcaa37a697e8d46c237bde1..4ad0f39b5d845c011e13485dc22f251c74c03ced 100644 (file)
@@ -4768,7 +4768,7 @@ static int nl80211_fils_discovery(struct i802_bss *bss, struct nl_msg *msg,
 
 static int nl80211_unsol_bcast_probe_resp(struct i802_bss *bss,
                                          struct nl_msg *msg,
-                                         struct wpa_driver_ap_params *params)
+                                         struct unsol_bcast_probe_resp *ubpr)
 {
        struct nlattr *attr;
 
@@ -4781,15 +4781,15 @@ static int nl80211_unsol_bcast_probe_resp(struct i802_bss *bss,
 
        wpa_printf(MSG_DEBUG,
                   "nl80211: Unsolicited broadcast Probe Response frame interval: %u",
-                  params->unsol_bcast_probe_resp_interval);
+                  ubpr->unsol_bcast_probe_resp_interval);
        attr = nla_nest_start(msg, NL80211_ATTR_UNSOL_BCAST_PROBE_RESP);
        if (!attr ||
            nla_put_u32(msg, NL80211_UNSOL_BCAST_PROBE_RESP_ATTR_INT,
-                       params->unsol_bcast_probe_resp_interval) ||
-           (params->unsol_bcast_probe_resp_tmpl &&
+                       ubpr->unsol_bcast_probe_resp_interval) ||
+           (ubpr->unsol_bcast_probe_resp_tmpl &&
             nla_put(msg, NL80211_UNSOL_BCAST_PROBE_RESP_ATTR_TMPL,
-                    params->unsol_bcast_probe_resp_tmpl_len,
-                    params->unsol_bcast_probe_resp_tmpl)))
+                    ubpr->unsol_bcast_probe_resp_tmpl_len,
+                    ubpr->unsol_bcast_probe_resp_tmpl)))
                return -1;
 
        nla_nest_end(msg, attr);
@@ -5374,8 +5374,8 @@ static int wpa_driver_nl80211_set_ap(void *priv,
                        goto fail;
        }
 
-       if (params->unsol_bcast_probe_resp_interval &&
-           nl80211_unsol_bcast_probe_resp(bss, msg, params) < 0)
+       if (params->ubpr.unsol_bcast_probe_resp_interval &&
+           nl80211_unsol_bcast_probe_resp(bss, msg, &params->ubpr) < 0)
                goto fail;
 
        if (nl80211_mbssid(msg, params) < 0)