From patchwork Fri Dec 10 17:59:22 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Matthew Wang X-Patchwork-Id: 1566610 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: bilbo.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=LVbQTe6b; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=chromium.org header.i=@chromium.org header.a=rsa-sha256 header.s=google header.b=PsxYlhzq; dkim-atps=neutral Authentication-Results: ozlabs.org; spf=none (no SPF record) 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=) 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 bilbo.ozlabs.org (Postfix) with ESMTPS id 4J9dxW4pRZz9sR4 for ; Sat, 11 Dec 2021 05:01:03 +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:Message-Id:Date:Subject:Cc :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=Glii2IFPSsy7TczbYz0Rsp4RhWkuY/H21NVG8DtJKBQ=; b=LVbQTe6bF6S93v Axohtt4kSdC7igTPN7UCFOHiq4D1+icXHvN7dTS33B3xRYAKPsla8hMJzDatJfn+IrP1ERHe+4OYu 0pJpHyiwkcP1jv5baDwpPgrTFBaP8fPioMESzNtE8b6iXLE3MAz9e6eakOm9W2rc+mTAhKI7Wg3K+ ddu6M366lgW8j26HEnMU7NX2vE74qhDNZY6SeEiAckYRHAZ4hhwYzIbAjCcYEiLK36DT03xgzlIUi mGCBZTpWvwkhguNiH5j3aefaUONeY6LmR4YLOYH2ZPbNDp5fQDC3RqFNxVboaoxDuZrNXxtIXchga jbhrmGka1uoyiEihe6Hg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1mvkBK-0034iK-Kk; Fri, 10 Dec 2021 17:59:42 +0000 Received: from mail-pg1-x530.google.com ([2607:f8b0:4864:20::530]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1mvkB7-0034aa-2g for hostap@lists.infradead.org; Fri, 10 Dec 2021 17:59:30 +0000 Received: by mail-pg1-x530.google.com with SMTP id r5so8697771pgi.6 for ; Fri, 10 Dec 2021 09:59:27 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=hNCb+hRJSC2Bq9KiQtKN5G5A8oO/DVmPm3r4gCMNbZU=; b=PsxYlhzqiHIIr6Zs0Zvi8UZN05N5j5pftWwyXCj2CiiEUAXQmAAOW3okn3GT1VitoX eNHoDuXn8rEk7oD1aVmDA4veS8IEy7NlDaBsvOswI/FfOBvwlKO4Apf4h8ArkycIdFmB M9sKFlX6exfqTdpTZC2+Kb9lB6DYPCAiqNGtU= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=hNCb+hRJSC2Bq9KiQtKN5G5A8oO/DVmPm3r4gCMNbZU=; b=u8A9iEaamDg6oC09XMeGYhklTRhJM9m4PDX6MjSk6A20KO2Go3udMBeFGS5NvO4Hve TlSdZuoafpkI43Cd1il8vZdjxMiVKUmzlbgUq14BZm2T3RsVHyQ7qB1JpcTYhGp9sGSn 5xBNUaJtJAs59Seriexnw7X47t40MHJrY+WQZdc9ep+TFGyvjGdJLhKNsJgwqLW749L+ rz+u6+fplS9Ti9J7iitRDZlkQgaSeEqlRDJbnW7E21RfXMMG7XvLPtb85Z7qz8a/8tLl wJlY9loVfci1D3IZ6ocbO5OZa72HCvxbRyxdlpMN3M/3Vt4E2dmchZyhiZhSlCnNm4+R ZyMw== X-Gm-Message-State: AOAM531Dkh/k1I31rr8I42GDQsya7/nSX6MHGi/1/AK9XUEyhFS402p5 8+QPS85/bsTVfSH4JnP8btVh7w== X-Google-Smtp-Source: ABdhPJx+jT3tjQ9IwoUC8b5EAeIk4rt1oEPhpKNSD00nMyNbE8CoNj7bZcDyezSHCPPTSE+8TI8Nww== X-Received: by 2002:a62:8c55:0:b0:49f:df22:c4ca with SMTP id m82-20020a628c55000000b0049fdf22c4camr19574147pfd.11.1639159167006; Fri, 10 Dec 2021 09:59:27 -0800 (PST) Received: from localhost ([2620:15c:202:201:d423:785c:dcd2:f522]) by smtp.gmail.com with UTF8SMTPSA id w142sm3782872pfc.115.2021.12.10.09.59.25 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Fri, 10 Dec 2021 09:59:26 -0800 (PST) From: Matthew Wang To: j@w1.fi Cc: hostap@lists.infradead.org, matthewmwang@chromium.org Subject: [PATCH 1/2] Revert "STA OBSS: Add check for overlapping BSSs" Date: Fri, 10 Dec 2021 09:59:22 -0800 Message-Id: <20211210175923.319282-1-matthewmwang@chromium.org> X-Mailer: git-send-email 2.34.1.173.g76aa8bc2d0-goog MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20211210_095929_181238_E1CB0E37 X-CRM114-Status: GOOD ( 18.76 ) X-Spam-Score: -0.4 (/) 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: This reverts commit 3204795d7a43bcbda8b695dd96d11f3000de7340. The commit adds an additional check that checks for overlapping BSSs in addition to the existing 40MHz intolerance subfield checks. The commit cites IEEE Std 802.11-2016 section 11.16.12, which define [...] Content analysis details: (-0.4 points, 5.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- -0.0 RCVD_IN_DNSWL_NONE RBL: Sender listed at https://www.dnswl.org/, no trust [2607:f8b0:4864:20:0:0:0:530 listed in] [list.dnswl.org] 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record 0.0 SPF_NONE SPF: sender does not publish an SPF Record -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's 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_EF Message has a valid DKIM or DK signature from envelope-from domain -0.2 DKIMWL_WL_HIGH DKIMwl.org - High trust sender 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 This reverts commit 3204795d7a43bcbda8b695dd96d11f3000de7340. The commit adds an additional check that checks for overlapping BSSs in addition to the existing 40MHz intolerance subfield checks. The commit cites IEEE Std 802.11-2016 section 11.16.12, which defines the proper behavior for a 20/40MHz HT STA and AP, but the spec actually doesn't say anything about overlapping BSSs. Specifically, the spec states that the only BSSs that belong in the Intolerant channel report are those that satisfy trigger event A, defined as channels with BSSs that don't contain the HT capabilities element (which wpa_supplicant already did before). Note that we also include channels with BSSs that have the 40MHz intolerance bit set in the Intolerant channel report. Signed-off-by: Matthew Wang --- wpa_supplicant/events.c | 2 +- wpa_supplicant/sme.c | 42 +++++++++++++---------------------------- wpa_supplicant/sme.h | 6 ++---- 3 files changed, 16 insertions(+), 34 deletions(-) diff --git a/wpa_supplicant/events.c b/wpa_supplicant/events.c index 5f5c50ba975..f55e1846e20 100644 --- a/wpa_supplicant/events.c +++ b/wpa_supplicant/events.c @@ -2177,7 +2177,7 @@ static int _wpa_supplicant_event_scan_results(struct wpa_supplicant *wpa_s, if (wnm_scan_process(wpa_s, 1) > 0) goto scan_work_done; - if (sme_proc_obss_scan(wpa_s, scan_res) > 0) + if (sme_proc_obss_scan(wpa_s) > 0) goto scan_work_done; if (own_request && data && diff --git a/wpa_supplicant/sme.c b/wpa_supplicant/sme.c index f2c42ff354e..0dd3772f374 100644 --- a/wpa_supplicant/sme.c +++ b/wpa_supplicant/sme.c @@ -13,7 +13,6 @@ #include "common/ieee802_11_defs.h" #include "common/ieee802_11_common.h" #include "common/ocv.h" -#include "common/hw_features_common.h" #include "eapol_supp/eapol_supp_sm.h" #include "common/wpa_common.h" #include "common/sae.h" @@ -2380,14 +2379,13 @@ static void sme_send_2040_bss_coex(struct wpa_supplicant *wpa_s, } -int sme_proc_obss_scan(struct wpa_supplicant *wpa_s, - struct wpa_scan_results *scan_res) +int sme_proc_obss_scan(struct wpa_supplicant *wpa_s) { + struct wpa_bss *bss; const u8 *ie; + u16 ht_cap; u8 chan_list[P2P_MAX_CHANNELS], channel; u8 num_channels = 0, num_intol = 0, i; - size_t j; - int pri_freq, sec_freq; if (!wpa_s->sme.sched_obss_scan) return 0; @@ -2415,36 +2413,22 @@ int sme_proc_obss_scan(struct wpa_supplicant *wpa_s, os_memset(chan_list, 0, sizeof(chan_list)); - pri_freq = wpa_s->assoc_freq; - - switch (wpa_s->sme.ht_sec_chan) { - case HT_SEC_CHAN_ABOVE: - sec_freq = pri_freq + 20; - break; - case HT_SEC_CHAN_BELOW: - sec_freq = pri_freq - 20; - break; - case HT_SEC_CHAN_UNKNOWN: - default: - wpa_msg(wpa_s, MSG_WARNING, - "Undefined secondary channel: drop OBSS scan results"); - return 1; - } - - for (j = 0; j < scan_res->num; j++) { - struct wpa_scan_res *bss = scan_res->res[j]; - enum hostapd_hw_mode mode; - int res; - + dl_list_for_each(bss, &wpa_s->bss, struct wpa_bss, list) { /* Skip other band bss */ + enum hostapd_hw_mode mode; mode = ieee80211_freq_to_chan(bss->freq, &channel); if (mode != HOSTAPD_MODE_IEEE80211G && mode != HOSTAPD_MODE_IEEE80211B) continue; - res = check_bss_coex_40mhz(bss, pri_freq, sec_freq); - if (res) { - if (res == 2) + ie = wpa_bss_get_ie(bss, WLAN_EID_HT_CAP); + ht_cap = (ie && (ie[1] == 26)) ? WPA_GET_LE16(ie + 2) : 0; + wpa_printf(MSG_DEBUG, "SME OBSS scan BSS " MACSTR + " freq=%u chan=%u ht_cap=0x%x", + MAC2STR(bss->bssid), bss->freq, channel, ht_cap); + + if (!ht_cap || (ht_cap & HT_CAP_INFO_40MHZ_INTOLERANT)) { + if (ht_cap & HT_CAP_INFO_40MHZ_INTOLERANT) num_intol++; /* Check whether the channel is already considered */ diff --git a/wpa_supplicant/sme.h b/wpa_supplicant/sme.h index ecbc16dacd9..c797d2e9e79 100644 --- a/wpa_supplicant/sme.h +++ b/wpa_supplicant/sme.h @@ -37,8 +37,7 @@ void sme_disassoc_while_authenticating(struct wpa_supplicant *wpa_s, void sme_clear_on_disassoc(struct wpa_supplicant *wpa_s); void sme_deinit(struct wpa_supplicant *wpa_s); -int sme_proc_obss_scan(struct wpa_supplicant *wpa_s, - struct wpa_scan_results *scan_res); +int sme_proc_obss_scan(struct wpa_supplicant *wpa_s); void sme_sched_obss_scan(struct wpa_supplicant *wpa_s, int enable); void sme_external_auth_trigger(struct wpa_supplicant *wpa_s, union wpa_event_data *data); @@ -113,8 +112,7 @@ static inline void sme_deinit(struct wpa_supplicant *wpa_s) { } -static inline int sme_proc_obss_scan(struct wpa_supplicant *wpa_s, - struct wpa_scan_results *scan_res) +static inline int sme_proc_obss_scan(struct wpa_supplicant *wpa_s) { return 0; } From patchwork Fri Dec 10 17:59:23 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Matthew Wang X-Patchwork-Id: 1566611 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: bilbo.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=zaM5gLzw; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=chromium.org header.i=@chromium.org header.a=rsa-sha256 header.s=google header.b=KZFVowvx; dkim-atps=neutral Authentication-Results: ozlabs.org; spf=none (no SPF record) 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=) 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 bilbo.ozlabs.org (Postfix) with ESMTPS id 4J9dxy0Dhvz9sR4 for ; Sat, 11 Dec 2021 05:01:26 +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:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=xSUG351AajViJTEVLFZpByY5SoXjQnlkDw1h9Ws0Dd8=; b=zaM5gLzwFKUP3j ISs5ohqNojyYom1ucBpxAaOu61QZRLrK+Xnpzj8otzT7DHaBbkqhjmviqVSHBTD/8BJInpOYc2Y3t +MfNXGPOSuh4aasMxLQWaCC/njrAXo0j9fa/NbRoFg7nwpyJ8pNrd4u7kWMGZdx3IvGhPs8TXY+KI hvPq9S0vzJ/U4mOWriXLojSFTAmSIFN6V8x8rnXpKjVGMToTIx1AuQ8Qc+4polquaQ1cawMmvr+8G vXbMantijuvBDhW2pFYkYg3o9WzY+5Ovzx2IUx4PRKX/atNrkBI1cYkwu1U3uuNCfALvuZGYzlvYM vmTIX4dhVjQ1k8Oxd8xA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1mvkBu-00352P-26; Fri, 10 Dec 2021 18:00:18 +0000 Received: from mail-pg1-x533.google.com ([2607:f8b0:4864:20::533]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1mvkB9-0034cD-CZ for hostap@lists.infradead.org; Fri, 10 Dec 2021 17:59:33 +0000 Received: by mail-pg1-x533.google.com with SMTP id a23so4094650pgm.4 for ; Fri, 10 Dec 2021 09:59:31 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=icqV/JkKTZIYlb+ozrWxrQ6E0+n4KLQbB4Lsbvu2rpk=; b=KZFVowvxEphTpzMCqd7WWNeSv3pVpKkghKWW9U9B4Co57wno9HhMTqtbMpIX3MO9Li /0i/udYjGf5fJuCziyQX3heH9KOaN0v4L6TwgCE/CY4AoVQ7NIdezWKKG7/aBZ1unn3a Hx/15HoxtX0TMLAMdqv5o2G6fgnxZrlaXforI= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=icqV/JkKTZIYlb+ozrWxrQ6E0+n4KLQbB4Lsbvu2rpk=; b=A34DWXDQJnJc5EIdjekiF8wP+yVAGdHgyMg7AAjypOAgF05yMOgjMsvHw2XeIDqwce 9FXDPPrZIkMnxpRi4QEAPqHreA4XZMRAGAAPWmP/13W+Ow1B2pqgTVp+VPlJgpePGWIJ fyeXdRb3xXgJ5tpqo+9S1TCn131VdZ/xW2bqsEVYF1CvKBRNKNMH78FcMZ4GO6zMz21N HZUcJR/uErR68z0K3KMJ+rZSVBtCJEO4/mo+LSCsdF9YTfU2kDqDnRK9xBIw7CN1OLmm tMQoq1Djvf7KuHVUxxSTGUbZ1rZVgaXlT5OG3HKc0gWnQ8Zmkt3bdF4bjgMX0ByoHulV Ew/w== X-Gm-Message-State: AOAM533brq1CAeDE3BSGxqRpV4K4A3RKZS/wOTKo5fBUSkm5yJVJlJ0n jiePfMLFf3Pw5xvzHIVuVhGFXg== X-Google-Smtp-Source: ABdhPJxlfMaXZjK0ze5zwzaYy6A+jodDPBujNl8J7nTHUdgtWGJtZ1tU2JAPDEXI2bzPZU4Nhoj1mg== X-Received: by 2002:a63:4505:: with SMTP id s5mr40245228pga.29.1639159170482; Fri, 10 Dec 2021 09:59:30 -0800 (PST) Received: from localhost ([2620:15c:202:201:d423:785c:dcd2:f522]) by smtp.gmail.com with UTF8SMTPSA id y6sm4429916pfi.154.2021.12.10.09.59.29 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Fri, 10 Dec 2021 09:59:30 -0800 (PST) From: Matthew Wang To: j@w1.fi Cc: hostap@lists.infradead.org, matthewmwang@chromium.org Subject: [PATCH 2/2] Revert "Extract BSS coex 40 MHz check into a separate function" Date: Fri, 10 Dec 2021 09:59:23 -0800 Message-Id: <20211210175923.319282-2-matthewmwang@chromium.org> X-Mailer: git-send-email 2.34.1.173.g76aa8bc2d0-goog In-Reply-To: <20211210175923.319282-1-matthewmwang@chromium.org> References: <20211210175923.319282-1-matthewmwang@chromium.org> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20211210_095931_478262_569121BB X-CRM114-Status: GOOD ( 18.27 ) X-Spam-Score: -0.4 (/) 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: This reverts commit 3af78a4e043ede6488eae081d854bad89500aec2. This commit prepares a refactor for another patch, which is being reverted. Signed-off-by: Matthew Wang --- src/common/hw_features_common.c | 141 ++++++++++++++ src/common/hw_features_common.h | 1 - 2 files changed, 62 insertions( [...] Content analysis details: (-0.4 points, 5.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- -0.0 RCVD_IN_DNSWL_NONE RBL: Sender listed at https://www.dnswl.org/, no trust [2607:f8b0:4864:20:0:0:0:533 listed in] [list.dnswl.org] 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record 0.0 SPF_NONE SPF: sender does not publish an SPF Record -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's 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_EF Message has a valid DKIM or DK signature from envelope-from domain -0.2 DKIMWL_WL_HIGH DKIMwl.org - High trust sender 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 This reverts commit 3af78a4e043ede6488eae081d854bad89500aec2. This commit prepares a refactor for another patch, which is being reverted. Signed-off-by: Matthew Wang --- src/common/hw_features_common.c | 141 ++++++++++++++------------------ src/common/hw_features_common.h | 1 - 2 files changed, 62 insertions(+), 80 deletions(-) diff --git a/src/common/hw_features_common.c b/src/common/hw_features_common.c index e7ac3b2aac6..f168d4e9290 100644 --- a/src/common/hw_features_common.c +++ b/src/common/hw_features_common.c @@ -293,87 +293,12 @@ static int check_20mhz_bss(struct wpa_scan_res *bss, int pri_freq, int start, } -/* - * Returns: - * 0: no impact - * 1: overlapping BSS - * 2: overlapping BSS with 40 MHz intolerant advertisement - */ -int check_bss_coex_40mhz(struct wpa_scan_res *bss, int pri_freq, int sec_freq) -{ - int affected_start, affected_end; - struct ieee802_11_elems elems; - int pri_chan, sec_chan; - int pri = bss->freq; - int sec = pri; - - if (pri_freq == sec_freq) - return 1; - - affected_start = (pri_freq + sec_freq) / 2 - 25; - affected_end = (pri_freq + sec_freq) / 2 + 25; - - /* Check for overlapping 20 MHz BSS */ - if (check_20mhz_bss(bss, pri_freq, affected_start, affected_end)) { - wpa_printf(MSG_DEBUG, "Overlapping 20 MHz BSS is found"); - return 1; - } - - get_pri_sec_chan(bss, &pri_chan, &sec_chan); - - if (sec_chan) { - if (sec_chan < pri_chan) - sec = pri - 20; - else - sec = pri + 20; - } - - if ((pri < affected_start || pri > affected_end) && - (sec < affected_start || sec > affected_end)) - return 0; /* not within affected channel range */ - - wpa_printf(MSG_DEBUG, "Neighboring BSS: " MACSTR - " freq=%d pri=%d sec=%d", - MAC2STR(bss->bssid), bss->freq, pri_chan, sec_chan); - - if (sec_chan) { - if (pri_freq != pri || sec_freq != sec) { - wpa_printf(MSG_DEBUG, - "40 MHz pri/sec mismatch with BSS " - MACSTR - " <%d,%d> (chan=%d%c) vs. <%d,%d>", - MAC2STR(bss->bssid), - pri, sec, pri_chan, - sec > pri ? '+' : '-', - pri_freq, sec_freq); - return 1; - } - } - - ieee802_11_parse_elems((u8 *) (bss + 1), bss->ie_len, &elems, 0); - if (elems.ht_capabilities) { - struct ieee80211_ht_capabilities *ht_cap = - (struct ieee80211_ht_capabilities *) - elems.ht_capabilities; - - if (le_to_host16(ht_cap->ht_capabilities_info) & - HT_CAP_INFO_40MHZ_INTOLERANT) { - wpa_printf(MSG_DEBUG, - "40 MHz Intolerant is set on channel %d in BSS " - MACSTR, pri, MAC2STR(bss->bssid)); - return 2; - } - } - - return 0; -} - - int check_40mhz_2g4(struct hostapd_hw_modes *mode, struct wpa_scan_results *scan_res, int pri_chan, int sec_chan) { int pri_freq, sec_freq; + int affected_start, affected_end; size_t i; if (!mode || !scan_res || !pri_chan || !sec_chan || @@ -383,12 +308,70 @@ int check_40mhz_2g4(struct hostapd_hw_modes *mode, pri_freq = hw_get_freq(mode, pri_chan); sec_freq = hw_get_freq(mode, sec_chan); + affected_start = (pri_freq + sec_freq) / 2 - 25; + affected_end = (pri_freq + sec_freq) / 2 + 25; wpa_printf(MSG_DEBUG, "40 MHz affected channel range: [%d,%d] MHz", - (pri_freq + sec_freq) / 2 - 25, - (pri_freq + sec_freq) / 2 + 25); + affected_start, affected_end); for (i = 0; i < scan_res->num; i++) { - if (check_bss_coex_40mhz(scan_res->res[i], pri_freq, sec_freq)) + struct wpa_scan_res *bss = scan_res->res[i]; + int pri = bss->freq; + int sec = pri; + struct ieee802_11_elems elems; + + /* Check for overlapping 20 MHz BSS */ + if (check_20mhz_bss(bss, pri_freq, affected_start, + affected_end)) { + wpa_printf(MSG_DEBUG, + "Overlapping 20 MHz BSS is found"); return 0; + } + + get_pri_sec_chan(bss, &pri_chan, &sec_chan); + + if (sec_chan) { + if (sec_chan < pri_chan) + sec = pri - 20; + else + sec = pri + 20; + } + + if ((pri < affected_start || pri > affected_end) && + (sec < affected_start || sec > affected_end)) + continue; /* not within affected channel range */ + + wpa_printf(MSG_DEBUG, "Neighboring BSS: " MACSTR + " freq=%d pri=%d sec=%d", + MAC2STR(bss->bssid), bss->freq, pri_chan, sec_chan); + + if (sec_chan) { + if (pri_freq != pri || sec_freq != sec) { + wpa_printf(MSG_DEBUG, + "40 MHz pri/sec mismatch with BSS " + MACSTR + " <%d,%d> (chan=%d%c) vs. <%d,%d>", + MAC2STR(bss->bssid), + pri, sec, pri_chan, + sec > pri ? '+' : '-', + pri_freq, sec_freq); + return 0; + } + } + + ieee802_11_parse_elems((u8 *) (bss + 1), bss->ie_len, &elems, + 0); + if (elems.ht_capabilities) { + struct ieee80211_ht_capabilities *ht_cap = + (struct ieee80211_ht_capabilities *) + elems.ht_capabilities; + + if (le_to_host16(ht_cap->ht_capabilities_info) & + HT_CAP_INFO_40MHZ_INTOLERANT) { + wpa_printf(MSG_DEBUG, + "40 MHz Intolerant is set on channel %d in BSS " + MACSTR, pri, MAC2STR(bss->bssid)); + return 0; + } + } } return 1; diff --git a/src/common/hw_features_common.h b/src/common/hw_features_common.h index ddde36b9926..0e92aa0f2bc 100644 --- a/src/common/hw_features_common.h +++ b/src/common/hw_features_common.h @@ -32,7 +32,6 @@ void get_pri_sec_chan(struct wpa_scan_res *bss, int *pri_chan, int *sec_chan); int check_40mhz_5g(struct wpa_scan_results *scan_res, struct hostapd_channel_data *pri_chan, struct hostapd_channel_data *sec_chan); -int check_bss_coex_40mhz(struct wpa_scan_res *bss, int pri_freq, int sec_freq); int check_40mhz_2g4(struct hostapd_hw_modes *mode, struct wpa_scan_results *scan_res, int pri_chan, int sec_chan);