From patchwork Thu Oct 11 13:38:26 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Johannes Berg X-Patchwork-Id: 982495 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=none (mailfrom) smtp.mailfrom=lists.infradead.org (client-ip=2607:7c80:54:e::133; helo=bombadil.infradead.org; envelope-from=hostap-bounces+incoming=patchwork.ozlabs.org@lists.infradead.org; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=sipsolutions.net Authentication-Results: ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="a1FeZXx8"; dkim-atps=neutral Received: from bombadil.infradead.org (bombadil.infradead.org [IPv6:2607:7c80:54:e::133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 42WC8974CJz9s3T for ; Fri, 12 Oct 2018 00:52:25 +1100 (AEDT) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:MIME-Version:Cc:List-Subscribe: List-Help:List-Post:List-Archive:List-Unsubscribe:List-Id:Message-Id:Date: Subject:To:From:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To: References:List-Owner; bh=JDclqwUBH+oR6aCFvf0oalH5+biNOBWRs7m2QCFqw/U=; b=a1F eZXx8z5yM+QLpujGOIKP5UqvT2DG8hX9cSa1tN4bihPp9GfESK3/NQ1LNua2OBhkAnP6+0zWkkeWL MAK0pU23NXyYeadxvC7jp5VZRcC+kxIu6ImyEGvYdm2UPlILUlhhn3bfdS0ETT1lrdO+wsKHN18S+ g/bij4nASGtEdqTLByG3dNWk5wU9ST5Xu0tqFBdswHZmdAEjNIljJJpFFJj+oJ+dfP3jzgPK5dfd8 wdp2rTZtQjLDNLeqACLefENdhnENnhKWDGTZS/CONoFF3jryyUAG+KRbI1epiJzrq/iGNe4yQHbUU Dnw8cf0EfHLJQ1H3zIwbZ/kPEsr+AQQ==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.90_1 #2 (Red Hat Linux)) id 1gAbNk-0003Qs-6c; Thu, 11 Oct 2018 13:52:04 +0000 Received: from s3.sipsolutions.net ([2a01:4f8:191:4433::2] helo=sipsolutions.net) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1gAbNf-0003QN-KW for hostap@lists.infradead.org; Thu, 11 Oct 2018 13:52:02 +0000 Received: by sipsolutions.net with esmtpsa (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.91) (envelope-from ) id 1gAbNP-0004Bc-2i; Thu, 11 Oct 2018 15:51:43 +0200 From: Johannes Berg To: hostap@lists.infradead.org Subject: [PATCH] tests: validate that AP doesn't reflect station frames Date: Thu, 11 Oct 2018 15:38:26 +0200 Message-Id: <20181011133826.24230-1-johannes@sipsolutions.net> X-Mailer: git-send-email 2.14.4 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20181011_065159_672476_2C763D25 X-CRM114-Status: UNSURE ( 8.57 ) X-CRM114-Notice: Please train this message. X-Spam-Score: 0.0 (/) X-Spam-Report: SpamAssassin version 3.4.1 on bombadil.infradead.org summary: Content analysis details: (0.0 points) pts rule name description ---- ---------------------- -------------------------------------------------- X-BeenThere: hostap@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Johannes Berg MIME-Version: 1.0 Sender: "Hostap" Errors-To: hostap-bounces+incoming=patchwork.ozlabs.org@lists.infradead.org From: Johannes Berg Add a new test to check that the AP won't send frames to the client if it tries to talk to itself. Note that this fails until the relevant mac80211 patch is merged. 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 98e52ebf9f08..b31264790530 100644 --- a/tests/hwsim/test_ap_open.py +++ b/tests/hwsim/test_ap_open.py @@ -839,3 +839,30 @@ def test_ap_open_reassoc_same(dev, apdev): hwsim_utils.test_connectivity(dev[0], hapd) finally: dev[0].request("SET reassoc_same_bss_optim 0") + +def test_ap_open_no_reflection(dev, apdev): + """AP with open mode, STA sending packets to itself""" + hapd = hostapd.add_ap(apdev[0], { "ssid": "open" }) + dev[0].connect("open", key_mgmt="NONE", scan_freq="2412") + + ev = hapd.wait_event([ "AP-STA-CONNECTED" ], timeout=5) + if ev is None: + raise Exception("No connection event received from hostapd") + # test normal connectivity is OK + hwsim_utils.test_connectivity(dev[0], hapd) + + # test that we can't talk to ourselves + addr = dev[0].own_addr() + res = dev[0].request('DATA_TEST_CONFIG 1') + try: + assert 'OK' in res + + cmd = "DATA_TEST_TX {} {} {}".format(addr, addr, 0) + dev[0].request(cmd) + + ev = dev[0].wait_event(["DATA-TEST-RX"], timeout=1) + + if ev is not None and "DATA-TEST-RX {} {}".format(addr, addr) in ev: + raise Exception("STA can unexpectedly talk to itself") + finally: + dev[0].request('DATA_TEST_CONFIG 0')