TDLS: Support TDLS operations in HE mode for 6 GHz

Determine if the TDLS peer supports TDLS in 6 GHz band based on the HE 6
GHz Band Capabilities element received in the TDLS Setup Response frame.
Indicate the peer's HE 6 GHz capabilities to the driver through
sta_add().

Signed-off-by: Jouni Malinen <jouni@codeaurora.org>
This commit is contained in:
Utkarsh Bhatnagar 2021-07-19 13:42:05 +05:30 committed by Jouni Malinen
parent 1990ee7eee
commit 84b3de8095
6 changed files with 49 additions and 6 deletions

View file

@ -3231,6 +3231,11 @@ int wpa_parse_kde_ies(const u8 *buf, size_t len, struct wpa_eapol_ie_parse *ie)
pos[2] == WLAN_EID_EXT_HE_CAPABILITIES) { pos[2] == WLAN_EID_EXT_HE_CAPABILITIES) {
ie->he_capabilities = pos + 3; ie->he_capabilities = pos + 3;
ie->he_capab_len = pos[1] - 1; ie->he_capab_len = pos[1] - 1;
} else if (*pos == WLAN_EID_EXTENSION &&
pos[1] >= 1 +
sizeof(struct ieee80211_he_6ghz_band_cap) &&
pos[2] == WLAN_EID_EXT_HE_6GHZ_BAND_CAP) {
ie->he_6ghz_capabilities = pos + 3;
} else if (*pos == WLAN_EID_QOS && pos[1] >= 1) { } else if (*pos == WLAN_EID_QOS && pos[1] >= 1) {
ie->qosinfo = pos[2]; ie->qosinfo = pos[2];
} else if (*pos == WLAN_EID_SUPPORTED_CHANNELS) { } else if (*pos == WLAN_EID_SUPPORTED_CHANNELS) {

View file

@ -599,6 +599,7 @@ struct wpa_eapol_ie_parse {
const u8 *vht_capabilities; const u8 *vht_capabilities;
const u8 *he_capabilities; const u8 *he_capabilities;
size_t he_capab_len; size_t he_capab_len;
const u8 *he_6ghz_capabilities;
const u8 *supp_channels; const u8 *supp_channels;
size_t supp_channels_len; size_t supp_channels_len;
const u8 *supp_oper_classes; const u8 *supp_oper_classes;

View file

@ -138,6 +138,7 @@ struct wpa_tdls_peer {
struct ieee80211_vht_capabilities *vht_capabilities; struct ieee80211_vht_capabilities *vht_capabilities;
struct ieee80211_he_capabilities *he_capabilities; struct ieee80211_he_capabilities *he_capabilities;
size_t he_capab_len; size_t he_capab_len;
struct ieee80211_he_6ghz_band_cap *he_6ghz_band_capabilities;
u8 qos_info; u8 qos_info;
@ -707,6 +708,8 @@ static void wpa_tdls_peer_clear(struct wpa_sm *sm, struct wpa_tdls_peer *peer)
peer->vht_capabilities = NULL; peer->vht_capabilities = NULL;
os_free(peer->he_capabilities); os_free(peer->he_capabilities);
peer->he_capabilities = NULL; peer->he_capabilities = NULL;
os_free(peer->he_6ghz_band_capabilities);
peer->he_6ghz_band_capabilities = NULL;
os_free(peer->ext_capab); os_free(peer->ext_capab);
peer->ext_capab = NULL; peer->ext_capab = NULL;
os_free(peer->supp_channels); os_free(peer->supp_channels);
@ -1681,6 +1684,33 @@ static int copy_peer_he_capab(const struct wpa_eapol_ie_parse *kde,
} }
static int copy_peer_he_6ghz_band_capab(const struct wpa_eapol_ie_parse *kde,
struct wpa_tdls_peer *peer)
{
if (!kde->he_6ghz_capabilities) {
wpa_printf(MSG_DEBUG,
"TDLS: No HE 6 GHz band capabilities received");
return 0;
}
if (!peer->he_6ghz_band_capabilities) {
peer->he_6ghz_band_capabilities =
os_zalloc(sizeof(struct ieee80211_he_6ghz_band_cap));
if (peer->he_6ghz_band_capabilities == NULL)
return -1;
}
os_memcpy(peer->he_6ghz_band_capabilities, kde->he_6ghz_capabilities,
sizeof(struct ieee80211_he_6ghz_band_cap));
wpa_hexdump(MSG_DEBUG, "TDLS: Peer 6 GHz band HE capabilities",
peer->he_6ghz_band_capabilities,
sizeof(struct ieee80211_he_6ghz_band_cap));
return 0;
}
static int copy_peer_ext_capab(const struct wpa_eapol_ie_parse *kde, static int copy_peer_ext_capab(const struct wpa_eapol_ie_parse *kde,
struct wpa_tdls_peer *peer) struct wpa_tdls_peer *peer)
{ {
@ -1792,6 +1822,7 @@ static int wpa_tdls_addset_peer(struct wpa_sm *sm, struct wpa_tdls_peer *peer,
peer->vht_capabilities, peer->vht_capabilities,
peer->he_capabilities, peer->he_capabilities,
peer->he_capab_len, peer->he_capab_len,
peer->he_6ghz_band_capabilities,
peer->qos_info, peer->wmm_capable, peer->qos_info, peer->wmm_capable,
peer->ext_capab, peer->ext_capab_len, peer->ext_capab, peer->ext_capab_len,
peer->supp_channels, peer->supp_channels,
@ -1928,7 +1959,8 @@ static int wpa_tdls_process_tpk_m1(struct wpa_sm *sm, const u8 *src_addr,
goto error; goto error;
if (copy_peer_vht_capab(&kde, peer) < 0 || if (copy_peer_vht_capab(&kde, peer) < 0 ||
copy_peer_he_capab(&kde, peer) < 0) copy_peer_he_capab(&kde, peer) < 0 ||
copy_peer_he_6ghz_band_capab(&kde, peer) < 0)
goto error; goto error;
if (copy_peer_ext_capab(&kde, peer) < 0) if (copy_peer_ext_capab(&kde, peer) < 0)
@ -1957,8 +1989,8 @@ static int wpa_tdls_process_tpk_m1(struct wpa_sm *sm, const u8 *src_addr,
"TDLS setup - send own request"); "TDLS setup - send own request");
peer->initiator = 1; peer->initiator = 1;
wpa_sm_tdls_peer_addset(sm, peer->addr, 1, 0, 0, NULL, 0, NULL, wpa_sm_tdls_peer_addset(sm, peer->addr, 1, 0, 0, NULL, 0, NULL,
NULL, NULL, 0, 0, 0, NULL, 0, NULL, 0, NULL, NULL, 0, NULL, 0, 0, NULL, 0,
NULL, 0); NULL, 0, NULL, 0);
if (wpa_tdls_send_tpk_m1(sm, peer) == -2) { if (wpa_tdls_send_tpk_m1(sm, peer) == -2) {
peer = NULL; peer = NULL;
goto error; goto error;
@ -2337,7 +2369,8 @@ static int wpa_tdls_process_tpk_m2(struct wpa_sm *sm, const u8 *src_addr,
goto error; goto error;
if (copy_peer_vht_capab(&kde, peer) < 0 || if (copy_peer_vht_capab(&kde, peer) < 0 ||
copy_peer_he_capab(&kde, peer) < 0) copy_peer_he_capab(&kde, peer) < 0 ||
copy_peer_he_6ghz_band_capab(&kde, peer) < 0)
goto error; goto error;
if (copy_peer_ext_capab(&kde, peer) < 0) if (copy_peer_ext_capab(&kde, peer) < 0)
@ -2724,7 +2757,7 @@ int wpa_tdls_start(struct wpa_sm *sm, const u8 *addr)
/* add the peer to the driver as a "setup in progress" peer */ /* add the peer to the driver as a "setup in progress" peer */
if (wpa_sm_tdls_peer_addset(sm, peer->addr, 1, 0, 0, NULL, 0, NULL, if (wpa_sm_tdls_peer_addset(sm, peer->addr, 1, 0, 0, NULL, 0, NULL,
NULL, NULL, 0, 0, 0, NULL, 0, NULL, 0, NULL, NULL, 0, NULL, 0, 0, NULL, 0, NULL, 0,
NULL, 0)) { NULL, 0)) {
wpa_tdls_disable_peer_link(sm, peer); wpa_tdls_disable_peer_link(sm, peer);
return -1; return -1;

View file

@ -71,6 +71,7 @@ struct wpa_sm_ctx {
const struct ieee80211_vht_capabilities *vht_capab, const struct ieee80211_vht_capabilities *vht_capab,
const struct ieee80211_he_capabilities *he_capab, const struct ieee80211_he_capabilities *he_capab,
size_t he_capab_len, size_t he_capab_len,
const struct ieee80211_he_6ghz_band_cap *he_6ghz_capab,
u8 qosinfo, int wmm, const u8 *ext_capab, u8 qosinfo, int wmm, const u8 *ext_capab,
size_t ext_capab_len, const u8 *supp_channels, size_t ext_capab_len, const u8 *supp_channels,
size_t supp_channels_len, size_t supp_channels_len,

View file

@ -400,6 +400,7 @@ wpa_sm_tdls_peer_addset(struct wpa_sm *sm, const u8 *addr, int add,
const struct ieee80211_vht_capabilities *vht_capab, const struct ieee80211_vht_capabilities *vht_capab,
const struct ieee80211_he_capabilities *he_capab, const struct ieee80211_he_capabilities *he_capab,
size_t he_capab_len, size_t he_capab_len,
const struct ieee80211_he_6ghz_band_cap *he_6ghz_capab,
u8 qosinfo, int wmm, const u8 *ext_capab, u8 qosinfo, int wmm, const u8 *ext_capab,
size_t ext_capab_len, const u8 *supp_channels, size_t ext_capab_len, const u8 *supp_channels,
size_t supp_channels_len, const u8 *supp_oper_classes, size_t supp_channels_len, const u8 *supp_oper_classes,
@ -411,7 +412,7 @@ wpa_sm_tdls_peer_addset(struct wpa_sm *sm, const u8 *addr, int add,
supp_rates_len, ht_capab, supp_rates_len, ht_capab,
vht_capab, vht_capab,
he_capab, he_capab_len, he_capab, he_capab_len,
qosinfo, wmm, he_6ghz_capab, qosinfo, wmm,
ext_capab, ext_capab_len, ext_capab, ext_capab_len,
supp_channels, supp_channels,
supp_channels_len, supp_channels_len,

View file

@ -780,6 +780,7 @@ static int wpa_supplicant_tdls_peer_addset(
const struct ieee80211_vht_capabilities *vht_capab, const struct ieee80211_vht_capabilities *vht_capab,
const struct ieee80211_he_capabilities *he_capab, const struct ieee80211_he_capabilities *he_capab,
size_t he_capab_len, size_t he_capab_len,
const struct ieee80211_he_6ghz_band_cap *he_6ghz_he_capab,
u8 qosinfo, int wmm, const u8 *ext_capab, size_t ext_capab_len, u8 qosinfo, int wmm, const u8 *ext_capab, size_t ext_capab_len,
const u8 *supp_channels, size_t supp_channels_len, const u8 *supp_channels, size_t supp_channels_len,
const u8 *supp_oper_classes, size_t supp_oper_classes_len) const u8 *supp_oper_classes, size_t supp_oper_classes_len)
@ -805,6 +806,7 @@ static int wpa_supplicant_tdls_peer_addset(
params.vht_capabilities = vht_capab; params.vht_capabilities = vht_capab;
params.he_capab = he_capab; params.he_capab = he_capab;
params.he_capab_len = he_capab_len; params.he_capab_len = he_capab_len;
params.he_6ghz_capab = he_6ghz_he_capab;
params.qosinfo = qosinfo; params.qosinfo = qosinfo;
params.listen_interval = 0; params.listen_interval = 0;
params.supp_rates = supp_rates; params.supp_rates = supp_rates;