blob: c7b595da57dd5426b4218851c79dbfd1ca3aa119 [file] [log] [blame]
developerbf0f2d62023-11-14 17:01:47 +08001From: David Bauer <mail@david-bauer.net>
2To: hostap@lists.infradead.org
3Cc: =?utf-8?q?=C3=89tienne_Morice?= <neon.emorice@mail.com>
4Subject: [PATCH] nl80211: add extra-ies only if allowed by driver
5Date: Sun, 30 Jan 2022 20:22:00 +0100
6Message-Id: <20220130192200.10883-1-mail@david-bauer.net>
7List-Id: <hostap.lists.infradead.org>
8
9Upgrading wpa_supplicant from 2.9 to 2.10 breaks broadcom-wl
10based adapters. The reason for it is hostapd tries to install additional
11IEs for scanning while the driver does not support this.
12
13The kernel indicates the maximum number of bytes for additional scan IEs
14using the NL80211_ATTR_MAX_SCAN_IE_LEN attribute. Save this value and
15only add additional scan IEs in case the driver can accommodate these
16additional IEs.
17
18Reported-by: Étienne Morice <neon.emorice@mail.com>
19Tested-by: Étienne Morice <neon.emorice@mail.com>
20Signed-off-by: David Bauer <mail@david-bauer.net>
21---
22 src/drivers/driver.h | 3 +++
23 src/drivers/driver_nl80211_capa.c | 4 ++++
24 src/drivers/driver_nl80211_scan.c | 2 +-
25 3 files changed, 8 insertions(+), 1 deletion(-)
26
27--- a/src/drivers/driver.h
28+++ b/src/drivers/driver.h
29@@ -2283,6 +2283,9 @@ struct wpa_driver_capa {
30 /** Maximum number of iterations in a single scan plan */
31 u32 max_sched_scan_plan_iterations;
32
33+ /** Maximum number of extra IE bytes for scans */
34+ u16 max_scan_ie_len;
35+
36 /** Whether sched_scan (offloaded scanning) is supported */
37 int sched_scan_supported;
38
39--- a/src/drivers/driver_nl80211_capa.c
40+++ b/src/drivers/driver_nl80211_capa.c
41@@ -949,6 +949,10 @@ static int wiphy_info_handler(struct nl_
42 nla_get_u32(tb[NL80211_ATTR_MAX_SCAN_PLAN_ITERATIONS]);
43 }
44
45+ if (tb[NL80211_ATTR_MAX_SCAN_IE_LEN])
46+ capa->max_scan_ie_len =
47+ nla_get_u16(tb[NL80211_ATTR_MAX_SCAN_IE_LEN]);
48+
49 if (tb[NL80211_ATTR_MAX_MATCH_SETS])
50 capa->max_match_sets =
51 nla_get_u8(tb[NL80211_ATTR_MAX_MATCH_SETS]);
52--- a/src/drivers/driver_nl80211_scan.c
53+++ b/src/drivers/driver_nl80211_scan.c
54@@ -222,7 +222,7 @@ nl80211_scan_common(struct i802_bss *bss
55 wpa_printf(MSG_DEBUG, "nl80211: Passive scan requested");
56 }
57
58- if (params->extra_ies) {
59+ if (params->extra_ies && drv->capa.max_scan_ie_len >= params->extra_ies_len) {
60 wpa_hexdump(MSG_MSGDUMP, "nl80211: Scan extra IEs",
61 params->extra_ies, params->extra_ies_len);
62 if (nla_put(msg, NL80211_ATTR_IE, params->extra_ies_len,