[PATCH 1/2] NAN: Add gtk_support configuration parameter

Arowa Suliman arowa at chromium.org
Sun Nov 8 11:19:42 PST 2026


By default, wpa_supplicant advertises GTK/IGTK support in the NAN Cipher
Suite Information attribute capabilities whenever the driver supports
CCMP/GCMP-256 and BIP.

However, some legacy NAN peers fail the 4-way handshake when GTK/IGTK
support is advertised in the Cipher Suite Information capabilities
without a configured group cipher suite, as they omit GTK/IGTK KDEs in
M3/M4 while wpa_supplicant expects them to be present when both peers
advertise GTK support.

Add a 'NAN_SET gtk_support <0|1>' configuration parameter and
nan_set_gtk_support() helper so GTK/IGTK capability advertisement can be
disabled prior to starting NAN for interoperability with such peers.

Signed-off-by: Arowa Suliman <arowa at google.com>
---
 src/nan/nan.c                   | 30 ++++++++++++++++++++++++++++++
 src/nan/nan.h                   |  1 +
 wpa_supplicant/nan_supplicant.c | 19 +++++++++++++++++++
 3 files changed, 50 insertions(+)

diff --git a/src/nan/nan.c b/src/nan/nan.c
index 9a2e4d87..c9e1c8a2 100644
--- a/src/nan/nan.c
+++ b/src/nan/nan.c
@@ -3728,6 +3728,36 @@ int nan_set_beacon_prot(struct nan_data *nan, bool enable)
 }
 
 
+/**
+ * nan_set_gtk_support - Enable or disable NAN GTK/IGTK/BIGTK support
+ * @nan: Pointer to NAN data structure
+ * @enable: true to advertise GTK/IGTK support, false to disable
+ * Returns: 0 on success, -1 on failure
+ */
+int nan_set_gtk_support(struct nan_data *nan, bool enable)
+{
+	u8 gtk_supp;
+
+	if (!nan)
+		return -1;
+
+	if (nan->nan_started) {
+		wpa_printf(MSG_DEBUG,
+			   "NAN: Cannot change GTK support setting while NAN is started");
+		return -1;
+	}
+
+	if (enable)
+		gtk_supp = NAN_CS_INFO_CAPA_GTK_SUPP_NO_BIGTK;
+	else
+		gtk_supp = NAN_CS_INFO_CAPA_GTK_SUPP_NONE;
+
+	nan->cfg->security_capab &= ~NAN_CS_INFO_CAPA_GTK_SUPP_MASK;
+	nan->cfg->security_capab |= gtk_supp << NAN_CS_INFO_CAPA_GTK_SUPP_POS;
+	return 0;
+}
+
+
 /**
  * nan_set_max_ndl_idle_period - Set maximum NDL idle period
  * @nan: Pointer to NAN data structure
diff --git a/src/nan/nan.h b/src/nan/nan.h
index c34789ee..81b92ff1 100644
--- a/src/nan/nan.h
+++ b/src/nan/nan.h
@@ -969,6 +969,7 @@ int nan_ndp_requested_gtk_csid(struct nan_data *nan,
 			       const struct nan_ndp_id *ndp_id);
 int nan_set_mgmt_group_cipher(struct nan_data *nan, int cipher);
 int nan_set_beacon_prot(struct nan_data *nan, bool enable);
+int nan_set_gtk_support(struct nan_data *nan, bool enable);
 int nan_set_max_ndl_idle_period(struct nan_data *nan, u16 max_idle_period);
 bool nan_has_active_ndp(struct nan_data *nan);
 int nan_get_status(struct nan_data *nan, char *buf, size_t buflen);
diff --git a/wpa_supplicant/nan_supplicant.c b/wpa_supplicant/nan_supplicant.c
index acd7e167..c4afdbd5 100644
--- a/wpa_supplicant/nan_supplicant.c
+++ b/wpa_supplicant/nan_supplicant.c
@@ -2458,6 +2458,25 @@ int wpas_nan_set(struct wpa_supplicant *wpa_s, char *cmd)
 		return 0;
 	}
 
+	if (os_strcmp("gtk_support", cmd) == 0) {
+		bool val = !!atoi(param);
+
+		if (val &&
+		    !((wpa_s->drv_enc & (WPA_DRIVER_CAPA_ENC_CCMP |
+					 WPA_DRIVER_CAPA_ENC_GCMP_256)) &&
+		      (wpa_s->drv_enc & (WPA_DRIVER_CAPA_ENC_BIP |
+					 WPA_DRIVER_CAPA_ENC_BIP_GMAC_256)))) {
+			wpa_printf(MSG_INFO,
+				   "NAN: GTK/IGTK protection not supported by the driver");
+			return -1;
+		}
+
+		if (nan_set_gtk_support(wpa_s->nan, val) < 0)
+			return -1;
+
+		return 0;
+	}
+
 #ifdef CONFIG_TESTING_OPTIONS
 	if (os_strcmp("tx_mcast_follow_up_prot", cmd) == 0) {
 		bool val = !!atoi(param);
-- 
2.56.0.398.g882cbad275-goog




More information about the Hostap mailing list