[PATCH 06/12] MLD STA: Configure pairwise keys using MLD address

Veerendranath Jakkam quic_vjakkam at quicinc.com
Wed Aug 24 22:53:05 PDT 2022


Configure the pairwise keys with MLD address when plubing to driver.
Current changes handling only EAPOL Four-Way handshake.

Signed-off-by: Veerendranath Jakkam <quic_vjakkam at quicinc.com>
---
 src/rsn_supp/wpa.c | 16 ++++++++++++----
 1 file changed, 12 insertions(+), 4 deletions(-)

diff --git a/src/rsn_supp/wpa.c b/src/rsn_supp/wpa.c
index 66b94bd12..8ac22eac9 100644
--- a/src/rsn_supp/wpa.c
+++ b/src/rsn_supp/wpa.c
@@ -1007,6 +1007,7 @@ static int wpa_supplicant_install_ptk(struct wpa_sm *sm,
 	int keylen, rsclen;
 	enum wpa_alg alg;
 	const u8 *key_rsc;
+	u8 *auth_addr;
 
 	if (sm->ptk.installed) {
 		wpa_dbg(sm->ctx->msg_ctx, MSG_DEBUG,
@@ -1046,13 +1047,18 @@ static int wpa_supplicant_install_ptk(struct wpa_sm *sm,
 		wpa_hexdump(MSG_DEBUG, "WPA: RSC", key_rsc, rsclen);
 	}
 
-	if (wpa_sm_set_key(sm, alg, sm->bssid, sm->keyidx_active, 1, key_rsc,
+	if (sm->valid_links)
+		auth_addr = sm->ap_mld_addr;
+	else
+		auth_addr = sm->bssid;
+
+	if (wpa_sm_set_key(sm, alg, auth_addr, sm->keyidx_active, 1, key_rsc,
 			   rsclen, sm->ptk.tk, keylen,
 			   KEY_FLAG_PAIRWISE | key_flag) < 0) {
 		wpa_msg(sm->ctx->msg_ctx, MSG_WARNING,
-			"WPA: Failed to set PTK to the driver (alg=%d keylen=%d bssid="
+			"WPA: Failed to set PTK to the driver (alg=%d keylen=%d auth_addr="
 			MACSTR " idx=%d key_flag=0x%x)",
-			alg, keylen, MAC2STR(sm->bssid),
+			alg, keylen, MAC2STR(auth_addr),
 			sm->keyidx_active, key_flag);
 		return -1;
 	}
@@ -1077,11 +1083,13 @@ static int wpa_supplicant_install_ptk(struct wpa_sm *sm,
 
 static int wpa_supplicant_activate_ptk(struct wpa_sm *sm)
 {
+	const u8 *peer_addr = sm->valid_links ? sm->ap_mld_addr : sm->bssid;
+
 	wpa_dbg(sm->ctx->msg_ctx, MSG_DEBUG,
 		"WPA: Activate PTK (idx=%d bssid=" MACSTR ")",
 		sm->keyidx_active, MAC2STR(sm->bssid));
 
-	if (wpa_sm_set_key(sm, 0, sm->bssid, sm->keyidx_active, 0, NULL, 0,
+	if (wpa_sm_set_key(sm, 0, peer_addr, sm->keyidx_active, 0, NULL, 0,
 			   NULL, 0, KEY_FLAG_PAIRWISE_RX_TX_MODIFY) < 0) {
 		wpa_msg(sm->ctx->msg_ctx, MSG_WARNING,
 			"WPA: Failed to activate PTK for TX (idx=%d bssid="
-- 
2.25.1




More information about the Hostap mailing list