From patchwork Tue Jun 30 11:53:18 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Markus Theil X-Patchwork-Id: 1319787 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=none (no SPF record) smtp.mailfrom=lists.infradead.org (client-ip=2001:8b0:10b:1231::1; helo=merlin.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=tu-ilmenau.de Authentication-Results: ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=lists.infradead.org header.i=@lists.infradead.org header.a=rsa-sha256 header.s=merlin.20170209 header.b=S9bF42Wd; dkim-atps=neutral Received: from merlin.infradead.org (merlin.infradead.org [IPv6:2001:8b0:10b:1231::1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 49x2rQ0P2fz9sT2 for ; Tue, 30 Jun 2020 21:56:22 +1000 (AEST) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=merlin.20170209; h=Sender:Content-Transfer-Encoding: Content-Type:Cc:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: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:List-Owner; bh=EdY5Xjpb3UCXQlqlGago/OofYvHC2dD/XeRq7OAUHNk=; b=S9bF42Wds7Ixe8BGqvf3JgcBO elSbnGUVYBohDt/8yM8XRv0Pf0oCWllN9YVrKuzSKk/4B0Y60JnKmG/7T+TMlUu2v4p9K2ZkQBj+q Cc4sgdWScGDqzPR6C8h7lpgkWByY6eUTZqJ8M/fGQv93D4ZM26DgP1ZIrdS+mGWp6gnrOfLw4O8ZJ I+2ssxsbPqlWFMfA507E1qlRzWjRpJAdvJKWHWqOmSxtjZ49r8vDWoTUZf3riIP6dElgcicBnAlgN +jDezr9Pwp4NEQFe2xFHyYgy23e+GxMGf82staULKpuoyhN78WBkJYaj+OVJ47Jzlu4pCEY3cybAW 5tAdk/oZQ==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1jqErJ-00007Y-6c; Tue, 30 Jun 2020 11:55:29 +0000 Received: from smail.rz.tu-ilmenau.de ([141.24.186.67]) by merlin.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1jqErB-00005O-Cz for hostap@lists.infradead.org; Tue, 30 Jun 2020 11:55:23 +0000 Received: from legolas.prakinf.tu-ilmenau.de (unknown [141.24.207.116]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smail.rz.tu-ilmenau.de (Postfix) with ESMTPSA id 10D07580082; Tue, 30 Jun 2020 13:55:17 +0200 (CEST) From: Markus Theil To: hostap@lists.infradead.org Subject: [PATCH v4 2/7] mesh: fix channel init order, disable pri/sec channel switch Date: Tue, 30 Jun 2020 13:53:18 +0200 Message-Id: <20200630115323.126143-3-markus.theil@tu-ilmenau.de> X-Mailer: git-send-email 2.27.0 In-Reply-To: <20200630115323.126143-1-markus.theil@tu-ilmenau.de> References: <20200630115323.126143-1-markus.theil@tu-ilmenau.de> MIME-Version: 1.0 X-Spam-Note: CRM114 invocation failed X-Spam-Score: -2.3 (--) X-Spam-Report: SpamAssassin version 3.4.4 on merlin.infradead.org summary: Content analysis details: (-2.3 points) pts rule name description ---- ---------------------- -------------------------------------------------- -2.3 RCVD_IN_DNSWL_MED RBL: Sender listed at https://www.dnswl.org/, medium trust [141.24.186.67 listed in list.dnswl.org] 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record 0.0 SPF_NONE SPF: sender does not publish an SPF Record X-BeenThere: hostap@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Markus Theil , john@phrozen.org Sender: "Hostap" Errors-To: hostap-bounces+incoming=patchwork.ozlabs.org@lists.infradead.org wpa_supplicant_conf_ap_ht has to happen before hostapd_setup_interface in order for its configuration settings to have effect on interface configuration. Disable primary and secondary channel switch because of missing tie breaking rule/frames in mesh networks. A rather long comment about this issue is placed in mesh.c in the corresponding place. In consequence, remove mesh coex test, which contradicts this change. I was not able to reproduce the memory corruption during mesh_secure_ocv_mix_legacy, which lead to a revert of a similar patch in the past. Signed-off-by: Markus Theil --- tests/hwsim/test_wpas_mesh.py | 50 ----------------------------------- wpa_supplicant/mesh.c | 25 ++++++++++++++++-- 2 files changed, 23 insertions(+), 52 deletions(-) diff --git a/tests/hwsim/test_wpas_mesh.py b/tests/hwsim/test_wpas_mesh.py index 64e3cc66d..b7f98468b 100644 --- a/tests/hwsim/test_wpas_mesh.py +++ b/tests/hwsim/test_wpas_mesh.py @@ -929,56 +929,6 @@ def _test_wpas_mesh_open_5ghz(dev, apdev): dev[0].dump_monitor() dev[1].dump_monitor() -def test_wpas_mesh_open_5ghz_coex(dev, apdev): - """Mesh network on 5 GHz band and 20/40 coex change""" - try: - _test_wpas_mesh_open_5ghz_coex(dev, apdev) - finally: - dev[0].request("MESH_GROUP_REMOVE " + dev[0].ifname) - dev[1].request("MESH_GROUP_REMOVE " + dev[1].ifname) - set_world_reg(apdev0=apdev[0], dev0=dev[0]) - dev[0].flush_scan_cache() - dev[1].flush_scan_cache() - -def _test_wpas_mesh_open_5ghz_coex(dev, apdev): - check_mesh_support(dev[0]) - subprocess.call(['iw', 'reg', 'set', 'US']) - - # Start a 20 MHz BSS on channel 40 that would be the secondary channel of - # HT40+ mesh on channel 36. - params = {"ssid": "test-ht40", - "hw_mode": "a", - "channel": "40", - "country_code": "US"} - hapd = hostapd.add_ap(apdev[0], params) - bssid = hapd.own_addr() - - for i in range(2): - for j in range(5): - ev = dev[i].wait_event(["CTRL-EVENT-REGDOM-CHANGE"], timeout=5) - if ev is None: - raise Exception("No regdom change event") - if "alpha2=US" in ev: - break - dev[i].scan_for_bss(bssid, freq=5200) - add_open_mesh_network(dev[i], freq="5180") - - check_mesh_joined_connected(dev) - - freq = dev[0].get_status_field("freq") - if freq != "5200": - raise Exception("Unexpected STATUS freq=" + freq) - sig = dev[0].request("SIGNAL_POLL").splitlines() - if "FREQUENCY=5200" not in sig: - raise Exception("Unexpected SIGNAL_POLL output: " + str(sig)) - - hapd.disable() - dev[0].mesh_group_remove() - dev[1].mesh_group_remove() - check_mesh_group_removed(dev[0]) - check_mesh_group_removed(dev[1]) - dev[0].dump_monitor() - dev[1].dump_monitor() def test_wpas_mesh_open_ht40(dev, apdev): """Mesh and HT40 support difference""" diff --git a/wpa_supplicant/mesh.c b/wpa_supplicant/mesh.c index 8cacf28e1..941c95cfd 100644 --- a/wpa_supplicant/mesh.c +++ b/wpa_supplicant/mesh.c @@ -363,6 +363,29 @@ static int wpa_supplicant_mesh_init(struct wpa_supplicant *wpa_s, conf->basic_rates[rate_len] = -1; } + /* While it can enhance performance to switch the primary channel, which + * is also the secondary channel of another network at the same time), + * to the other primary channel, problems exist with this in mesh networks. + * + * Example with problems: + * - 3 mesh nodes M1-M3, freq (5200, 5180) + * - other node O1, e.g. AP mode, freq (5180, 5200), + * Locations: O1 M1 M2 M3 + * + * M3 can only send frames to M1 over M2, no direct connection is possible + * Start O1, M1 and M3 first, M1 or O1 will switch channels to align with + * each other. M3 does not swap, because M1 or O1 cannot be reached. + * M2 is started afterwards and can either connect to M3 or M1 because of + * this primary secondary channel switch. + * + * Solutions: (1) central coordination -> not always possible + * (2) disable pri/sec channel switch in mesh networks + * + * In AP mode, when all nodes can work independently, this poses of course + * no problem, therefore disable it only in mesh mode.`*/ + conf->no_pri_sec_switch = 1; + wpa_supplicant_conf_ap_ht(wpa_s, ssid, conf); + if (wpa_drv_init_mesh(wpa_s)) { wpa_msg(wpa_s, MSG_ERROR, "Failed to init mesh in driver"); return -1; @@ -374,8 +397,6 @@ static int wpa_supplicant_mesh_init(struct wpa_supplicant *wpa_s, return -1; } - wpa_supplicant_conf_ap_ht(wpa_s, ssid, conf); - return 0; out_free: wpa_supplicant_mesh_deinit(wpa_s);