More generic unsolicited broadcast Probe Response template setup

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>
This commit is contained in:
Rathees Kumar R Chinannan 2024-04-08 12:05:16 +05:30 committed by Jouni Malinen
parent b38f14e13d
commit 7d0c08910b
4 changed files with 39 additions and 31 deletions

View 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);

View 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 */

View 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

View 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)