From patchwork Sun Jan 30 19:22:00 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: David Bauer X-Patchwork-Id: 1586443 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=QQCE33Bx; 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 4Jn1Lf2dZ0z9sFy for ; Mon, 31 Jan 2022 06:23:06 +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=Wdg0wWppVmH8ho9SHRKJt80DYvcWq6GStwyOUy99ziA=; b=QQCE33Bx6Fy6Ba l6GXyClhe6KUHasXQ3ycRByyml2lpu/w7clXK6Zsx6ofGiKCQqXY/xpFISkvxzStRkkZCq5H9BoIy HVvmL6zyCW3l3skDumtedjeggiPogZT3LNuJwdfxz/dpr8jScEgv4kTPYaWGI7t+oAhWUf7hQhH46 vL4TuXJqx/YWI5AEjNAGjuVRyboA4fTRqunSBND7WVA4unBZAFjO+GZ30jOEEPq+6I0u7XF8v+Fc2 O/bgSWy1B7v8MfYfUmrpsYb1TwnvMaTuzI4GgOLxPA4VtxU3YEogk7aUGvu//A9694p6wgzjdgdCy k5bbqMIobZJcb7JbtPGQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1nEFm5-007I5Q-3S; Sun, 30 Jan 2022 19:22:09 +0000 Received: from perseus.uberspace.de ([95.143.172.134]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1nEFm1-007I4h-Fv for hostap@lists.infradead.org; Sun, 30 Jan 2022 19:22:07 +0000 Received: (qmail 7019 invoked by uid 988); 30 Jan 2022 19:22:03 -0000 Authentication-Results: perseus.uberspace.de; auth=pass (plain) From: David Bauer To: hostap@lists.infradead.org Cc: =?utf-8?q?=C3=89tienne_Morice?= Subject: [PATCH] nl80211: add extra-ies only if allowed by driver Date: Sun, 30 Jan 2022 20:22:00 +0100 Message-Id: <20220130192200.10883-1-mail@david-bauer.net> X-Mailer: git-send-email 2.35.1 MIME-Version: 1.0 X-Rspamd-Bar: -- X-Rspamd-Report: BAYES_HAM(-3) MIME_GOOD(-0.1) MID_CONTAINS_FROM(1) X-Rspamd-Score: -2.1 Received: from unknown (HELO unkown) (::1) by perseus.uberspace.de (Haraka/2.8.28) with ESMTPSA; Sun, 30 Jan 2022 20:22:03 +0100 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20220130_112205_847969_025516DF X-CRM114-Status: GOOD ( 14.52 ) X-Spam-Score: -0.7 (/) 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: Upgrading wpa_supplicant from 2.9 to 2.10 breaks broadcom-wl based adapters. The reason for it is hostapd tries to install additional IEs for scanning while the driver does not support this. The kernel indicates the maximum number of bytes for additional scan IEs using the NL80211_ATTR_MAX_SCAN_IE_LEN attribute. Save this value and only add additional scan IEs in case the driver can accom [...] Content analysis details: (-0.7 points, 5.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- -0.7 RCVD_IN_DNSWL_LOW RBL: Sender listed at https://www.dnswl.org/, low trust [95.143.172.134 listed in list.dnswl.org] -0.0 SPF_PASS SPF: sender matches SPF record 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record 0.0 MSGID_FROM_MTA_HEADER Message-Id was added by a relay 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 Upgrading wpa_supplicant from 2.9 to 2.10 breaks broadcom-wl based adapters. The reason for it is hostapd tries to install additional IEs for scanning while the driver does not support this. The kernel indicates the maximum number of bytes for additional scan IEs using the NL80211_ATTR_MAX_SCAN_IE_LEN attribute. Save this value and only add additional scan IEs in case the driver can accommodate these additional IEs. Reported-by: Étienne Morice Tested-by: Étienne Morice Signed-off-by: David Bauer --- src/drivers/driver.h | 3 +++ src/drivers/driver_nl80211_capa.c | 4 ++++ src/drivers/driver_nl80211_scan.c | 2 +- 3 files changed, 8 insertions(+), 1 deletion(-) diff --git a/src/drivers/driver.h b/src/drivers/driver.h index d3312a34d..b5b626451 100644 --- a/src/drivers/driver.h +++ b/src/drivers/driver.h @@ -2052,6 +2052,9 @@ struct wpa_driver_capa { /** Maximum number of iterations in a single scan plan */ u32 max_sched_scan_plan_iterations; + /** Maximum number of extra IE bytes for scans */ + u16 max_scan_ie_len; + /** Whether sched_scan (offloaded scanning) is supported */ int sched_scan_supported; diff --git a/src/drivers/driver_nl80211_capa.c b/src/drivers/driver_nl80211_capa.c index 83868b78e..b33b6badb 100644 --- a/src/drivers/driver_nl80211_capa.c +++ b/src/drivers/driver_nl80211_capa.c @@ -885,6 +885,10 @@ static int wiphy_info_handler(struct nl_msg *msg, void *arg) nla_get_u32(tb[NL80211_ATTR_MAX_SCAN_PLAN_ITERATIONS]); } + if (tb[NL80211_ATTR_MAX_SCAN_IE_LEN]) + capa->max_scan_ie_len = + nla_get_u16(tb[NL80211_ATTR_MAX_SCAN_IE_LEN]); + if (tb[NL80211_ATTR_MAX_MATCH_SETS]) capa->max_match_sets = nla_get_u8(tb[NL80211_ATTR_MAX_MATCH_SETS]); diff --git a/src/drivers/driver_nl80211_scan.c b/src/drivers/driver_nl80211_scan.c index 131608480..b0f095192 100644 --- a/src/drivers/driver_nl80211_scan.c +++ b/src/drivers/driver_nl80211_scan.c @@ -207,7 +207,7 @@ nl80211_scan_common(struct i802_bss *bss, u8 cmd, wpa_printf(MSG_DEBUG, "nl80211: Passive scan requested"); } - if (params->extra_ies) { + if (params->extra_ies && drv->capa.max_scan_ie_len >= params->extra_ies_len) { wpa_hexdump(MSG_MSGDUMP, "nl80211: Scan extra IEs", params->extra_ies, params->extra_ies_len); if (nla_put(msg, NL80211_ATTR_IE, params->extra_ies_len,