From f429064189c3cdbea8689c142fb6e31dc5403a8d Mon Sep 17 00:00:00 2001 From: Kiran Kumar Lokere Date: Thu, 9 Feb 2023 00:25:30 -0800 Subject: [PATCH] TDLS: Set EHT/MLO information for TDLS STA into the driver Add the copied EHT capabilities into the sta_add() call when adding a TDLS peer. The mld_link_id value was previously only for AP mode, but it can now be used for TDLS links as well to indicate the link on which a single-link-TDLS direct link is negotiated. Signed-off-by: Jouni Malinen --- src/rsn_supp/tdls.c | 9 ++++++--- src/rsn_supp/wpa.h | 4 +++- src/rsn_supp/wpa_i.h | 8 ++++++-- wpa_supplicant/driver_i.h | 5 +++-- wpa_supplicant/wpas_glue.c | 7 ++++++- 5 files changed, 24 insertions(+), 9 deletions(-) diff --git a/src/rsn_supp/tdls.c b/src/rsn_supp/tdls.c index 32d596e4a..e6f5877d2 100644 --- a/src/rsn_supp/tdls.c +++ b/src/rsn_supp/tdls.c @@ -1918,7 +1918,10 @@ static int wpa_tdls_addset_peer(struct wpa_sm *sm, struct wpa_tdls_peer *peer, peer->supp_channels, peer->supp_channels_len, peer->supp_oper_classes, - peer->supp_oper_classes_len); + peer->supp_oper_classes_len, + peer->eht_capabilities, + peer->eht_capab_len, + peer->mld_link_id); } @@ -2087,7 +2090,7 @@ static int wpa_tdls_process_tpk_m1(struct wpa_sm *sm, const u8 *src_addr, peer->initiator = 1; wpa_sm_tdls_peer_addset(sm, peer->addr, 1, 0, 0, NULL, 0, NULL, NULL, NULL, 0, NULL, 0, 0, NULL, 0, - NULL, 0, NULL, 0); + NULL, 0, NULL, 0, NULL, 0, link_id); if (wpa_tdls_send_tpk_m1(sm, peer) == -2) { peer = NULL; goto error; @@ -2870,7 +2873,7 @@ int wpa_tdls_start(struct wpa_sm *sm, const u8 *addr) /* 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, NULL, NULL, 0, NULL, 0, 0, NULL, 0, NULL, 0, - NULL, 0)) { + NULL, 0, NULL, 0, peer->mld_link_id)) { wpa_tdls_disable_peer_link(sm, peer); return -1; } diff --git a/src/rsn_supp/wpa.h b/src/rsn_supp/wpa.h index dfcc3aa02..bf7badb84 100644 --- a/src/rsn_supp/wpa.h +++ b/src/rsn_supp/wpa.h @@ -79,7 +79,9 @@ struct wpa_sm_ctx { size_t ext_capab_len, const u8 *supp_channels, size_t supp_channels_len, const u8 *supp_oper_classes, - size_t supp_oper_classes_len); + size_t supp_oper_classes_len, + const struct ieee80211_eht_capabilities *eht_capab, + size_t eht_capab_len, int mld_link_id); int (*tdls_enable_channel_switch)( void *ctx, const u8 *addr, u8 oper_class, const struct hostapd_freq_params *params); diff --git a/src/rsn_supp/wpa_i.h b/src/rsn_supp/wpa_i.h index b70c54a50..a0c135ec6 100644 --- a/src/rsn_supp/wpa_i.h +++ b/src/rsn_supp/wpa_i.h @@ -410,7 +410,9 @@ wpa_sm_tdls_peer_addset(struct wpa_sm *sm, const u8 *addr, int add, 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_oper_classes, - size_t supp_oper_classes_len) + size_t supp_oper_classes_len, + const struct ieee80211_eht_capabilities *eht_capab, + size_t eht_capab_len, int mld_link_id) { if (sm->ctx->tdls_peer_addset) return sm->ctx->tdls_peer_addset(sm->ctx->ctx, addr, add, @@ -423,7 +425,9 @@ wpa_sm_tdls_peer_addset(struct wpa_sm *sm, const u8 *addr, int add, supp_channels, supp_channels_len, supp_oper_classes, - supp_oper_classes_len); + supp_oper_classes_len, + eht_capab, eht_capab_len, + mld_link_id); return -1; } diff --git a/wpa_supplicant/driver_i.h b/wpa_supplicant/driver_i.h index f0ce7581b..dcf576487 100644 --- a/wpa_supplicant/driver_i.h +++ b/wpa_supplicant/driver_i.h @@ -354,8 +354,9 @@ static inline int wpa_drv_sta_add(struct wpa_supplicant *wpa_s, struct hostapd_sta_add_params *params) { if (wpa_s->driver->sta_add) { - /* Set link_id to -1 as it's needed for AP only */ - params->mld_link_id = -1; + /* Set link_id to -1 for non-TDLS peers */ + if (!(params->flags & WPA_STA_TDLS_PEER)) + params->mld_link_id = -1; return wpa_s->driver->sta_add(wpa_s->drv_priv, params); } return -1; diff --git a/wpa_supplicant/wpas_glue.c b/wpa_supplicant/wpas_glue.c index fb5149f20..80ac7c820 100644 --- a/wpa_supplicant/wpas_glue.c +++ b/wpa_supplicant/wpas_glue.c @@ -795,7 +795,9 @@ static int wpa_supplicant_tdls_peer_addset( const struct ieee80211_he_6ghz_band_cap *he_6ghz_he_capab, 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_oper_classes, size_t supp_oper_classes_len) + const u8 *supp_oper_classes, size_t supp_oper_classes_len, + const struct ieee80211_eht_capabilities *eht_capab, + size_t eht_capab_len, int mld_link_id) { struct wpa_supplicant *wpa_s = ctx; struct hostapd_sta_add_params params; @@ -830,6 +832,9 @@ static int wpa_supplicant_tdls_peer_addset( params.supp_channels_len = supp_channels_len; params.supp_oper_classes = supp_oper_classes; params.supp_oper_classes_len = supp_oper_classes_len; + params.eht_capab = eht_capab; + params.eht_capab_len = eht_capab_len; + params.mld_link_id = mld_link_id; return wpa_drv_sta_add(wpa_s, ¶ms); }