Received: by 2002:a05:6a10:22f:0:0:0:0 with SMTP id 15csp4155983pxk; Tue, 8 Sep 2020 12:06:31 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyBE7LE0m8YaV5aOkiMC2JNTuUgTWOsuVQaF34WKJHFdztbHKs9vsXRfLbzcwUW0tsrs7ko X-Received: by 2002:a17:906:4a53:: with SMTP id a19mr10171691ejv.56.1599591990824; Tue, 08 Sep 2020 12:06:30 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1599591990; cv=none; d=google.com; s=arc-20160816; b=PB9kLh4tbnrG+Mbvs3MVGinzwmPmpG1UzWkN1A/Jc1xvke7xojy9JNB+NeRvA3xGRb U9z+XDJf0QhGNuZs4O5rsbOXtaJRtMTc9yBkxpU7ey6T7+7iBTN3IIOhrMLV8vX1rmw2 XyD96jn9x8IS46qADJK2hymslBgCzAXiKZuejAvbEUCuGyT/3gR99z1DeeBOV+5yCp5n 6T7wMDwW3VdtQjRK1aj/imiogFom/WCULyG8oLWoAqdvnA7Evz3tcGVyxRIRM6VybO+c 6fqAU+JJ8H7/8KiprpRVgynIbEwUP76U+FCXR5y0cSXHsN+4BJV9LAtFO+gjSlyEmOH0 wzgw== 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=+Dy1F7c/b/eCNSRb3OD8ABiJR4ir3m1qsSqXEfLn7tM=; b=0fhrfH2d31QYpcrMWUHjpYANqwF0N+/cxC4BvcAbGuydxntsC6JzPRKs7+nDak8uX+ 1FGJB7dlEZQkK8ZhCrLAlKfCxkgMRea5V3+aDByNrEKD6l0d1267anB/jLrU4Jq/2l28 ej/hip1nh9q7PJXUJO+vMPiq9noSfgK2F/cW+eWx+Hehc0x65NFO3cTdN/r0OvDHm+cH 09Mn45kHtJNww76sSQnCseYNr2nnoCiwELA/n26HOXn/Up2GnLsqrFsSq/kFJDEIQn9+ jFT2YK4yhulfJ+BHf9EJzLK5YCwxPZfXuUDLex2EeCBSCBZciuHq5AB9sRDbfBgBYJS2 Fsqg== 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 dn25si36859edb.268.2020.09.08.12.06.07; Tue, 08 Sep 2020 12:06:30 -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 S1731517AbgIHTEh (ORCPT + 99 others); Tue, 8 Sep 2020 15:04:37 -0400 Received: from mail.adapt-ip.com ([173.164.178.19]:52712 "EHLO web.adapt-ip.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1731267AbgIHTDn (ORCPT ); Tue, 8 Sep 2020 15:03:43 -0400 Received: from localhost (localhost [127.0.0.1]) by web.adapt-ip.com (Postfix) with ESMTP id D22E04F9B05; Tue, 8 Sep 2020 19:03:39 +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 hL1dqq7M2wh8; Tue, 8 Sep 2020 19:03:37 +0000 (UTC) Received: from atlas.ibsgaard.io (c-73-223-60-234.hsd1.ca.comcast.net [73.223.60.234]) (Authenticated sender: thomas@adapt-ip.com) by web.adapt-ip.com (Postfix) with ESMTPSA id 5F8144F9AFF; Tue, 8 Sep 2020 19:03:23 +0000 (UTC) From: Thomas Pedersen To: Johannes Berg Cc: linux-wireless , Thomas Pedersen Subject: [PATCH v3 11/22] cfg80211: parse S1G Operation element for BSS channel Date: Tue, 8 Sep 2020 12:03:12 -0700 Message-Id: <20200908190323.15814-12-thomas@adapt-ip.com> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20200908190323.15814-1-thomas@adapt-ip.com> References: <20200908190323.15814-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 b4c85e8f2107..c2dcb9092257 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