Received: by 2002:a05:6a10:6006:0:0:0:0 with SMTP id w6csp769711pxa; Thu, 27 Aug 2020 15:34:24 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyO1ak0rLTpNK75ePHidXQp1nlARN77a1HSshhN8Z1UDavK5d50owGvwvg+BSniDNhmp9+M X-Received: by 2002:a17:907:43f6:: with SMTP id mu6mr24337455ejb.244.1598567663743; Thu, 27 Aug 2020 15:34:23 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1598567663; cv=none; d=google.com; s=arc-20160816; b=QpA0XrO1EKs4WeZJoRgVl6ofGN9zqXt3BtAzXRFxMnniia/mVLdGjR055xwPnFgNPx Ciqk6s1pfNipnqcj/kEqQep84WjgAmi+CyhoNxMXW1KJ2jVYNk7XBhCzjD/SvsHKDDdF BWnZx1S+ZG6FSQV88SxEgwWBCHmmg4dcxXcAb1qQj1ADbyqfCH5Xae4NsAAnicuPelmg zRwymmzQpB4iAlWFfIP9AZHJ4m6Op7Y28g2mwZsUDDznyI/1OMRHz+eAdA4vHBz70xfC uUtJgco5FAf/j9v4+UZJ8asKOG8tiTaxXGtMAEysNWrkIgas+/Z7YxpcX4jfSNyr7obw 7GmA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from; bh=NBFZ5WKDoigdM8Wb4VayMipd8kpz5AI/RJ4bfiOpCIc=; b=OufKOZBBD6Lfr+dH2c2knCmdh2DR4+UdvOU6M46pxy+REljGLlkDLzd570q94HgW1y XpwWJpf76E8w71jSd6T5JoYAghOxS22uIU4ZbLdH5XP3pDIE351EsqaL6yq8/Wd6j1k9 9wnTzdlTrpHYw2KhsuH7Kg0QfFrbAM9O/ErM4OPvnGz28q2eXVBvC9NHPrKzJNDh3+D3 XHRX5tZLdMeLWDE1/ZunLJdbZIK5THoHAppBL0vyvfxJktyDO+OGgGa/FcBgmV82gMvR NHF6kUlAyi4OGXmybQuiHNhJJ6AO6pk+ukNCIuzoiZR7hqZ5JoqVhsqDcXMEb+YfPWoV 5IVw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-wireless-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-wireless-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id b20si2503485edn.57.2020.08.27.15.33.59; Thu, 27 Aug 2020 15:34:23 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-wireless-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-wireless-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-wireless-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728034AbgH0Wde (ORCPT + 99 others); Thu, 27 Aug 2020 18:33:34 -0400 Received: from mail.adapt-ip.com ([173.164.178.19]:50462 "EHLO web.adapt-ip.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1728014AbgH0Wd0 (ORCPT ); Thu, 27 Aug 2020 18:33:26 -0400 Received: from localhost (localhost [127.0.0.1]) by web.adapt-ip.com (Postfix) with ESMTP id 1976B4F7FD9; Thu, 27 Aug 2020 22:33:26 +0000 (UTC) X-Virus-Scanned: Debian amavisd-new at web.adapt-ip.com Received: from web.adapt-ip.com ([127.0.0.1]) by localhost (web.adapt-ip.com [127.0.0.1]) (amavisd-new, port 10026) with ESMTP id nc5z3GesCfgm; Thu, 27 Aug 2020 22:33:23 +0000 (UTC) Received: from atlas.campbell.adapt-ip.com (gateway.adapt-ip.com [173.164.178.20]) (Authenticated sender: thomas@adapt-ip.com) by web.adapt-ip.com (Postfix) with ESMTPSA id 7AB034F8094; Thu, 27 Aug 2020 22:33:10 +0000 (UTC) From: Thomas Pedersen To: Johannes Berg Cc: linux-wireless , Thomas Pedersen Subject: [PATCH 11/22] cfg80211: parse S1G Operation element for BSS channel Date: Thu, 27 Aug 2020 15:32:53 -0700 Message-Id: <20200827223304.16155-12-thomas@adapt-ip.com> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20200827223304.16155-1-thomas@adapt-ip.com> References: <20200827223304.16155-1-thomas@adapt-ip.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Sender: linux-wireless-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org Extract the BSS primary channel from the S1G Operation element. Signed-off-by: Thomas Pedersen --- net/wireless/scan.c | 23 +++++++++++++++++------ 1 file changed, 17 insertions(+), 6 deletions(-) diff --git a/net/wireless/scan.c b/net/wireless/scan.c index bf72a13dd2aa..169b6904e011 100644 --- a/net/wireless/scan.c +++ b/net/wireless/scan.c @@ -1318,15 +1318,26 @@ cfg80211_get_bss_channel(struct wiphy *wiphy, const u8 *ie, size_t ielen, tmp = cfg80211_find_ie(WLAN_EID_DS_PARAMS, ie, ielen); if (tmp && tmp[1] == 1) { channel_number = tmp[2]; - } else { - tmp = cfg80211_find_ie(WLAN_EID_HT_OPERATION, ie, ielen); - if (tmp && tmp[1] >= sizeof(struct ieee80211_ht_operation)) { - struct ieee80211_ht_operation *htop = (void *)(tmp + 2); + goto found_channel; + } - channel_number = htop->primary_chan; - } + tmp = cfg80211_find_ie(WLAN_EID_HT_OPERATION, ie, ielen); + if (tmp && tmp[1] >= sizeof(struct ieee80211_ht_operation)) { + struct ieee80211_ht_operation *htop = (void *)(tmp + 2); + + channel_number = htop->primary_chan; + goto found_channel; + } + + tmp = cfg80211_find_ie(WLAN_EID_S1G_OPERATION, ie, ielen); + if (tmp && tmp[1] >= sizeof(struct ieee80211_s1g_oper_ie)) { + struct ieee80211_s1g_oper_ie *s1gop = (void *)(tmp + 2); + + channel_number = s1gop->primary_ch; + goto found_channel; } +found_channel: if (channel_number < 0) { /* No channel information in frame payload */ return channel; -- 2.20.1