[PATCH 2/2] tests: add ap_unicast_beacon

Raphaël Mélotte raphael.melotte at mind.be
Thu Jan 5 12:09:45 PST 2023


This test verifies that when beacon_da is set to the MAC address of a
specific station, beacon frames are sent with that MAC address as the
destination (and the station can still connect).

Signed-off-by: Raphaël Mélotte <raphael.melotte at mind.be>
---
 tests/hwsim/test_ap_params.py | 20 ++++++++++++++++++++
 1 file changed, 20 insertions(+)

diff --git a/tests/hwsim/test_ap_params.py b/tests/hwsim/test_ap_params.py
index 2b4c3720b..1b62c7e2e 100644
--- a/tests/hwsim/test_ap_params.py
+++ b/tests/hwsim/test_ap_params.py
@@ -971,3 +971,23 @@ def test_ap_airtime_policy_per_bss_limit_invalid(dev, apdev):
     dev[0].connect(ssid, psk=passphrase, scan_freq="2412")
     dev[1].connect(ssid, psk=passphrase, scan_freq="2412")
     time.sleep(1)
+
+def test_ap_unicast_beacon(dev, apdev, params):
+    """Unicast beacons"""
+    ssid = "unicast_beacon"
+    passphrase = 'qwertyuiop'
+    cap = os.path.join(params['logdir'], "hwsim0.pcapng")
+    params = hostapd.wpa2_params(ssid=ssid, passphrase=passphrase)
+    mac = dev[0].own_addr()
+    params["beacon_da"] = mac
+    hapd = hostapd.add_ap(apdev[0], params)
+
+    dev[0].connect(ssid, psk=passphrase, scan_freq="2412")
+    hwsim_utils.test_connectivity(dev[0], hapd)
+
+    out = run_tshark(cap, 'wlan.fc.type_subtype == 0x08', ['wlan.da'])
+    res = out.splitlines()
+    for da in res:
+        if da != mac:
+            raise Exception("Unexpected destination MAC in beacon frame: %s"
+                            % da)
-- 
2.38.1




More information about the Hostap mailing list