[RFC 52/97] tests: Support setting TTL for NAN service discovery
Andrei Otcheretianski
andrei.otcheretianski at intel.com
Tue Apr 28 13:05:53 PDT 2026
The default NAN DE behaviour when TTL is not set is to terminate
services after a single SDF transmission.
For sync services, the expiration will be done on the next DW
notification, which usually is enough to complete NDP establishment.
However, for tests that require to keep publishing services for a longer
period, ttl configuration is required.
Add it.
Signed-off-by: Andrei Otcheretianski <andrei.otcheretianski at intel.com>
---
tests/hwsim/test_nan.py | 10 +++++++---
1 file changed, 7 insertions(+), 3 deletions(-)
diff --git a/tests/hwsim/test_nan.py b/tests/hwsim/test_nan.py
index 560672f015..092370eece 100644
--- a/tests/hwsim/test_nan.py
+++ b/tests/hwsim/test_nan.py
@@ -94,7 +94,8 @@ class NanDevice:
def publish(self, service_name, ssi=None, unsolicited=1, solicited=1,
sync=1, match_filter_rx=None, match_filter_tx=None,
- close_proximity=0, pbm=0, nd_pmk=None, cipher_suites=None):
+ close_proximity=0, pbm=0, nd_pmk=None, cipher_suites=None,
+ ttl=None):
cmd = f"NAN_PUBLISH service_name={service_name} sync={sync} srv_proto_type=2 fsd=0"
@@ -122,6 +123,9 @@ class NanDevice:
if nd_pmk is not None:
cmd += f" nd_pmk={nd_pmk}"
+ if ttl is not None:
+ cmd += f" ttl={ttl}"
+
return self.wpas.request(cmd)
def schedule_config(self, *chans, map_id=1):
@@ -1011,11 +1015,11 @@ def test_nan_sched(dev, apdev, params):
finally:
set_country("00")
-def _nan_discover_service(pub, sub, service_name, pssi, sssi):
+def _nan_discover_service(pub, sub, service_name, pssi, sssi, ttl=None):
paddr = pub.wpas.own_addr()
saddr = sub.wpas.own_addr()
- pid = pub.publish(service_name, ssi=pssi)
+ pid = pub.publish(service_name, ssi=pssi, ttl=ttl)
sid = sub.subscribe(service_name, ssi=sssi, active=0)
logger.info(f"Publish ID: {pid}, Subscribe ID: {sid}")
--
2.53.0
More information about the Hostap
mailing list