[PATCH] NAN: Fix remain-on-channel retry timeout unit

Zhao Dongdong winter91 at foxmail.com
Wed Nov 18 17:26:04 PST 2026


wpas_nan_usd_start_listen_cb() schedules the listen retry with
eloop_register_timeout(0, 500, ...).  The second argument is
microseconds (src/utils/eloop.h), so the "Restart the listen state
after a delay" retry actually fires after 0.5 ms.  With a persistent
remain-on-channel failure this is a tight retry loop: measured on
mac80211_hwsim with the failure branch forced, 7018 ROC requests in
the 5 s discovery wait (~1.4 kHz).

Use 500 ms (0, 500000) instead: 11 requests in 5 s in the same test.
The original commit specifies no delay value; 500 ms is a sane retry
backoff.

Fixes: f6b84cf06666 ("NAN USD: Fix state machine stall seen with listen failure")
Signed-off-by: Zhao Dongdong <zhaodongdong at kylinos.cn>
---
 wpa_supplicant/nan_supplicant.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/wpa_supplicant/nan_supplicant.c b/wpa_supplicant/nan_supplicant.c
index 37813d4..6c39c5f 100644
--- a/wpa_supplicant/nan_supplicant.c
+++ b/wpa_supplicant/nan_supplicant.c
@@ -5447,21 +5447,21 @@ static void wpas_nan_usd_start_listen_cb(struct wpa_radio_work *work,
 				      lwork->forced_addr : NULL) < 0) {
 		unsigned int freq = lwork->freq;
 
 		wpa_printf(MSG_DEBUG,
 			   "NAN: Failed to request the driver to remain on channel (%u MHz) for listen",
 			   freq);
 		eloop_cancel_timeout(wpas_nan_usd_remain_on_channel_timeout,
 				     wpa_s, ELOOP_ALL_CTX);
 		/* Pass freq as a pointer; lwork will already been freed when
 		 * the timeout is executed. */
-		eloop_register_timeout(0, 500,
+		eloop_register_timeout(0, 500000,
 				       wpas_nan_usd_remain_on_channel_timeout,
 				       wpa_s,
 				       (void *) (uintptr_t) freq);
 		wpas_nan_usd_listen_work_done(wpa_s);
 		return;
 	}
 }
 
 
 static int wpas_nan_de_listen(void *ctx, unsigned int freq,




More information about the Hostap mailing list