[PATCH 2/2] NAN: Add ndc_in_req configuration parameter to propose NDC in M1

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


While the NAN specification makes the NAN Data Cluster (NDC) attribute
optional in NDP Request (M1) frames so that the responder can select the
NDC in M2, some legacy NAN peers expect the initiator to propose an
initial NDC in M1 even when no NDC has been established yet, and
otherwise reply in M2 without an NDC attribute, causing data path setup
to fail.

Add a 'NAN_SET ndc_in_req <0|1>' configuration parameter (stored in
wpa_s->nan_ndc_in_req, defaulting to false) to allow configuring
wpas_nan_select_ndc() to always include a proposed NDC attribute in
outgoing NDP Request (M1) frames for interoperability with such peers.

Signed-off-by: Arowa Suliman <arowa at google.com>
---
 wpa_supplicant/nan_supplicant.c   | 10 ++++++++--
 wpa_supplicant/wpa_supplicant_i.h |  1 +
 2 files changed, 9 insertions(+), 2 deletions(-)

diff --git a/wpa_supplicant/nan_supplicant.c b/wpa_supplicant/nan_supplicant.c
index c4afdbd5..abeb2df1 100644
--- a/wpa_supplicant/nan_supplicant.c
+++ b/wpa_supplicant/nan_supplicant.c
@@ -2477,6 +2477,11 @@ int wpas_nan_set(struct wpa_supplicant *wpa_s, char *cmd)
 		return 0;
 	}
 
+	if (os_strcmp("ndc_in_req", cmd) == 0) {
+		wpa_s->nan_ndc_in_req = !!atoi(param);
+		return 0;
+	}
+
 #ifdef CONFIG_TESTING_OPTIONS
 	if (os_strcmp("tx_mcast_follow_up_prot", cmd) == 0) {
 		bool val = !!atoi(param);
@@ -3354,11 +3359,12 @@ static int wpas_nan_select_ndc(struct wpa_supplicant *wpa_s,
 	bool slot_selected = false;
 	int i;
 
-	if (ndp->type == NAN_NDP_ACTION_REQ) {
+	if (ndp->type == NAN_NDP_ACTION_REQ && !wpa_s->nan_ndc_in_req) {
 		/*
 		 * The NDC attribute is optional in a Request, so propose an
 		 * established NDC if there is one and otherwise let the peer
-		 * decide.
+		 * decide, unless configured to always include an NDC in
+		 * Request frames.
 		 */
 		if (wpa_s->nan_ndc.valid)
 			wpas_nan_select_established_ndc(wpa_s, ndp);
diff --git a/wpa_supplicant/wpa_supplicant_i.h b/wpa_supplicant/wpa_supplicant_i.h
index 0fc12296..b4d4350d 100644
--- a/wpa_supplicant/wpa_supplicant_i.h
+++ b/wpa_supplicant/wpa_supplicant_i.h
@@ -1838,6 +1838,7 @@ struct wpa_supplicant {
 		/* Peer of a locally selected NDC that didn't connect yet */
 		u8 pending_peer_nmi[ETH_ALEN];
 	} nan_ndc;
+	bool nan_ndc_in_req;
 #ifdef CONFIG_TESTING_OPTIONS
 	bool nan_force_conditional_sched;
 #endif /* CONFIG_TESTING_OPTIONS */
-- 
2.56.0.398.g882cbad275-goog




More information about the Hostap mailing list