From patchwork Wed Feb 15 17:02:52 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nicolas Cavallari X-Patchwork-Id: 1742978 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; spf=none (no SPF record) smtp.mailfrom=lists.infradead.org (client-ip=2607:7c80:54:3::133; helo=bombadil.infradead.org; envelope-from=hostap-bounces+incoming=patchwork.ozlabs.org@lists.infradead.org; receiver=) Authentication-Results: legolas.ozlabs.org; dkim=pass (2048-bit key; secure) header.d=lists.infradead.org header.i=@lists.infradead.org header.a=rsa-sha256 header.s=bombadil.20210309 header.b=4DOl2jnN; dkim-atps=neutral Received: from bombadil.infradead.org (bombadil.infradead.org [IPv6:2607:7c80:54:3::133]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-384) server-digest SHA384) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4PH4LN6fw5z23r4 for ; Thu, 16 Feb 2023 04:09:16 +1100 (AEDT) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type: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:Cc:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=yvcRiyltOSspF17ncocdEZmJOL5oibY50XJFT1WZl+c=; b=4DOl2jnN9hVuma 3CMCHzXkWXzlexKenP3Y88OCUeEykkHsoUR7iVfwVWnUbYteTYJvzYvh85x/yg2s98dLJG4p1lKVZ jmcKraZGuZvYhkJ7RJ+kohTvfzWprp+iGuyes16PmtX9rU88ebpn8IJDuTWyNuA9lsw2As+PyYb5B TloaJ7/0u1NzVEoJGCA1/dLDFUVJO7lWZW02/jarbQ11K/5dLTD0ckBa/PG2iyT8tMEwxvGrpJhPx W0LYR2c9YLYgWxzQBBL4bnYWH3RalRHi/4gL8BdwVIwSc4msvnr6wDA94L4sBg7En5bW47yF6LtOQ FbkHEaaod6i+7HtsHMlw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1pSLGY-006cdA-TH; Wed, 15 Feb 2023 17:08:22 +0000 Received: from mout.kundenserver.de ([212.227.126.134]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1pSLGP-006cYX-Px for hostap@lists.infradead.org; Wed, 15 Feb 2023 17:08:15 +0000 Received: from evilbit.green-communications.fr ([92.154.77.116]) by mrelayeu.kundenserver.de (mreue009 [213.165.67.103]) with ESMTPSA (Nemesis) id 1N6bsM-1oUdOI0yGk-017zTf; Wed, 15 Feb 2023 18:08:00 +0100 From: Nicolas Cavallari To: hostap@lists.infradead.org Subject: [PATCH 3/4] wpa_supplicant: Fix creating 6GHz ibss/mesh on 5/6 GHz-capable phys Date: Wed, 15 Feb 2023 18:02:52 +0100 Message-Id: <20230215170253.13949-3-nicolas.cavallari@green-communications.fr> X-Mailer: git-send-email 2.39.1 In-Reply-To: <20230215170253.13949-1-nicolas.cavallari@green-communications.fr> References: <20230215170253.13949-1-nicolas.cavallari@green-communications.fr> MIME-Version: 1.0 X-Provags-ID: V03:K1:tEtUKJqWIQGQel89juHHkeu3odE8fCuutigOW7VwdMwvykmz+uG sUN0Fv/fYHUThNTsx97T3uLj9iSdZc871SrLQ8JduwuRE4/BhnUU9zgQc9XqAbsyTJfnjmQ La/2LtUfRNnbyUrZuHR8AKJUdGW5ofiTZMEisZLPIOlFwSy46CjyE15+WXh5GFaX8Udgv9G HoIx+FgdXvJ1B3309TzZg== X-Spam-Flag: NO UI-OutboundReport: notjunk:1;M01:P0:KFT6rXvuzVU=;Y+OmaskbqAOYk4scJBQNNtc7CAA g6sdcfg4Kgkm/jcfOhQSIBx68QkUpv4t2Zg2/G4Ln5XTHrdwYTAAIjpiZZDWqgi4qfdG7Q6/W GF4sPLV8Y6ickB2RLBbMNfTIR1CEKdb/ivdgVP7MmzFWKEzdIxj0LHLenDFtnKu1zjQ6L5QEc g6y/wgCntOvmwJzuWw1ysz25zh/KOzO48RP1Kxv1CufVmggvdWN2SED1NKW6Y99fnaiwEi+iC TE7rmTGWcsjvLkA1VChGa7CwJKiCuszBpuIfmSw86CjbkYIFM77drJYP4Bi7YpRgrSfQKfKWD tnB06JsOUOIqVLnUJb3v1t6Rc3LKUKWvraTraNtAj/k+XiNq4nQoeVLeRg4sqqpOFI4i1HY9u 8xRuWY9CsiUwvdskfwXZNReu9WyfRWHKnzPnmZsJstPvVB6L05XFYqTzr2KyJwAOzR7xSCL+D PnDYvb/5h18qRoRJQNK7Sx6n0xO2WaF81djubCHJSbgXumEYEBdLNj4zzGfmQi72mTJahI2+E 9yD5hhBZGIcGKzz3uy2IsYE/SiRiZ1kdOx+uyPYZvMBRKfuf3AuN47d+jy4Fu4bJW9lQy6QHe 1f6RQo/IJLk8lv6rqzqEe/7iYvW8+5XXZXCj56kFCVzSSlWPcBI2CDQnp0S5KNdPc11o9DK7Y 2YVFgtFJSSI+OPSuUbx28TTNF1MdMZ75ZpfzcuFslw== X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20230215_090814_146719_8E890F55 X-CRM114-Status: GOOD ( 12.54 ) X-Spam-Score: -0.0 (/) X-Spam-Report: Spam detection software, running on the system "bombadil.infradead.org", has NOT identified this incoming email as spam. The original message has been attached to this so you can view it or label similar future email. If you have any questions, see the administrator of that system for details. Content preview: If the phy supports both 5 GHz and 6 GHz bands, then there will be two different struct hostapd_hw_modes with mode HOSTAPD_MODE_IEEE80211A, one for each band, with potentially different capabilities. Content analysis details: (-0.0 points, 5.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- -0.0 RCVD_IN_DNSWL_NONE RBL: Sender listed at https://www.dnswl.org/, no trust [212.227.126.134 listed in list.dnswl.org] -0.0 SPF_PASS SPF: sender matches SPF record 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record -0.0 RCVD_IN_MSPIKE_H2 RBL: Average reputation (+2) [212.227.126.134 listed in wl.mailspike.net] X-BeenThere: hostap@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "Hostap" Errors-To: hostap-bounces+incoming=patchwork.ozlabs.org@lists.infradead.org If the phy supports both 5 GHz and 6 GHz bands, then there will be two different struct hostapd_hw_modes with mode HOSTAPD_MODE_IEEE80211A, one for each band, with potentially different capabilities. Check that the struct hostapd_hw_modes actually contains the frequency before selecting it. Signed-off-by: Nicolas Cavallari --- wpa_supplicant/wpa_supplicant.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/wpa_supplicant/wpa_supplicant.c b/wpa_supplicant/wpa_supplicant.c index 6dc581ad8..9ed79abab 100644 --- a/wpa_supplicant/wpa_supplicant.c +++ b/wpa_supplicant/wpa_supplicant.c @@ -2996,7 +2996,9 @@ void ibss_mesh_setup_freq(struct wpa_supplicant *wpa_s, hw_mode = ieee80211_freq_to_chan(freq->freq, &channel); for (i = 0; wpa_s->hw.modes && i < wpa_s->hw.num_modes; i++) { - if (wpa_s->hw.modes[i].mode == hw_mode) { + if (wpa_s->hw.modes[i].mode == hw_mode && + hw_mode_get_channel(&wpa_s->hw.modes[i], freq->freq, + NULL) != NULL) { mode = &wpa_s->hw.modes[i]; break; }