diff mbox series

[2/2] tests: add ap_unicast_beacon

Message ID 20230105200945.761324-2-raphael.melotte@mind.be
State Changes Requested
Headers show
Series [1/2] hostapd: add support for unicast beacons | expand

Commit Message

Raphaël Mélotte Jan. 5, 2023, 8:09 p.m. UTC
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@mind.be>
---
 tests/hwsim/test_ap_params.py | 20 ++++++++++++++++++++
 1 file changed, 20 insertions(+)
diff mbox series

Patch

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)