From patchwork Fri Jan 9 11:00:09 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Johannes Berg X-Patchwork-Id: 427040 Return-Path: X-Original-To: patchwork-incoming@ozlabs.org Delivered-To: patchwork-incoming@ozlabs.org Received: from maxx.maxx.shmoo.com (maxx.shmoo.com [205.134.188.171]) by ozlabs.org (Postfix) with ESMTP id 64ADF140146 for ; Fri, 9 Jan 2015 22:00:28 +1100 (AEDT) Received: from localhost (localhost [127.0.0.1]) by maxx.maxx.shmoo.com (Postfix) with ESMTP id 197BC17C0EA; Fri, 9 Jan 2015 06:00:26 -0500 (EST) X-Virus-Scanned: amavisd-new at maxx.shmoo.com Received: from maxx.maxx.shmoo.com ([127.0.0.1]) by localhost (maxx.shmoo.com [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id CPqMHBF0IZzs; Fri, 9 Jan 2015 06:00:25 -0500 (EST) Received: from maxx.shmoo.com (localhost [127.0.0.1]) by maxx.maxx.shmoo.com (Postfix) with ESMTP id 85CA017C126; Fri, 9 Jan 2015 06:00:21 -0500 (EST) X-Original-To: mailman-post+hostap@maxx.shmoo.com Delivered-To: mailman-post+hostap@maxx.shmoo.com Received: from localhost (localhost [127.0.0.1]) by maxx.maxx.shmoo.com (Postfix) with ESMTP id 7B61217C126 for ; Fri, 9 Jan 2015 06:00:20 -0500 (EST) X-Virus-Scanned: amavisd-new at maxx.shmoo.com Received: from maxx.maxx.shmoo.com ([127.0.0.1]) by localhost (maxx.shmoo.com [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id JC4FrlDkyc4g for ; Fri, 9 Jan 2015 06:00:15 -0500 (EST) Received: from sipsolutions.net (s3.sipsolutions.net [5.9.151.49]) (using TLSv1 with cipher AES128-SHA (128/128 bits)) (Client did not present a certificate) by maxx.maxx.shmoo.com (Postfix) with ESMTPS id C5E4A17C0EA for ; Fri, 9 Jan 2015 06:00:15 -0500 (EST) Received: by sipsolutions.net with esmtpsa (TLS1.2:ECDHE_RSA_AES_128_CBC_SHA256:128) (Exim 4.84) (envelope-from ) id 1Y9XIY-0005zF-Ss; Fri, 09 Jan 2015 12:00:11 +0100 From: Johannes Berg To: hostap@lists.shmoo.com Subject: [PATCH v2] hwsim tests: add test to check disconnect in powersave Date: Fri, 9 Jan 2015 12:00:09 +0100 Message-Id: <1420801209-23775-1-git-send-email-johannes@sipsolutions.net> X-Mailer: git-send-email 2.1.1 Cc: Johannes Berg X-BeenThere: hostap@lists.shmoo.com X-Mailman-Version: 2.1.11 Precedence: list List-Id: HostAP Project List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: hostap-bounces@lists.shmoo.com Errors-To: hostap-bounces@lists.shmoo.com From: Johannes Berg 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 --- 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)