[PATCH 17/21] AP: Also reset CIPN when receiving the RESET_PN command

Benjamin Berg benjamin at sipsolutions.net
Tue Oct 27 06:17:03 PDT 2026


From: Benjamin Berg <benjamin.berg at intel.com>

This simply adds the code to reset the CIPN when receiving the command.

Signed-off-by: Benjamin Berg <benjamin.berg at intel.com>
Reviewed-by: Andrei Otcheretianski <andrei.otcheretianski at intel.com>
---
 hostapd/ctrl_iface.c | 26 ++++++++++++++++++++++++++
 1 file changed, 26 insertions(+)

diff --git a/hostapd/ctrl_iface.c b/hostapd/ctrl_iface.c
index c53e33bed7..a5bc6a2b66 100644
--- a/hostapd/ctrl_iface.c
+++ b/hostapd/ctrl_iface.c
@@ -2256,6 +2256,32 @@ static int hostapd_ctrl_reset_pn(struct hostapd_data *hapd, const char *cmd)
 					   KEY_FLAG_GROUP_TX_DEFAULT);
 	}
 
+	if (is_broadcast_ether_addr(addr) && os_strstr(cmd, " CIGTK")) {
+		if (!hapd->last_cigtk_key_idx)
+			return -1;
+
+		wpa_printf(MSG_INFO, "TESTING: Reset CIPN for CIGTK");
+
+		/* First, use a zero key to avoid any possible duplicate key
+		 * avoidance in the driver. */
+		if (hostapd_drv_set_key(hapd->conf->iface, hapd,
+					WPA_ALG_GCMP_256,
+					broadcast_ether_addr,
+					hapd->last_cigtk_key_idx, 0, 1, NULL, 0,
+					zero, WPA_CIGTK_LEN,
+					KEY_FLAG_CIGTK | KEY_FLAG_TX) < 0)
+			return -1;
+
+		/* Set the previously configured key to reset its TSC */
+		return hostapd_drv_set_key(hapd->conf->iface, hapd,
+					   WPA_ALG_GCMP_256,
+					   broadcast_ether_addr,
+					   hapd->last_cigtk_key_idx, 0, 1, NULL,
+					   0, hapd->last_cigtk,
+					   WPA_CIGTK_LEN,
+					   KEY_FLAG_CIGTK | KEY_FLAG_TX);
+	}
+
 	if (is_broadcast_ether_addr(addr) && os_strstr(cmd, "IGTK")) {
 		if (hapd->last_igtk_alg == WPA_ALG_NONE)
 			return -1;
-- 
2.56.0




More information about the Hostap mailing list