From patchwork Tue Nov 3 14:24:59 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ilan Peer X-Patchwork-Id: 539384 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from bombadil.infradead.org (bombadil.infradead.org [IPv6:2001:1868:205::9]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id A96A4140DAE for ; Tue, 3 Nov 2015 23:27:28 +1100 (AEDT) Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1ZtagP-0008Ru-Js; Tue, 03 Nov 2015 12:27:25 +0000 Received: from mga09.intel.com ([134.134.136.24]) by bombadil.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1ZtagJ-0008On-MV for hostap@lists.infradead.org; Tue, 03 Nov 2015 12:27:21 +0000 Received: from fmsmga003.fm.intel.com ([10.253.24.29]) by orsmga102.jf.intel.com with ESMTP; 03 Nov 2015 04:27:04 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.20,238,1444719600"; d="scan'208";a="593153661" Received: from unknown (HELO JED00377.ger.corp.intel.com) ([10.12.217.192]) by FMSMGA003.fm.intel.com with ESMTP; 03 Nov 2015 04:27:02 -0800 From: Ilan Peer To: hostap@lists.infradead.org Subject: [PATCH 4/6] tests: Test no P2P GO move when invitation is in progress Date: Tue, 3 Nov 2015 16:24:59 +0200 Message-Id: <1446560701-30841-5-git-send-email-ilan.peer@intel.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1446560701-30841-1-git-send-email-ilan.peer@intel.com> References: <1446560701-30841-1-git-send-email-ilan.peer@intel.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20151103_042719_921045_D68C00BA X-CRM114-Status: GOOD ( 10.76 ) X-Spam-Score: -6.9 (------) X-Spam-Report: SpamAssassin version 3.4.0 on bombadil.infradead.org summary: Content analysis details: (-6.9 points) pts rule name description ---- ---------------------- -------------------------------------------------- -5.0 RCVD_IN_DNSWL_HI RBL: Sender listed at http://www.dnswl.org/, high trust [134.134.136.24 listed in list.dnswl.org] -0.0 RCVD_IN_MSPIKE_H3 RBL: Good reputation (+3) [134.134.136.24 listed in wl.mailspike.net] -0.0 SPF_PASS SPF: sender matches SPF record -0.0 T_RP_MATCHES_RCVD Envelope sender domain matches handover relay domain -1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1% [score: 0.0000] -0.0 RCVD_IN_MSPIKE_WL Mailspike good senders X-BeenThere: hostap@lists.infradead.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Ilan Peer MIME-Version: 1.0 Sender: "Hostap" Errors-To: hostap-bounces+incoming=patchwork.ozlabs.org@lists.infradead.org Add a test to verify that a P2P GO does not start a CSA once invitation signalling is done, and the P2P client is about to connect. Signed-off-by: Ilan Peer --- tests/hwsim/test_p2p_channel.py | 64 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 64 insertions(+) diff --git a/tests/hwsim/test_p2p_channel.py b/tests/hwsim/test_p2p_channel.py index 53e4ea5..dd89df1 100644 --- a/tests/hwsim/test_p2p_channel.py +++ b/tests/hwsim/test_p2p_channel.py @@ -918,3 +918,67 @@ def test_p2p_go_move_scm_multi(dev, apdev, params): finally: dev[0].global_request("P2P_SET disallow_freq ") dev[0].global_request("SET p2p_go_freq_change_policy 2") + +def test_p2p_delay_go_csa(dev, apdev, params): + """P2P GO CSA delayed when inviting a P2P Device to an active P2P Group [long]""" + if not params['long']: + raise HwsimSkip("Skip test case with long duration due to --long not specified") + + with HWSimRadio(n_channels=2) as (radio, iface): + wpas = WpaSupplicant(global_iface='/tmp/wpas-wlan5') + wpas.interface_add(iface) + + wpas.global_request("SET p2p_no_group_iface 0") + + if wpas.get_mcc() < 2: + raise Exception("New radio does not support MCC") + + addr0 = wpas.p2p_dev_addr() + addr1 = dev[1].p2p_dev_addr() + + try: + hapd = hostapd.add_ap(apdev[0]['ifname'], { "ssid": 'bss-2.4ghz', + "channel": '1' }) + + wpas.connect("bss-2.4ghz", key_mgmt="NONE", scan_freq="2412") + + dev[1].p2p_listen(); + if not wpas.discover_peer(addr1, social=True): + raise Exception("Peer " + addr1 + " not found") + + wpas.global_request("SET p2p_go_freq_change_policy 0") + wpas.dump_monitor() + + logger.info("Start GO on channel 6") + res = autogo(wpas, freq=2437) + go_start = time.time(); + if res['freq'] != "2437": + raise Exception("GO set on a freq=%s instead of 2437" % res['freq']) + + if not dev[1].discover_peer(addr0, social=False): + raise Exception("Peer " + addr1 + " not found") + + pin = dev[1].wps_read_pin() + dev[1].global_request("P2P_CONNECT " + addr0 + " " + pin + " join auth") + dev[1].p2p_listen(); + + logger.info("Sleep while P2P GO CSA is not allowed") + ev = wpas.wait_group_event(["P2P-REMOVE-AND-REFORM-GROUP", + "AP-CSA-FINISHED"], timeout= 29.9 - + (time.time() - go_start)) + if ev is not None: + raise Exception("Unexpected + " + ev + " event") + + logger.info("Starting invitation") + wpas.p2p_go_authorize_client(pin) + wpas.global_request("P2P_INVITE group=" + wpas.group_ifname + " peer=" + addr1) + ev = dev[1].wait_global_event(["P2P-INVITATION-RECEIVED", + "P2P-GROUP-STARTED"], timeout=10) + + if ev is None: + raise Exception("Timeout on invitation on peer") + if "P2P-INVITATION-RECEIVED" in ev: + raise Exception("Unexpected request to accept pre-authorized invitation") + + finally: + wpas.global_request("SET p2p_go_freq_change_policy 2")