[PATCH v2] hwsim tests: add test to check disconnect in powersave

Johannes Berg johannes
Fri Jan 9 03:00:09 PST 2015


From: Johannes Berg <johannes.berg at intel.com>

The kernel had two bugs (one in hwsim and one more important
one in mac80211) in this area, add a test to make sure we can
disconnect without any kernel issues while in powersave.

Change-Id: Iec74967a54926e718af2935a4c9c837c6ce3252c
Signed-off-by: Johannes Berg <johannes.berg at intel.com>
---
 tests/hwsim/test_ap_open.py | 27 +++++++++++++++++++++++++++
 1 file changed, 27 insertions(+)

diff --git a/tests/hwsim/test_ap_open.py b/tests/hwsim/test_ap_open.py
index 7a646b8ab407..ed3373839378 100644
--- a/tests/hwsim/test_ap_open.py
+++ b/tests/hwsim/test_ap_open.py
@@ -201,3 +201,30 @@ def test_ap_open_out_of_memory(dev, apdev):
     # verify that a new interface can still be added when memory allocation does
     # not fail
     hostapd.add_ap(apdev[1]['ifname'], { "ssid": "open" })
+
+def test_ap_open_disconnect_in_ps(dev, apdev):
+    """disconnect with the client in PS to regression-test a kernel bug"""
+    hapd = hostapd.add_ap(apdev[0]['ifname'], { "ssid": "open" })
+    dev[0].connect("open", key_mgmt="NONE", scan_freq="2412",
+                   bg_scan_period="0")
+    ev = hapd.wait_event([ "AP-STA-CONNECTED" ], timeout=5)
+    if ev is None:
+        raise Exception("No connection event received from hostapd")
+
+    def set_ps(val):
+        psf = open('/sys/kernel/debug/ieee80211/phy0/hwsim/ps', 'w')
+        psf.write('%d\n' % val)
+        psf.close()
+
+    # set to manual PS-Poll
+    set_ps(3)
+    try:
+        # inject some traffic
+        sa = hapd.own_addr()
+        da = dev[0].own_addr()
+        hapd.request('DATA_TEST_TX {} {} 0'.format(da, sa))
+
+        # disconnect - with traffic pending - shouldn't cause kernel warnings
+        dev[0].request("DISCONNECT")
+    finally:
+        set_ps(0)
-- 
2.1.1




More information about the Hostap mailing list