From 5fcc8c5cdf76cd99e02e0209a96d03ed4eae1d2b Mon Sep 17 00:00:00 2001 From: Jouni Malinen Date: Sun, 12 Feb 2017 11:46:13 +0200 Subject: [PATCH] tests: WNM Sleep Mode - protocol testing Signed-off-by: Jouni Malinen --- tests/hwsim/test_wnm.py | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/tests/hwsim/test_wnm.py b/tests/hwsim/test_wnm.py index 37afe0dec..34912098f 100644 --- a/tests/hwsim/test_wnm.py +++ b/tests/hwsim/test_wnm.py @@ -235,6 +235,28 @@ def test_wnm_sleep_mode_rsn_pmf(dev, apdev): raise Exception("No connection event received from hostapd") check_wnm_sleep_mode_enter_exit(hapd, dev[0]) +def test_wnm_sleep_mode_proto(dev, apdev): + """WNM Sleep Mode - protocol testing""" + params = { "ssid": "test-wnm", "wnm_sleep_mode": "1" } + hapd = hostapd.add_ap(apdev[0], params) + bssid = hapd.own_addr() + dev[0].connect("test-wnm", key_mgmt="NONE", scan_freq="2412") + addr = dev[0].own_addr() + + hdr = "d0003a01" + bssid.replace(':', '') + addr.replace(':', '') + bssid.replace(':', '') + "1000" + hapd.set("ext_mgmt_frame_handling", "1") + tests = [ "0a1001", + "0a10015d00", + "0a10015d01", + "0a10015d0400000000", + "0a1001" + 7*("5bff" + 255*"00") + "5d00", + "0a1001ff00" ] + for t in tests: + if "OK" not in hapd.request("MGMT_RX_PROCESS freq=2412 datarate=0 ssi_signal=-30 frame=" + hdr + t): + raise Exception("MGMT_RX_PROCESS failed") + + hapd.set("ext_mgmt_frame_handling", "0") + MGMT_SUBTYPE_ACTION = 13 ACTION_CATEG_WNM = 10 WNM_ACT_BSS_TM_REQ = 7