From patchwork Tue Jun 30 11:53:17 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Markus Theil X-Patchwork-Id: 1319783 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=llFAt6fK; 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 49x2rP2wzRz9sRW for ; Tue, 30 Jun 2020 21:56:21 +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=GJsVaf2NFnRRnCOiTpP4LH8/xL3XltXFFSRBiHXGY2Q=; b=llFAt6fK39wAY63SCkUqNqjjO o4tbjIKyVIq3qrSAbI4fp5LlhovUaO4rwglq1aDJkeEBxatLxiYXkEK3w0QIb5RFTrIpU+ynzplGO 7ei0XNLhAAYILTcrQPLu4dnleBGeKjMqk4ET1KQ6NjfJXnIa9qPxkQY42t8FcHZl7AWrvVQLHfRa/ 5ftZ71GXY/yq+YlBcs1+UN3MWtZGej4KoWHL6CvTauLnjJoOmxSyIxC8Dji5aD1P9TgzqLRdcXyjK oG9RZ423IJGk7DkSpvXEMnNtKS3HfykxN5RzRxuBLmMqgfDT8WaWeudqPEUDBYqZ8Cl3aarFvuMFB LpXp2gcwg==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1jqErK-00007n-6q; Tue, 30 Jun 2020 11:55:30 +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-00005R-DW 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 0D470580081; Tue, 30 Jun 2020 13:55:17 +0200 (CEST) From: Markus Theil To: hostap@lists.infradead.org Subject: [PATCH v4 1/7] HE/VHT: fix frequency setup with HE enabled Date: Tue, 30 Jun 2020 13:53:17 +0200 Message-Id: <20200630115323.126143-2-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 Some places in the code base were not using the wrappers like hostapd_set_oper_centr_freq_seg0_idx and friends. This could lead to errors, for example when joining 80 MHz mesh networks. Fix this, by enforcing usage of these wrappers. wpa_supplicant_conf_ap_ht now checks for HE capability before dealing with VHT in order for these wrappers to work, as they first check HE support in the config. While doing these changes, I've noticed that the extra channel setup code for mesh networks in wpa_supplicant/mesh.c should not be necessary anymore and dropped it. wpa_supplicant_conf_ap_ht should handle this setup already. Acked-by: John Crispin Signed-off-by: Markus Theil --- src/ap/dfs.c | 8 ++++---- wpa_supplicant/ap.c | 40 +++++++++++++++++++++++----------------- wpa_supplicant/mesh.c | 24 ------------------------ 3 files changed, 27 insertions(+), 45 deletions(-) diff --git a/src/ap/dfs.c b/src/ap/dfs.c index 3c078b9cb..f62da49a7 100644 --- a/src/ap/dfs.c +++ b/src/ap/dfs.c @@ -1028,7 +1028,7 @@ static int hostapd_dfs_start_channel_switch(struct hostapd_iface *iface) unsigned int i; int err = 1; struct hostapd_hw_modes *cmode = iface->current_mode; - u8 current_vht_oper_chwidth = iface->conf->vht_oper_chwidth; + u8 current_vht_oper_chwidth = hostapd_get_oper_chwidth(iface->conf); wpa_printf(MSG_DEBUG, "%s called (CAC active: %s, CSA active: %s)", __func__, iface->cac_started ? "yes" : "no", @@ -1089,8 +1089,8 @@ static int hostapd_dfs_start_channel_switch(struct hostapd_iface *iface) "freq=%d chan=%d sec_chan=%d", channel->freq, channel->chan, secondary_channel); - new_vht_oper_chwidth = iface->conf->vht_oper_chwidth; - iface->conf->vht_oper_chwidth = current_vht_oper_chwidth; + new_vht_oper_chwidth = hostapd_get_oper_chwidth(iface->conf); + hostapd_set_oper_chwidth(iface->conf, current_vht_oper_chwidth); /* Setup CSA request */ os_memset(&csa_settings, 0, sizeof(csa_settings)); @@ -1130,7 +1130,7 @@ static int hostapd_dfs_start_channel_switch(struct hostapd_iface *iface) iface->freq = channel->freq; iface->conf->channel = channel->chan; iface->conf->secondary_channel = secondary_channel; - iface->conf->vht_oper_chwidth = new_vht_oper_chwidth; + hostapd_set_oper_chwidth(iface->conf, new_vht_oper_chwidth); hostapd_set_oper_centr_freq_seg0_idx(iface->conf, oper_centr_freq_seg0_idx); hostapd_set_oper_centr_freq_seg1_idx(iface->conf, diff --git a/wpa_supplicant/ap.c b/wpa_supplicant/ap.c index 2accf92cd..fe32ae525 100644 --- a/wpa_supplicant/ap.c +++ b/wpa_supplicant/ap.c @@ -52,6 +52,7 @@ static void wpas_conf_ap_vht(struct wpa_supplicant *wpa_s, #ifdef CONFIG_P2P u8 center_chan = 0; u8 channel = conf->channel; + u8 freq_seg_idx; #endif /* CONFIG_P2P */ if (!conf->secondary_channel) @@ -59,19 +60,21 @@ static void wpas_conf_ap_vht(struct wpa_supplicant *wpa_s, /* Use the maximum oper channel width if it's given. */ if (ssid->max_oper_chwidth) - conf->vht_oper_chwidth = ssid->max_oper_chwidth; + hostapd_set_oper_chwidth(conf, ssid->max_oper_chwidth); ieee80211_freq_to_chan(ssid->vht_center_freq2, - &conf->vht_oper_centr_freq_seg1_idx); + &freq_seg_idx); + hostapd_set_oper_centr_freq_seg1_idx(conf, freq_seg_idx); if (!ssid->p2p_group) { if (!ssid->vht_center_freq1 || - conf->vht_oper_chwidth == CHANWIDTH_USE_HT) + hostapd_get_oper_chwidth(conf) == CHANWIDTH_USE_HT) goto no_vht; ieee80211_freq_to_chan(ssid->vht_center_freq1, - &conf->vht_oper_centr_freq_seg0_idx); + &freq_seg_idx); + hostapd_set_oper_centr_freq_seg0_idx(conf, freq_seg_idx); wpa_printf(MSG_DEBUG, "VHT seg0 index %d for AP", - conf->vht_oper_centr_freq_seg0_idx); + hostapd_get_oper_centr_freq_seg0_idx(conf)); return; } @@ -96,14 +99,14 @@ static void wpas_conf_ap_vht(struct wpa_supplicant *wpa_s, * try oper_cwidth 160 MHz first then VHT 80 MHz, if 160 MHz is * not supported. */ - conf->vht_oper_chwidth = CHANWIDTH_160MHZ; + hostapd_set_oper_chwidth(conf, CHANWIDTH_160MHZ); center_chan = wpas_p2p_get_vht160_center(wpa_s, mode, channel); if (center_chan) { wpa_printf(MSG_DEBUG, "VHT center channel %u for auto-selected 160 MHz bandwidth", center_chan); } else { - conf->vht_oper_chwidth = CHANWIDTH_80MHZ; + hostapd_set_oper_chwidth(conf, CHANWIDTH_80MHZ); center_chan = wpas_p2p_get_vht80_center(wpa_s, mode, channel); wpa_printf(MSG_DEBUG, @@ -115,9 +118,9 @@ static void wpas_conf_ap_vht(struct wpa_supplicant *wpa_s, if (!center_chan) goto no_vht; - conf->vht_oper_centr_freq_seg0_idx = center_chan; + hostapd_set_oper_centr_freq_seg0_idx(conf, center_chan); wpa_printf(MSG_DEBUG, "VHT seg0 index %d for P2P GO", - conf->vht_oper_centr_freq_seg0_idx); + hostapd_get_oper_centr_freq_seg0_idx(conf)); return; #endif /* CONFIG_P2P */ @@ -125,9 +128,9 @@ no_vht: wpa_printf(MSG_DEBUG, "No VHT higher bandwidth support for the selected channel %d", conf->channel); - conf->vht_oper_centr_freq_seg0_idx = - conf->channel + conf->secondary_channel * 2; - conf->vht_oper_chwidth = CHANWIDTH_USE_HT; + hostapd_set_oper_centr_freq_seg0_idx(conf, + conf->channel + conf->secondary_channel * 2); + hostapd_set_oper_chwidth(conf, CHANWIDTH_USE_HT); } @@ -231,16 +234,19 @@ int wpa_supplicant_conf_ap_ht(struct wpa_supplicant *wpa_s, HT_CAP_INFO_TX_STBC | HT_CAP_INFO_MAX_AMSDU_SIZE); + /* check this before VHT, because setting oper chan + * width and friends is the same call for HE and VHT + * and checks if conf->ieee8021ax == 1 */ + if (mode->he_capab[wpas_mode_to_ieee80211_mode( + ssid->mode)].he_supported && + ssid->he) + conf->ieee80211ax = 1; + if (mode->vht_capab && ssid->vht) { conf->ieee80211ac = 1; conf->vht_capab |= mode->vht_capab; wpas_conf_ap_vht(wpa_s, ssid, conf, mode); } - - if (mode->he_capab[wpas_mode_to_ieee80211_mode( - ssid->mode)].he_supported && - ssid->he) - conf->ieee80211ax = 1; } } diff --git a/wpa_supplicant/mesh.c b/wpa_supplicant/mesh.c index c085466b1..8cacf28e1 100644 --- a/wpa_supplicant/mesh.c +++ b/wpa_supplicant/mesh.c @@ -333,30 +333,6 @@ static int wpa_supplicant_mesh_init(struct wpa_supplicant *wpa_s, frequency); goto out_free; } - if (ssid->ht40) - conf->secondary_channel = ssid->ht40; - if (conf->hw_mode == HOSTAPD_MODE_IEEE80211A && ssid->vht) { - if (ssid->max_oper_chwidth != DEFAULT_MAX_OPER_CHWIDTH) - conf->vht_oper_chwidth = ssid->max_oper_chwidth; - switch (conf->vht_oper_chwidth) { - case CHANWIDTH_80MHZ: - case CHANWIDTH_80P80MHZ: - ieee80211_freq_to_chan( - frequency, - &conf->vht_oper_centr_freq_seg0_idx); - conf->vht_oper_centr_freq_seg0_idx += ssid->ht40 * 2; - break; - case CHANWIDTH_160MHZ: - ieee80211_freq_to_chan( - frequency, - &conf->vht_oper_centr_freq_seg0_idx); - conf->vht_oper_centr_freq_seg0_idx += ssid->ht40 * 2; - conf->vht_oper_centr_freq_seg0_idx += 40 / 5; - break; - } - ieee80211_freq_to_chan(ssid->vht_center_freq2, - &conf->vht_oper_centr_freq_seg1_idx); - } if (ssid->mesh_basic_rates == NULL) { /* 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); From patchwork Tue Jun 30 11:53:19 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Markus Theil X-Patchwork-Id: 1319782 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=QlIUxuQu; 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 49x2rP2prMz9sRN for ; Tue, 30 Jun 2020 21:56:21 +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=vntVDJUGmiRq5UEWktCs7CkNl8RZyB4Rc/lh8UsLd1U=; b=QlIUxuQuPH/d/1OxVmcHfg0eo xFVIOO5GWehNPw/VyA8r1zdD+GPfV8UOpTEw0NUMI5mQ5jgeiqEDGU9OaxV7/R2XD3U0S3ezT5x6P ofjDheenHmrAqU7kbgNDWss6WKtJx6ck3CR3+rDcDI0B7ie4TA+2CVxNqagkeP9pfzH/pogOG9gVy s04z61ppf5saeseGHtQh1/606YOcAbV3N2z/uCGcFOujfqj/jS2gDPLeutVD+4A4OLv6BXoc8rsqh bwdqzBOWDKCbQJSAnp2CkoLNW3u+9vrKXBGJtziHbSH+T43cMI3N0+YvKy8cGE6m8lLORJsRf2s00 rMMZDvcTA==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1jqErG-00006s-Bi; Tue, 30 Jun 2020 11:55:26 +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-00005P-E4 for hostap@lists.infradead.org; Tue, 30 Jun 2020 11:55:22 +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 1408C580083; Tue, 30 Jun 2020 13:55:17 +0200 (CEST) From: Markus Theil To: hostap@lists.infradead.org Subject: [PATCH v4 3/7] wpa_supplicant: handle HT40 and mode downgrade in AP mode Date: Tue, 30 Jun 2020 13:53:19 +0200 Message-Id: <20200630115323.126143-4-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 This patch adds some missing pieces to the interface configuration of AP/mesh mode in wpa_supplicant. - check for secondary channel and HT40 capability - try to downgrade to 11b if 11g is not available Especially with the HT40 check, this code now performs all settings, which the deleted/duplicated mesh code did. Signed-off-by: Markus Theil --- wpa_supplicant/ap.c | 49 ++++++++++++++++++++++++++++++++++++--------- 1 file changed, 40 insertions(+), 9 deletions(-) diff --git a/wpa_supplicant/ap.c b/wpa_supplicant/ap.c index fe32ae525..e57b1b5a2 100644 --- a/wpa_supplicant/ap.c +++ b/wpa_supplicant/ap.c @@ -134,6 +134,23 @@ no_vht: } +static struct hostapd_hw_modes *wpa_supplicant_find_hw_mode(struct wpa_supplicant *wpa_s, + enum hostapd_hw_mode hw_mode) +{ + struct hostapd_hw_modes *mode = NULL; + int i; + + for (i = 0; i < wpa_s->hw.num_modes; i++) { + if (wpa_s->hw.modes[i].mode == hw_mode) { + mode = &wpa_s->hw.modes[i]; + break; + } + } + + return mode; +} + + int wpa_supplicant_conf_ap_ht(struct wpa_supplicant *wpa_s, struct wpa_ssid *ssid, struct hostapd_config *conf) @@ -147,9 +164,6 @@ int wpa_supplicant_conf_ap_ht(struct wpa_supplicant *wpa_s, return -1; } - /* TODO: enable HT40 if driver supports it; - * drop to 11b if driver does not support 11g */ - /* * Enable HT20 if the driver supports it, by setting conf->ieee80211n * and a mask of allowed capabilities within conf->ht_capab. @@ -158,17 +172,27 @@ int wpa_supplicant_conf_ap_ht(struct wpa_supplicant *wpa_s, */ if (wpa_s->hw.modes) { struct hostapd_hw_modes *mode = NULL; - int i, no_ht = 0; + int no_ht = 0; wpa_printf(MSG_DEBUG, "Determining HT/VHT options based on driver capabilities (freq=%u chan=%u)", ssid->frequency, conf->channel); - for (i = 0; i < wpa_s->hw.num_modes; i++) { - if (wpa_s->hw.modes[i].mode == conf->hw_mode) { - mode = &wpa_s->hw.modes[i]; - break; - } + mode = wpa_supplicant_find_hw_mode(wpa_s, conf->hw_mode); + + /* may drop drop to 11b if driver does not support 11g */ + if (!mode && conf->hw_mode == HOSTAPD_MODE_IEEE80211G) { + conf->hw_mode = HOSTAPD_MODE_IEEE80211B; + wpa_printf(MSG_INFO, + "Try downgrade to IEEE 802.11b as 802.11g is not " + "supported by the current hardware"); + mode = wpa_supplicant_find_hw_mode(wpa_s, conf->hw_mode); + } + + if (!mode) { + wpa_printf(MSG_ERROR, + "No match between requested and supported hw modes found"); + return -1; } #ifdef CONFIG_HT_OVERRIDES @@ -193,6 +217,13 @@ int wpa_supplicant_conf_ap_ht(struct wpa_supplicant *wpa_s, HT_CAP_INFO_SUPP_CHANNEL_WIDTH_SET), ssid->ht40); conf->ieee80211n = 1; + + if (ssid->ht40 && + mode->ht_capab & HT_CAP_INFO_SUPP_CHANNEL_WIDTH_SET) + conf->secondary_channel = ssid->ht40; + else + conf->secondary_channel = 0; + #ifdef CONFIG_P2P if (ssid->p2p_group && conf->hw_mode == HOSTAPD_MODE_IEEE80211A && From patchwork Tue Jun 30 11:53:20 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Markus Theil X-Patchwork-Id: 1319781 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=HFG3vnJj; 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 49x2rP6gC7z9sSd for ; Tue, 30 Jun 2020 21:56:21 +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=5l8ZmNfcAXBUkY68YvIWxgDA64GkNlaJx6Ypd/x9S8E=; b=HFG3vnJjWTnNtnWKcS69Mxdsi JQ0bPkBXM3579dfwJQWRUZ38FkYTaU83jrEikZNAAquX2GgMgOHYJld63IDLg+f0pgMpiTWnJdZgK G816i6IMalZFeP/NFDg8Mjb9rDdNJrNpSq1gFFivq8e5FdcQK/6WFsuH+8bh4ppysgLOIsx/pAEGd jpHr92LHISIk6NDqgOkoaX8r2bI2W12PbyWsLLnuBRQl055nGFXyMoZczsKuZX0VAZVYxDErqRpl5 Bj05OwrcoiGZCvfxkGmfFUShgfk4RWQxNF1jRbsZ9Pi7yA4dPj4epLo9CY17zY/ZUmoTzaKQ0JFiX EerXm3X4Q==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1jqErH-00007D-Hp; Tue, 30 Jun 2020 11:55:27 +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-00005N-RU 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 1A5BC580084; Tue, 30 Jun 2020 13:55:17 +0200 (CEST) From: Markus Theil To: hostap@lists.infradead.org Subject: [PATCH v4 4/7] wpa_supplicant: fix frequency config for non p2p vht/he cases Date: Tue, 30 Jun 2020 13:53:20 +0200 Message-Id: <20200630115323.126143-5-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 Fix compile without CONFIG_P2P and only set secondary channel seg idx if we use a mode supporting a sec channel for vht/he. Signed-off-by: Markus Theil --- wpa_supplicant/ap.c | 23 +++++++++++++---------- 1 file changed, 13 insertions(+), 10 deletions(-) diff --git a/wpa_supplicant/ap.c b/wpa_supplicant/ap.c index e57b1b5a2..d96451cd4 100644 --- a/wpa_supplicant/ap.c +++ b/wpa_supplicant/ap.c @@ -52,8 +52,8 @@ static void wpas_conf_ap_vht(struct wpa_supplicant *wpa_s, #ifdef CONFIG_P2P u8 center_chan = 0; u8 channel = conf->channel; - u8 freq_seg_idx; #endif /* CONFIG_P2P */ + u8 freq_seg_idx; if (!conf->secondary_channel) goto no_vht; @@ -62,24 +62,27 @@ static void wpas_conf_ap_vht(struct wpa_supplicant *wpa_s, if (ssid->max_oper_chwidth) hostapd_set_oper_chwidth(conf, ssid->max_oper_chwidth); - ieee80211_freq_to_chan(ssid->vht_center_freq2, - &freq_seg_idx); - hostapd_set_oper_centr_freq_seg1_idx(conf, freq_seg_idx); - if (!ssid->p2p_group) { - if (!ssid->vht_center_freq1 || - hostapd_get_oper_chwidth(conf) == CHANWIDTH_USE_HT) + if (!ssid->vht_center_freq1) goto no_vht; ieee80211_freq_to_chan(ssid->vht_center_freq1, &freq_seg_idx); hostapd_set_oper_centr_freq_seg0_idx(conf, freq_seg_idx); - wpa_printf(MSG_DEBUG, "VHT seg0 index %d for AP", - hostapd_get_oper_centr_freq_seg0_idx(conf)); + + if (hostapd_get_oper_chwidth(conf) == CHANWIDTH_80P80MHZ) { + ieee80211_freq_to_chan(ssid->vht_center_freq2, + &freq_seg_idx); + hostapd_set_oper_centr_freq_seg1_idx(conf, freq_seg_idx); + } + + wpa_printf(MSG_DEBUG, "VHT seg0 index %d and seg1 index %d for AP", + hostapd_get_oper_centr_freq_seg0_idx(conf), + hostapd_get_oper_centr_freq_seg1_idx(conf)); return; } #ifdef CONFIG_P2P - switch (conf->vht_oper_chwidth) { + switch (hostapd_get_oper_chwidth(conf)) { case CHANWIDTH_80MHZ: case CHANWIDTH_80P80MHZ: center_chan = wpas_p2p_get_vht80_center(wpa_s, mode, channel); From patchwork Tue Jun 30 11:53:21 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Markus Theil X-Patchwork-Id: 1319786 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=hOcfbkLQ; 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 49x2rQ5G4Sz9sT6 for ; Tue, 30 Jun 2020 21:56:20 +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=4YavWPJLg/hMxLkU9CnLZRKBshO9XOz8Wi7iaLC1wwU=; b=hOcfbkLQib+WsuuDhek3NWFHs JRJ6xJ+2+V8Wj/14v3FDgGJxlOJk6i60kJnzvREuU2tve/kXdLBo9TEDchpl8Zri92RRJ6Dech4bX dtqyTo3EMzs2x1XshOb68HX9YSKQdTrvPUs47fbpZTnOe+6MOBmDd5C5Q+sfCacAd24LnDiFtgAS4 bNWMczsnL/qdjTwaz3e0HbPaBnMTJ8bUJ0Xo+WC0jzJoxH0pAZK9iJ3iFHjak3ZVu0PZw+yFs9qoD ojj7upig57JrdXVUV9EXTorIKBGUZBWBTC7J1uas0wTHssTz7ieej4nArbZ3N4boblcJk0oX2WpS/ 9AXiBKUuw==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1jqErL-000083-GZ; Tue, 30 Jun 2020 11:55:31 +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 1jqErD-000063-7b for hostap@lists.infradead.org; Tue, 30 Jun 2020 11:55:24 +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 26F24580085; Tue, 30 Jun 2020 13:55:17 +0200 (CEST) From: Markus Theil To: hostap@lists.infradead.org Subject: [PATCH v4 5/7] wpa_supplicant: enable vht and he in default config parameters Date: Tue, 30 Jun 2020 13:53:21 +0200 Message-Id: <20200630115323.126143-6-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 Enable VHT and HE as default config parameters in order for wpa_supplicant AP mode to use it, if hw support is given. Signed-off-by: Markus Theil --- wpa_supplicant/config.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/wpa_supplicant/config.c b/wpa_supplicant/config.c index 0b4a66ad7..4bae53ba9 100644 --- a/wpa_supplicant/config.c +++ b/wpa_supplicant/config.c @@ -3036,6 +3036,8 @@ void wpa_config_set_network_defaults(struct wpa_ssid *ssid) ssid->wpa_deny_ptk0_rekey = PTK0_REKEY_ALLOW_ALWAYS; ssid->bg_scan_period = DEFAULT_BG_SCAN_PERIOD; ssid->ht = 1; + ssid->vht = 1; + ssid->he = 1; #ifdef IEEE8021X_EAPOL ssid->eapol_flags = DEFAULT_EAPOL_FLAGS; ssid->eap_workaround = DEFAULT_EAP_WORKAROUND; From patchwork Tue Jun 30 11:53:22 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Markus Theil X-Patchwork-Id: 1319784 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=YBZl9dmS; 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 49x2rP6MDhz9sRk for ; Tue, 30 Jun 2020 21:56:21 +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=gv5x3jIO5t3O4o1d0ITSTY9nfQruBreEFrHZ22VLh10=; b=YBZl9dmShhP/EnOyEsYbaSTE6 EvqFxx8KvvCS7x6GuaMs0YmQa/ixhHem05ua8LdP7laJY7Sif5d1X1It9sxGp03kDzhyFhcTEFyW8 DU6tOv5CxBabe0YcCXWRJmWQ70Qgn+qRRmpaFBSkwXrwdiS1ClJ6HpBG/viNBeGk0cFasQ0f3HshL rsMZrrW+SApqXhO9Qun5ITg9kE38P1Fd6kSE/W5f04i5w0TnK2S/W1ZE9x/7ZiowWX+pWB8I+ZDfa E/NC75FVivrHDFVycajGFsNQC5rALPxJtE3dEc3RlrgKu6dgzFnjxLSmSMlv7hgcmyEtjEON7M8JV H36+xlsGQ==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1jqErM-00008H-Af; Tue, 30 Jun 2020 11:55:32 +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 1jqErD-000064-9l for hostap@lists.infradead.org; Tue, 30 Jun 2020 11:55:24 +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 2BBFD580086; Tue, 30 Jun 2020 13:55:17 +0200 (CEST) From: Markus Theil To: hostap@lists.infradead.org Subject: [PATCH v4 6/7] hw_features: better debug messages for some error cases Date: Tue, 30 Jun 2020 13:53:22 +0200 Message-Id: <20200630115323.126143-7-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 Signed-off-by: Markus Theil --- src/common/hw_features_common.c | 29 ++++++++++++++++++++++------- 1 file changed, 22 insertions(+), 7 deletions(-) diff --git a/src/common/hw_features_common.c b/src/common/hw_features_common.c index f6c67a375..3de8eb9cf 100644 --- a/src/common/hw_features_common.c +++ b/src/common/hw_features_common.c @@ -540,13 +540,18 @@ int hostapd_set_freq_params(struct hostapd_freq_params *data, if (center_segment1 || (center_segment0 != 0 && 5000 + center_segment0 * 5 != data->center_freq1 && - 2407 + center_segment0 * 5 != data->center_freq1)) + 2407 + center_segment0 * 5 != data->center_freq1)) { + wpa_printf(MSG_ERROR, "20/40 MHz: center segment 0 (=%i) and center freq 1 (=%i) not in sync", + center_segment0, data->center_freq1); return -1; + } break; case CHANWIDTH_80P80MHZ: if (center_segment1 == center_segment0 + 4 || - center_segment1 == center_segment0 - 4) + center_segment1 == center_segment0 - 4) { + wpa_printf(MSG_ERROR, "80+80 MHz: center segment 1 only 20 MHz apart"); return -1; + } data->center_freq2 = 5000 + center_segment1 * 5; /* fall through */ case CHANWIDTH_80MHZ: @@ -555,8 +560,10 @@ int hostapd_set_freq_params(struct hostapd_freq_params *data, center_segment1) || (oper_chwidth == CHANWIDTH_80P80MHZ && !center_segment1) || - !sec_channel_offset) + !sec_channel_offset) { + wpa_printf(MSG_ERROR, "80/80+80 MHz: center segment 1 wrong or no second channel offset"); return -1; + } if (!center_segment0) { if (channel <= 48) center_segment0 = 42; @@ -582,16 +589,22 @@ int hostapd_set_freq_params(struct hostapd_freq_params *data, center_segment0 == channel - 2 || center_segment0 == channel - 6) data->center_freq1 = 5000 + center_segment0 * 5; - else + else { + wpa_printf(MSG_ERROR, "Wrong coupling between HT and VHT/HE channel setting"); return -1; + } } break; case CHANWIDTH_160MHZ: data->bandwidth = 160; - if (center_segment1) + if (center_segment1) { + wpa_printf(MSG_ERROR, "160 MHz: center segment 1 should not be set"); return -1; - if (!sec_channel_offset) + } + if (!sec_channel_offset) { + wpa_printf(MSG_ERROR, "160 MHz: second channel offset not set"); return -1; + } /* * Note: HT/VHT config and params are coupled. Check if * HT40 channel band is in VHT160 channel band configuration. @@ -605,8 +618,10 @@ int hostapd_set_freq_params(struct hostapd_freq_params *data, center_segment0 == channel - 10 || center_segment0 == channel - 14) data->center_freq1 = 5000 + center_segment0 * 5; - else + else { + wpa_printf(MSG_ERROR, "160 MHz: HT40 channel band is not in 160 MHz band"); return -1; + } break; } From patchwork Tue Jun 30 11:53:23 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Markus Theil X-Patchwork-Id: 1319788 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=vKjQUaa2; 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 49x2rP1gFTz9s6w for ; Tue, 30 Jun 2020 21:56:20 +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=Hy2wz478vRq7lQFuT9U7tmmavyuNtmDT5Bf75KOUhPE=; b=vKjQUaa2VUXCDJ7QciPza5NnT ot8iSIceVouo0Tu9fb+VVwXR+T7PmzdfcCnH9KJgFwy/nH4fCfBDKNH3OuJXkpe5XOAxkl9+Q3HkE m94Wi3oRHHBblsjcB9aGFuFChGqL9/5po2xvJDGr1+lJKek+1l/gjMHarv3sMMvvYBhYadpcZXcie RGZNIagyzyMamY8duoqzQYSAQF0QBduc8yRDGkcTgImBaOxKsSNRyN9KmSp7oshY/SnXrVu0F+MhL I4oStSJ7yi0k/RHgDcBEsxg0jI7d74VnRIaBS5wgXZqOGCxxKEugmHZLLTiSrl04m0TghKy8RYWC3 9Uh41cuMA==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1jqErN-00008a-5q; Tue, 30 Jun 2020 11:55:33 +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 1jqErE-00006U-HA for hostap@lists.infradead.org; Tue, 30 Jun 2020 11:55:25 +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 38921580087; Tue, 30 Jun 2020 13:55:17 +0200 (CEST) From: Markus Theil To: hostap@lists.infradead.org Subject: [PATCH v4 7/7] dfs: use helper functions for vht/he parameters Date: Tue, 30 Jun 2020 13:53:23 +0200 Message-Id: <20200630115323.126143-8-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 Signed-off-by: Markus Theil --- src/ap/dfs.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/ap/dfs.c b/src/ap/dfs.c index f62da49a7..2c914baa2 100644 --- a/src/ap/dfs.c +++ b/src/ap/dfs.c @@ -955,10 +955,12 @@ dfs_downgrade_bandwidth(struct hostapd_iface *iface, int *secondary_channel, if (*skip_radar) { *skip_radar = 0; } else { - if (iface->conf->vht_oper_chwidth == CHANWIDTH_USE_HT) + int oper_chwidth = hostapd_get_oper_chwidth(iface->conf); + + if (oper_chwidth == CHANWIDTH_USE_HT) break; *skip_radar = 1; - iface->conf->vht_oper_chwidth--; + hostapd_set_oper_chwidth(iface->conf, oper_chwidth - 1); } }