From patchwork Mon Jul 1 13:34:08 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sven Eckelmann X-Patchwork-Id: 1125322 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=none (mailfrom) smtp.mailfrom=lists.infradead.org (client-ip=2607:7c80:54:e::133; helo=bombadil.infradead.org; envelope-from=hostap-bounces+incoming=patchwork.ozlabs.org@lists.infradead.org; receiver=) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=narfation.org Authentication-Results: ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="QmC1hzra"; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=narfation.org header.i=@narfation.org header.b="tKRzX8wm"; dkim-atps=neutral Received: from bombadil.infradead.org (bombadil.infradead.org [IPv6:2607:7c80:54:e::133]) (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 45cpHz37ksz9sPF for ; Mon, 1 Jul 2019 23:34:23 +1000 (AEST) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version: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:In-Reply-To:References: List-Owner; bh=aB9FVx2FZIcFSZqeq9xzxw5l7N06/14+dgNzXfStntk=; b=QmC1hzrasmBqf3 JpsxXd5wbJVVSOZJrp4IMyBYsaJvUz7JZAgZUJ3tL2V/55Nj8lYhRvLHrHvOUJYNziBIEtHO37ib8 y9EFUanClndhKVoyhvK3XehA1MSfiA4bvm2JgDBMYEIW44l0JLvK6yFcafvN82La5OW0TvNdjlrId Dw2OZbt1ZfZNKBEXoICAVG2a1jacqdltK2reRBj547BTpjull1yzKBCcStYpjbNFvVhey0hU5JwBl cYl1tBPkg3ClicfUicAZkSM3c1l0ZAMk37pEMr24hFMjHV+BtUF4kSdR5eDFtI+4x3gbT4ZryQ9Qy ijLigOHKclw0cBOGKJMQ==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.92 #3 (Red Hat Linux)) id 1hhwRn-0002dN-7x; Mon, 01 Jul 2019 13:34:19 +0000 Received: from dvalin.narfation.org ([2a00:17d8:100::8b1]) by bombadil.infradead.org with esmtps (Exim 4.92 #3 (Red Hat Linux)) id 1hhwRj-0002cw-Sr for hostap@lists.infradead.org; Mon, 01 Jul 2019 13:34:17 +0000 Received: from sven-desktop.home.narfation.org (p4FCB280C.dip0.t-ipconnect.de [79.203.40.12]) by dvalin.narfation.org (Postfix) with ESMTPSA id D705B208FE; Mon, 1 Jul 2019 13:34:13 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=narfation.org; s=20121; t=1561988053; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding; bh=5EVCe0XEYDSZK/zaQzq8xPTgE4uhwAw6SbnljB6FlBE=; b=tKRzX8wmdFfTGwVz7nrwXigvohVJ98sH087Z2k9ZUPxknDJB4iP+HrcmBO3cmpeCuYJdHY DYWECNELvjMov2Tz1sp01sY5it9ukbXhl90YYEOloWUOHOcEPkmpIlwSc4JET07MT2SgKU 83sva974mTdu4Yvj23XhD2AAmutpZ8M= From: Sven Eckelmann To: hostap@lists.infradead.org Subject: [PATCH v3] nl80211: Don't force VHT channel definition with HE Date: Mon, 1 Jul 2019 15:34:08 +0200 Message-Id: <20190701133408.28722-1-sven@narfation.org> X-Mailer: git-send-email 2.20.1 MIME-Version: 1.0 ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=narfation.org; s=20121; t=1561988053; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding; bh=5EVCe0XEYDSZK/zaQzq8xPTgE4uhwAw6SbnljB6FlBE=; b=fL7bUXZIDX9wTA5Eb5YePL3pHq8zQx0n9pw5Kce/q6ZRb6aTtHqosqc0tYon6af3MsSJ73 dUur9FEnXfL9AWwgl4RDPa4d2ez1w49RgoKl0wRKq/6vgbmAoPNl0SLJublE5NKkZ1MS7e 0fuKCr73wwWU51dxNXgC4MhqGH1q5aE= ARC-Seal: i=1; s=20121; d=narfation.org; t=1561988053; a=rsa-sha256; cv=none; b=gQKWQMRxFWr9UcPt1DpCjk9kksQU/aPDUhz1QdcJIUmeqXruo5CGCKwWglrckwlxiPp1/I 3dd/m8ud1yRh/qn4cmdgAcgCEct2z+QNCtlIVdEQbJEfGixN5+XLfDoxOOqq02Ow+eobyg vt0qrcR5Y9G98K0OyGjcuZYRCce0VjE= ARC-Authentication-Results: i=1; ORIGINATING; auth=pass smtp.auth=sven smtp.mailfrom=sven@narfation.org X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20190701_063416_080801_45B7CF84 X-CRM114-Status: UNSURE ( 9.85 ) X-CRM114-Notice: Please train this message. X-Spam-Score: -0.2 (/) X-Spam-Report: SpamAssassin version 3.4.2 on bombadil.infradead.org summary: Content analysis details: (-0.2 points) 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_VALID_AU Message has a valid DKIM or DK signature from author's domain 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid 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: Sven Eckelmann Sender: "Hostap" Errors-To: hostap-bounces+incoming=patchwork.ozlabs.org@lists.infradead.org From: Sven Eckelmann HE (802.11ax) is also supported on 2.4GHz. And the 2.4GHz band isn't supposed to use VHT opers. Some codepaths in wpa_supplicant will therefore not initialize the freq->bandwidth or the freq->center_freq1/2 members. As a result, the nl80211_put_freq_params will directly return an error (-1) or the kernel will return an error due to the invalid channel definition. Instead, the channel definitions should be created based on the actual HT/VHT/none information on 2.4GHz. Fixes: ad9a1bfe788e ("nl80211: Share VHT channel configuration for HE") Signed-off-by: Sven Eckelmann --- v3: * differentiate between 2.4GHz and 5GHz HE implementation as requested by John Crispin v2: * Fix Signed-off-by src/drivers/driver_nl80211.c | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/src/drivers/driver_nl80211.c b/src/drivers/driver_nl80211.c index 45835a21b..3b59c836b 100644 --- a/src/drivers/driver_nl80211.c +++ b/src/drivers/driver_nl80211.c @@ -4344,6 +4344,10 @@ fail: static int nl80211_put_freq_params(struct nl_msg *msg, const struct hostapd_freq_params *freq) { + enum hostapd_hw_mode hw_mode; + int is_24ghz; + u8 channel; + wpa_printf(MSG_DEBUG, " * freq=%d", freq->freq); if (nla_put_u32(msg, NL80211_ATTR_WIPHY_FREQ, freq->freq)) return -ENOBUFS; @@ -4352,7 +4356,14 @@ static int nl80211_put_freq_params(struct nl_msg *msg, wpa_printf(MSG_DEBUG, " * vht_enabled=%d", freq->vht_enabled); wpa_printf(MSG_DEBUG, " * ht_enabled=%d", freq->ht_enabled); - if (freq->vht_enabled || freq->he_enabled) { + hw_mode = ieee80211_freq_to_chan(freq->freq, &channel); + if (hw_mode == HOSTAPD_MODE_IEEE80211B || + hw_mode == HOSTAPD_MODE_IEEE80211G) + is_24ghz = 1; + else + is_24ghz = 0; + + if (freq->vht_enabled || (freq->he_enabled && !is_24ghz)) { enum nl80211_chan_width cw; wpa_printf(MSG_DEBUG, " * bandwidth=%d", freq->bandwidth);