[PATCH 31/55] AP: Support PMKR0Name privacy in FT with a remote R0KH

Ilan Peer ilan.peer at intel.com
Thu Dec 3 02:44:30 PST 2026


When the R0KH is another AP, send a PMKR0Name update RRB message to it
once the FT reassociation with PMKR0Name privacy completes.

Signed-off-by: Ilan Peer <ilan.peer at intel.com>
---
 src/ap/wpa_auth_ft.c | 76 ++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 76 insertions(+)

diff --git a/src/ap/wpa_auth_ft.c b/src/ap/wpa_auth_ft.c
index 009a6c4ba0dc..3b415a2c650b 100644
--- a/src/ap/wpa_auth_ft.c
+++ b/src/ap/wpa_auth_ft.c
@@ -2380,6 +2380,80 @@ static int wpa_ft_pull_pmk_r1(struct wpa_state_machine *sm,
 
 #ifdef CONFIG_PMKSA_PRIVACY
 
+static int wpa_ft_send_r0_name_update(struct wpa_state_machine *sm)
+{
+	struct wpa_authenticator *wpa_auth = sm->wpa_auth;
+	struct ft_remote_r0kh *r0kh, *r0kh_wildcard;
+	const u8 *f_r1kh_id = wpa_auth->conf.r1_key_holder;
+	struct ft_rrb_seq f_seq;
+	u8 *packet;
+	size_t packet_len;
+	int r0kh_timeout = ftRRBseqTimeout + 1;
+	struct tlv_list req_enc[] = {
+		{ .type = FT_RRB_S1KH_ID, .len = ETH_ALEN,
+		  .data = sm->addr },
+		{ .type = FT_RRB_PMK_R0_NAME, .len = WPA_PMK_NAME_LEN,
+		  .data = sm->ft_pmk_r0_name },
+		{ .type = FT_RRB_PMK_R1_NAME, .len = WPA_PMK_NAME_LEN,
+		  .data = sm->pmk_r1_name },
+		{ .type = FT_RRB_ANONCE, .len = WPA_NONCE_LEN,
+		  .data = sm->ANonce },
+		{ .type = FT_RRB_SNONCE, .len = WPA_NONCE_LEN,
+		  .data = sm->SNonce },
+		{ .type = FT_RRB_LAST_EMPTY, .len = 0, .data = NULL },
+	};
+	struct tlv_list req_auth[] = {
+		{ .type = FT_RRB_SEQ, .len = sizeof(f_seq),
+		  .data = (u8 *)&f_seq },
+		{ .type = FT_RRB_R0KH_ID, .len = sm->r0kh_id_len,
+		  .data = sm->r0kh_id },
+		{ .type = FT_RRB_R1KH_ID, .len = FT_R1KH_ID_LEN,
+		  .data = f_r1kh_id },
+		{ .type = FT_RRB_LAST_EMPTY, .len = 0, .data = NULL },
+	};
+
+	wpa_ft_rrb_lookup_r0kh(wpa_auth, sm->r0kh_id, sm->r0kh_id_len,
+			       &r0kh, &r0kh_wildcard);
+	if (r0kh)
+		wpa_ft_rrb_r0kh_replenish(wpa_auth, r0kh, r0kh_timeout);
+	else if (r0kh_wildcard)
+		r0kh = wpa_ft_rrb_add_r0kh(wpa_auth, r0kh_wildcard,
+					   r0kh_wildcard->addr,
+					   sm->r0kh_id, sm->r0kh_id_len,
+					   r0kh_timeout);
+
+	if (!r0kh || is_zero_ether_addr(r0kh->addr) ||
+	    ether_addr_equal(r0kh->addr, wpa_auth->addr)) {
+		wpa_hexdump(MSG_DEBUG,
+			    "FT: No R0KH to send the PMKR0Name update to",
+			    sm->r0kh_id, sm->r0kh_id_len);
+		return -1;
+	}
+
+	if (wpa_ft_new_seq(r0kh->seq, &f_seq) < 0) {
+		wpa_printf(MSG_DEBUG, "FT: Failed to get seq num");
+		return -1;
+	}
+
+	wpa_printf(MSG_DEBUG, "FT: Send PMKR0Name update from " MACSTR
+		   " to remote R0KH address " MACSTR,
+		   MAC2STR(wpa_auth->addr), MAC2STR(r0kh->addr));
+
+	if (wpa_ft_rrb_build(r0kh->key, sizeof(r0kh->key), req_enc, NULL,
+			     req_auth, NULL, wpa_auth->addr,
+			     FT_PACKET_R0KH_R1KH_R0NAME_UPDATE,
+			     &packet, &packet_len) < 0)
+		return -1;
+
+	wpa_ft_rrb_oui_send(wpa_auth, r0kh->addr,
+			    FT_PACKET_R0KH_R1KH_R0NAME_UPDATE,
+			    packet, packet_len);
+	os_free(packet);
+
+	return 0;
+}
+
+
 /*
  * After a successful FT reassociation, the R1KH sends the ANonce and SNonce to
  * the R0KH and the PMKR0Name is recomputed.
@@ -2407,6 +2481,8 @@ void wpa_ft_update_pmk_r0_name(struct wpa_state_machine *sm)
 				     sm->ANonce, sm->SNonce);
 		return;
 	}
+
+	wpa_ft_send_r0_name_update(sm);
 }
 
 #endif /* CONFIG_PMKSA_PRIVACY */
-- 
2.55.0




More information about the Hostap mailing list