[PATCH 12/21] AP: wpa_auth: Detangle the BIGTK installation logic a bit

Benjamin Berg benjamin at sipsolutions.net
Tue Oct 27 06:16:58 PDT 2026


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

The wpa_group_config_group_keys function would unconditionally install
the key if called on the transmitting BSSID but would skip doing so when
called on the non-transmitting BSSID and the bigtk_configured boolean is
set.

Clear the bigtk_configured value when a new key is generated and make
the logic a bit more straight forward by always checking
bigtk_configured. The effect is the same, but the logic of the function
becomes a bit easier to follow.

This changes the control flow of the function slightly in preparation of
installing the CIGTK later.

Signed-off-by: Benjamin Berg <benjamin.berg at intel.com>
Reviewed-by: Andrei Otcheretianski <andrei.otcheretianski at intel.com>
---
 src/ap/wpa_auth.c | 35 +++++++++++++----------------------
 1 file changed, 13 insertions(+), 22 deletions(-)

diff --git a/src/ap/wpa_auth.c b/src/ap/wpa_auth.c
index 699a3d2b0a..3d773d0cbf 100644
--- a/src/ap/wpa_auth.c
+++ b/src/ap/wpa_auth.c
@@ -6042,6 +6042,7 @@ static int wpa_gtk_update(struct wpa_authenticator *wpa_auth,
 			   group->BIGTK[group->GN_bigtk - 6], len) < 0)
 		return -1;
 	group->bigtk_set = true;
+	group->bigtk_configured = false;
 	wpa_hexdump_key(MSG_DEBUG, "BIGTK",
 			group->BIGTK[group->GN_bigtk - 6], len);
 
@@ -6359,34 +6360,24 @@ static int wpa_group_config_group_keys(struct wpa_authenticator *wpa_auth,
 			     KEY_FLAG_GROUP_TX_DEFAULT) < 0)
 		ret = -1;
 
-	/* Skip setting of BIGTK in following cases:
-	 * PMF is not enabled and no beacon protection requirement for any of
-	 * the non TX BSSs in the MBSSID set.
-	 * Groups with a non-zero VLAN ID since only a single BIGTK is shared
-	 * for all VLANs in a BSS.
-	 * If beacon protection is enabled neither in the TX BSS nor in any of
-	 * the non-TX BSS.
-	 */
-	if (!wpa_auth->non_tx_beacon_prot && !wpa_auth_pmf_enabled(conf))
-		return ret;
-
-	if (ret || (!conf->beacon_prot && !wpa_auth->non_tx_beacon_prot) ||
-	    group->vlan_id)
+	if (ret || group->vlan_id)
 		return ret;
 
+	/* Switch to transmitting BSSID for BIGTK */
 	if (wpa_auth->conf.tx_bss_auth) {
 		wpa_auth = wpa_auth->conf.tx_bss_auth;
 		group = wpa_auth->group;
-		if (!group->bigtk_set || group->bigtk_configured)
-			return ret;
 	}
-	if (wpa_auth_set_key(wpa_auth, group->vlan_id, alg,
-			     broadcast_ether_addr, group->GN_bigtk,
-			     group->BIGTK[group->GN_bigtk - 6], len,
-			     KEY_FLAG_GROUP_TX_DEFAULT) < 0)
-		ret = -1;
-	else
-		group->bigtk_configured = true;
+
+	if (group->bigtk_set && !group->bigtk_configured) {
+		if (wpa_auth_set_key(wpa_auth, group->vlan_id, alg,
+				     broadcast_ether_addr, group->GN_bigtk,
+				     group->BIGTK[group->GN_bigtk - 6], len,
+				     KEY_FLAG_GROUP_TX_DEFAULT) < 0)
+			return -1;
+		else
+			group->bigtk_configured = true;
+	}
 
 	return ret;
 }
-- 
2.56.0




More information about the Hostap mailing list