From patchwork Tue Apr 23 09:08:08 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: marek@mazekey.pl X-Patchwork-Id: 1926446 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org 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=j8GLwcD1; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=mazekey.pl header.i=@mazekey.pl header.a=rsa-sha256 header.s=x header.b=dFKpLOqL; dkim-atps=neutral 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=patchwork.ozlabs.org) 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 (secp384r1) server-digest SHA384) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4VNxBK3lZjz1ySm for ; Tue, 23 Apr 2024 19:08:57 +1000 (AEST) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:Content-Type: Content-Transfer-Encoding:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:Message-ID:Subject:To:From:Date:MIME-Version: Reply-To:Cc:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To:References: List-Owner; bh=2hFMhGhGa+nez700OiFYNbJ5NYJCzQYkbhNQSTnALT8=; b=j8GLwcD1+/8I9l eXhI/15mPYpGs8Weftnb/0Ry+TXF1sgZF1G7tKQ2O31VGs76HWjjpAl/BiMyy8VsuChMzqP54nVmd aFwryRrc/zJsDirQ4CbeN4rM8RzxG9KEHmcxtv22HZ9E32JMaNZOCdYR2fv0PlF5iacfaA7/X7J4m 1+J+z0BmgwrVwbB3d1a5aPAkR2OZMVcTSPl1hlVyOfttvjO9ZyvrIpqqG+lMvzaOFGOVnvohdLg8u h8/CqypWc2Du3CszWwAhTeHvYK0uiVr8lk5sm1WisHuK9gAURAlOdO6yhL7cHBmoeH8SEpLc6bqMj NviGem162YwMKbGfYuUA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1rzC8W-0000000Gbac-3L84; Tue, 23 Apr 2024 09:08:24 +0000 Received: from host-128054204.seohost-mail.eu ([128.0.54.204]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1rzC8S-0000000GbZS-3lf1 for hostap@lists.infradead.org; Tue, 23 Apr 2024 09:08:23 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=mazekey.pl; s=x; h=Content-Transfer-Encoding:Content-Type:Message-ID:Subject:To:From:Date :MIME-Version:Sender:Reply-To:Cc:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To: References:List-Id:List-Help:List-Unsubscribe:List-Subscribe:List-Post: List-Owner:List-Archive; bh=6vCTi60bgM+c3Qep3qHHrHQ7KszFI55j8fj9Aqv7dRY=; b=d FKpLOqL6dV6ICjqBkf3PMvt2UzS5Kjxz5aYpNFnJxIbI/w+tI51eJWswEJjCkmCwZNecKBOR8m0Xv qVU8UjKwdjqC7uNDWpp++JJQAYeHL5U0CbSKvJqMJPz0JzFHdFqNVUOm9tnEKcuSQ8aldhYWqrR4J a3lSuoF7h4lN5lKJgr4hp3RS4i+kMSHzJ7G2TESOF/lpPe7HmqQV5pIWvyKGIUYjeG8kMsA71gIfh ZqkvveG2I/TrAB2lR+LO4wKWs0aNrW6oxnVaurbkwcGWVSacKc26KBL+mXIK1JNPrCgpwbKLsypEp QHCEK/iqT1sJbMO2chG/i76v6du8iraog==; Received: from host-18821022298.seohost-mail.eu ([188.210.222.98] helo=h28.seohost.pl) by h28.seohost.pl with esmtpsa (TLS1.3) tls TLS_AES_256_GCM_SHA384 (Exim 4.97.1) (envelope-from ) id 1rzC8R-0000000AqM8-1zc1 for hostap@lists.infradead.org; Tue, 23 Apr 2024 11:08:19 +0200 MIME-Version: 1.0 Date: Tue, 23 Apr 2024 11:08:08 +0200 From: marek@mazekey.pl To: hostap@lists.infradead.org Subject: [PATCH] hostapd: fix opclass during CSA with DFS channels Message-ID: X-Sender: marek@mazekey.pl X-Authenticated-Id: marek@mazekey.pl X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240423_020821_773642_AEAA7FB4 X-CRM114-Status: UNSURE ( 6.03 ) X-CRM114-Notice: Please train this message. X-Spam-Score: -0.2 (/) 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: During CSA with DFS channels, disable, enable interface is a part of the algorithm. When interface was enabled old operating class before switch and new channel were used causing mismatch in configure [...] Content analysis details: (-0.2 points, 5.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record -0.0 SPF_PASS SPF: sender matches SPF record -0.1 DKIM_VALID_EF Message has a valid DKIM or DK signature from envelope-from domain -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain 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 During CSA with DFS channels, disable, enable interface is a part of the algorithm. When interface was enabled old operating class before switch and new channel were used causing mismatch in configured_fixed_chan_to_freq function. Example of log when switch from channel 157 to 108 was triggered: "Could not convert op_class 124 channel 108 to operating frequency" Fixes: bb781c763 ("AP: Populate iface->freq before starting AP") Signed-off-by: Marek Kwaczynski Signed-off-by: Marek Kwaczynski --- src/ap/hostapd.c | 7 +++++++ 1 file changed, 7 insertions(+) @@ -4505,6 +4507,11 @@ hostapd_switch_channel_fallback(struct hostapd_iface *iface, iface->freq = freq_params->freq; iface->conf->channel = freq_params->channel; iface->conf->secondary_channel = freq_params->sec_channel_offset; + ieee80211_freq_to_channel_ext(freq_params->freq, freq_params->sec_channel_offset, bw, &op_class, &chan); + if (chan != freq_params->channel) + wpa_printf(MSG_ERROR, "Channel mismatch: %d -> %d", freq_params->channel, chan); + + iface->conf->op_class = op_class; hostapd_set_oper_centr_freq_seg0_idx(iface->conf, seg0_idx); hostapd_set_oper_centr_freq_seg1_idx(iface->conf, seg1_idx); hostapd_set_oper_chwidth(iface->conf, bw); diff --git a/src/ap/hostapd.c b/src/ap/hostapd.c index 130b6ebc6..8d0601e6a 100644 --- a/src/ap/hostapd.c +++ b/src/ap/hostapd.c @@ -4466,6 +4466,8 @@ hostapd_switch_channel_fallback(struct hostapd_iface *iface, { u8 seg0_idx = 0, seg1_idx = 0; enum oper_chan_width bw = CONF_OPER_CHWIDTH_USE_HT; + u8 op_class; + u8 chan; wpa_printf(MSG_DEBUG, "Restarting all CSA-related BSSes");