Multi-AP: Move IE parameters into a struct for extensibility

This makes it easier to extend the information that is encoded in the
Multi-AP element.

Signed-off-by: Manoj Sekar <quic_sekar@quicinc.com>
This commit is contained in:
Manoj Sekar 2024-02-26 18:18:21 +05:30 committed by Jouni Malinen
parent 91b9786ced
commit 61e46f860c
5 changed files with 31 additions and 12 deletions

View file

@ -90,16 +90,17 @@ static int add_associated_sta(struct hostapd_data *hapd,
u8 * hostapd_eid_multi_ap(struct hostapd_data *hapd, u8 *eid)
{
u8 multi_ap_val = 0;
struct multi_ap_params multi_ap = { 0 };
if (!hapd->conf->multi_ap)
return eid;
if (hapd->conf->multi_ap & BACKHAUL_BSS)
multi_ap_val |= MULTI_AP_BACKHAUL_BSS;
if (hapd->conf->multi_ap & FRONTHAUL_BSS)
multi_ap_val |= MULTI_AP_FRONTHAUL_BSS;
return eid + add_multi_ap_ie(eid, 9, multi_ap_val);
if (hapd->conf->multi_ap & BACKHAUL_BSS)
multi_ap.capability |= MULTI_AP_BACKHAUL_BSS;
if (hapd->conf->multi_ap & FRONTHAUL_BSS)
multi_ap.capability |= MULTI_AP_FRONTHAUL_BSS;
return eid + add_multi_ap_ie(eid, 9, &multi_ap);
}

View file

@ -2571,21 +2571,28 @@ size_t mbo_add_ie(u8 *buf, size_t len, const u8 *attr, size_t attr_len)
}
size_t add_multi_ap_ie(u8 *buf, size_t len, u8 value)
size_t add_multi_ap_ie(u8 *buf, size_t len,
const struct multi_ap_params *multi_ap)
{
u8 *pos = buf;
u8 *len_ptr;
if (len < 9)
return 0;
*pos++ = WLAN_EID_VENDOR_SPECIFIC;
*pos++ = 7; /* len */
len_ptr = pos; /* Length field to be set at the end */
pos++;
WPA_PUT_BE24(pos, OUI_WFA);
pos += 3;
*pos++ = MULTI_AP_OUI_TYPE;
/* Multi-AP Extension subelement */
*pos++ = MULTI_AP_SUB_ELEM_TYPE;
*pos++ = 1; /* len */
*pos++ = value;
*pos++ = multi_ap->capability;
*len_ptr = pos - len_ptr - 1;
return pos - buf;
}

View file

@ -30,6 +30,10 @@ struct mb_ies_info {
u8 nof_ies;
};
struct multi_ap_params {
u8 capability;
};
/* Parsed Information Elements */
struct ieee802_11_elems {
const u8 *ssid;
@ -267,7 +271,8 @@ const u8 * get_vendor_ie(const u8 *ies, size_t len, u32 vendor_type);
size_t mbo_add_ie(u8 *buf, size_t len, const u8 *attr, size_t attr_len);
size_t add_multi_ap_ie(u8 *buf, size_t len, u8 value);
size_t add_multi_ap_ie(u8 *buf, size_t len,
const struct multi_ap_params *multi_ap);
struct country_op_class {
u8 country_op_class;

View file

@ -2408,12 +2408,15 @@ mscs_fail:
if (ssid && ssid->multi_ap_backhaul_sta) {
size_t multi_ap_ie_len;
struct multi_ap_params multi_ap = { 0 };
multi_ap.capability = MULTI_AP_BACKHAUL_STA;
multi_ap_ie_len = add_multi_ap_ie(
wpa_s->sme.assoc_req_ie + wpa_s->sme.assoc_req_ie_len,
sizeof(wpa_s->sme.assoc_req_ie) -
wpa_s->sme.assoc_req_ie_len,
MULTI_AP_BACKHAUL_STA);
&multi_ap);
if (multi_ap_ie_len == 0) {
wpa_printf(MSG_ERROR,
"Multi-AP: Failed to build Multi-AP IE");

View file

@ -3809,10 +3809,13 @@ mscs_end:
if (ssid->multi_ap_backhaul_sta) {
size_t multi_ap_ie_len;
struct multi_ap_params multi_ap = { 0 };
multi_ap.capability = MULTI_AP_BACKHAUL_STA;
multi_ap_ie_len = add_multi_ap_ie(wpa_ie + wpa_ie_len,
max_wpa_ie_len - wpa_ie_len,
MULTI_AP_BACKHAUL_STA);
&multi_ap);
if (multi_ap_ie_len == 0) {
wpa_printf(MSG_ERROR,
"Multi-AP: Failed to build Multi-AP IE");