[PATCH 06/15] tests: Add nan_dp_non_overlapping_schedule hwsim test
Andrei Otcheretianski
andrei.otcheretianski at intel.com
Thu Oct 8 09:05:15 PDT 2026
Make sure that if devices have non-overlapping schedules on the same
channel, they will properly fail the NDL negotiation.
Signed-off-by: Andrei Otcheretianski <andrei.otcheretianski at intel.com>
---
tests/hwsim/test_nan.py | 59 +++++++++++++++++++++++++++++++++++++++++
1 file changed, 59 insertions(+)
diff --git a/tests/hwsim/test_nan.py b/tests/hwsim/test_nan.py
index 4d8b753c45..e4db147a5f 100644
--- a/tests/hwsim/test_nan.py
+++ b/tests/hwsim/test_nan.py
@@ -2701,3 +2701,62 @@ def test_nan_stopped_on_iface_removal_with_ndp(dev, apdev, params):
if not radio1_destroyed:
radio1.__exit__(None, None, None)
set_country("00")
+
+def test_nan_dp_non_overlapping_schedule(dev, apdev, params):
+ """NAN NDP rejected when peer schedules never overlap"""
+ with hwsim_nan_radios() as (wpas1, wpas2), \
+ NanDevice(wpas1, "nan0", "ndi0") as pub, \
+ NanDevice(wpas2, "nan1", "ndi1") as sub:
+
+ pssi = "aabbccdd001122334455667788"
+ sssi = "ddbbccaa001122334455667788"
+
+ pid, sid, paddr, saddr = _nan_discover_service(
+ pub, sub, "test_service", pssi, sssi, data_path=True)
+
+ sub_bitmap = "f0ffffff"
+ pub_bitmap = "0e000000"
+
+ if "OK" not in sub.schedule_config((2437, sub_bitmap)):
+ raise Exception("Failed to configure schedule (sub)")
+
+ if "OK" not in sub.ndp_request(sub.ndi_name, sid, paddr, pid,
+ "aabbcc"):
+ raise Exception("NDP request failed")
+
+ ev = pub.wpas.wait_event(["NAN-NDP-REQUEST"], timeout=5)
+ if ev is None:
+ raise Exception("NAN-NDP-REQUEST event not seen")
+
+ data = split_nan_event(ev)
+ ndp_id = data['ndp_id']
+ init_ndi = data['init_ndi']
+
+ if "OK" not in pub.schedule_config((2437, pub_bitmap)):
+ raise Exception("Failed to configure schedule (pub)")
+
+ if "OK" not in pub.ndp_response("accept", saddr, ndi=pub.ndi_name,
+ ndp_id=ndp_id, init_ndi=init_ndi,
+ handle=pid, ssi="ddeeff"):
+ raise Exception("NDP response (accept) failed")
+
+ ev = sub.wpas.wait_event(["NAN-NDP-COUNTER-REQUEST"], timeout=5)
+ if ev is None:
+ raise Exception("NAN-NDP-COUNTER-REQUEST event not seen")
+
+ data = split_nan_event(ev)
+ ndp_id = data['ndp_id']
+ init_ndi = data['init_ndi']
+
+ if "OK" not in sub.ndp_response("accept", paddr, ndi=sub.ndi_name,
+ ndp_id=ndp_id, init_ndi=init_ndi,
+ handle=sid, ssi="11223344"):
+ raise Exception("NDP response (confirm) failed")
+
+ ev = sub.wpas.wait_event(["NAN-NDP-DISCONNECTED"], timeout=5)
+ if ev is None or "failure=1" not in ev:
+ raise Exception("NDP not rejected on subscriber: %s" % ev)
+
+ ev = pub.wpas.wait_event(["NAN-NDP-DISCONNECTED"], timeout=5)
+ if ev is None or "failure=1" not in ev:
+ raise Exception("NDP not rejected on publisher: %s" % ev)
--
2.53.0
More information about the Hostap
mailing list