[PATCH 03/97] wpa_supplicant: Don't send empty NAN maps to the kernel

Andrei Otcheretianski andrei.otcheretianski at intel.com
Tue Apr 28 13:05:04 PDT 2026


When configuring the peer schedule to the kernel, only add map entries
that have at least one committed channel after filtering. Previously,
n_maps was set unconditionally, resulting in maps with zero channels
being sent to the kernel (and eventually rejected).
This happened with the peers that sent only conditional entries in
the NDP request frame.

Signed-off-by: Andrei Otcheretianski <andrei.otcheretianski at intel.com>
---
 wpa_supplicant/nan_supplicant.c | 11 ++++++++---
 1 file changed, 8 insertions(+), 3 deletions(-)

diff --git a/wpa_supplicant/nan_supplicant.c b/wpa_supplicant/nan_supplicant.c
index 4f2c303006..7c9e7c3e79 100644
--- a/wpa_supplicant/nan_supplicant.c
+++ b/wpa_supplicant/nan_supplicant.c
@@ -270,15 +270,13 @@ static int wpas_nan_set_peer_schedule_cb(void *ctx, const u8 *nmi_addr,
 		wpa_printf(MSG_DEBUG, "NAN: Peer schedule info:");
 		wpa_printf(MSG_DEBUG, "  n_maps=%u", sched->n_maps);
 
-		peer_sched.n_maps = sched->n_maps;
 		for (i = 0; i < sched->n_maps && i < MAX_NUM_NAN_MAPS; i++) {
 			struct nan_schedule_config *sched_cfg =
-				&peer_sched.maps[i].sched;
+				&peer_sched.maps[peer_sched.n_maps].sched;
 
 			wpa_printf(MSG_DEBUG, "  Map %d: map_id=%u",
 				   i, sched->maps[i].map_id);
 
-			peer_sched.maps[i].map_id = sched->maps[i].map_id;
 			sched_cfg->num_channels = 0;
 
 			for (j = 0; j < sched->maps[i].n_chans &&
@@ -289,6 +287,13 @@ static int wpas_nan_set_peer_schedule_cb(void *ctx, const u8 *nmi_addr,
 								 sched_cfg) < 0)
 					goto out;
 			}
+
+			/* Only add map if it has channels after filtering */
+			if (sched_cfg->num_channels > 0) {
+				peer_sched.maps[peer_sched.n_maps].map_id =
+					sched->maps[i].map_id;
+				peer_sched.n_maps++;
+			}
 		}
 	}
 
-- 
2.53.0




More information about the Hostap mailing list