From patchwork Wed Jan 11 08:44:07 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Johannes Berg X-Patchwork-Id: 713626 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-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 3tz2Wl2772z9sCg for ; Wed, 11 Jan 2017 19:44:51 +1100 (AEDT) Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.87 #1 (Red Hat Linux)) id 1cREWN-0006bD-KY; Wed, 11 Jan 2017 08:44:39 +0000 Received: from s3.sipsolutions.net ([5.9.151.49] helo=sipsolutions.net) by bombadil.infradead.org with esmtps (Exim 4.87 #1 (Red Hat Linux)) id 1cREWK-0006MN-2M for hostap@lists.infradead.org; Wed, 11 Jan 2017 08:44:38 +0000 Received: by sipsolutions.net with esmtpsa (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.88) (envelope-from ) id 1cREVu-0008Is-Bl; Wed, 11 Jan 2017 09:44:10 +0100 From: Johannes Berg To: hostap@lists.infradead.org Subject: [PATCH] tests: add a test for mesh forwarding Date: Wed, 11 Jan 2017 09:44:07 +0100 Message-Id: <20170111084407.22980-1-johannes@sipsolutions.net> X-Mailer: git-send-email 2.9.3 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20170111_004436_320488_6A85388A X-CRM114-Status: UNSURE ( 6.89 ) X-CRM114-Notice: Please train this message. X-Spam-Score: -5.1 (-----) X-Spam-Report: SpamAssassin version 3.4.1 on bombadil.infradead.org summary: Content analysis details: (-5.1 points) pts rule name description ---- ---------------------- -------------------------------------------------- -0.0 RCVD_IN_DNSWL_NONE RBL: Sender listed at http://www.dnswl.org/, no trust [5.9.151.49 listed in list.dnswl.org] -3.2 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] 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 that tests connectivity between two stations that can't reach each other directly in the mesh, but need forwarding on another station to talk to each other. Signed-off-by: Johannes Berg --- tests/hwsim/hwsim_utils.py | 8 ++++++++ tests/hwsim/test_wpas_mesh.py | 23 +++++++++++++++++++++++ 2 files changed, 31 insertions(+) diff --git a/tests/hwsim/hwsim_utils.py b/tests/hwsim/hwsim_utils.py index b2a5814ab779..c74af2f8aa4d 100644 --- a/tests/hwsim/hwsim_utils.py +++ b/tests/hwsim/hwsim_utils.py @@ -187,3 +187,11 @@ def set_powersave(dev, val): (res, data) = dev.cmd_execute(["echo", data, ">", fname], shell=True) if res != 0: raise Exception("Failed to set power save for device") + +def set_group_map(dev, val): + phy = dev.get_driver_status_field("phyname") + fname = '/sys/kernel/debug/ieee80211/%s/hwsim/group' % phy + data = '%d' % val + (res, data) = dev.cmd_execute(["echo", data, ">", fname], shell=True) + if res != 0: + raise Exception("Failed to set group map for %s" % phy) diff --git a/tests/hwsim/test_wpas_mesh.py b/tests/hwsim/test_wpas_mesh.py index 6ea79fceb4d1..9ff85a619bec 100644 --- a/tests/hwsim/test_wpas_mesh.py +++ b/tests/hwsim/test_wpas_mesh.py @@ -17,6 +17,7 @@ from wpasupplicant import WpaSupplicant from utils import HwsimSkip, alloc_fail, fail_test, wait_fail_trigger from tshark import run_tshark from test_ap_ht import set_world_reg +from hwsim_utils import set_group_map def check_mesh_support(dev, secure=False): if "MESH" not in dev.get_capability("modes"): @@ -2034,3 +2035,25 @@ def test_mesh_select_network(dev): check_mesh_peer_connected(dev[0]) check_mesh_peer_connected(dev[1]) hwsim_utils.test_connectivity(dev[0], dev[1]) + +def test_mesh_forwarding(dev): + """Mesh with two stations that can't reach each other directly""" + try: + set_group_map(dev[0], 1) + set_group_map(dev[1], 3) + set_group_map(dev[2], 2) + check_mesh_support(dev[0]) + for i in range(3): + add_open_mesh_network(dev[i]) + check_mesh_group_added(dev[i]) + for i in range(3): + check_mesh_peer_connected(dev[i]) + + hwsim_utils.test_connectivity(dev[0], dev[1]) + hwsim_utils.test_connectivity(dev[1], dev[2]) + hwsim_utils.test_connectivity(dev[0], dev[2]) + finally: + # reset groups + set_group_map(dev[0], 1) + set_group_map(dev[1], 1) + set_group_map(dev[2], 1)