upgpkg: sbcl 2.3.1-1
[arch-packages.git] / wpa_supplicant / repos / core-x86_64 / 0001-nl80211-add-extra-ies-only-if-allowed-by-driver.patch
blob5a395d57b3534745ffca4536b3871ecc897e84b3
1 From: David Bauer <mail@david-bauer.net>
2 Date: Sun, 30 Jan 2022 20:22:00 +0100
3 Subject: nl80211: add extra-ies only if allowed by driver
5 Upgrading wpa_supplicant from 2.9 to 2.10 breaks broadcom-wl
6 based adapters. The reason for it is hostapd tries to install additional
7 IEs for scanning while the driver does not support this.
9 The kernel indicates the maximum number of bytes for additional scan IEs
10 using the NL80211_ATTR_MAX_SCAN_IE_LEN attribute. Save this value and
11 only add additional scan IEs in case the driver can accommodate these
12 additional IEs.
14 Reported-by: Étienne Morice <neon.emorice@mail.com>
15 Tested-by: Étienne Morice <neon.emorice@mail.com>
16 Signed-off-by: David Bauer <mail@david-bauer.net>
18 Bug: http://lists.infradead.org/pipermail/hostap/2022-January/040178.html
19 Bug-ArchLinux: https://bugs.archlinux.org/task/73495
20 Bug-Debian: https://bugs.debian.org/1004524
21 Origin: http://lists.infradead.org/pipermail/hostap/2022-January/040185.html
22 ---
23 src/drivers/driver.h | 3 +++
24 src/drivers/driver_nl80211_capa.c | 4 ++++
25 src/drivers/driver_nl80211_scan.c | 2 +-
26 3 files changed, 8 insertions(+), 1 deletion(-)
28 diff --git a/src/drivers/driver.h b/src/drivers/driver.h
29 index d3312a3..b5b6264 100644
30 --- a/src/drivers/driver.h
31 +++ b/src/drivers/driver.h
32 @@ -2052,6 +2052,9 @@ struct wpa_driver_capa {
33 /** Maximum number of iterations in a single scan plan */
34 u32 max_sched_scan_plan_iterations;
36 + /** Maximum number of extra IE bytes for scans */
37 + u16 max_scan_ie_len;
39 /** Whether sched_scan (offloaded scanning) is supported */
40 int sched_scan_supported;
42 diff --git a/src/drivers/driver_nl80211_capa.c b/src/drivers/driver_nl80211_capa.c
43 index 83868b7..b33b6ba 100644
44 --- a/src/drivers/driver_nl80211_capa.c
45 +++ b/src/drivers/driver_nl80211_capa.c
46 @@ -885,6 +885,10 @@ static int wiphy_info_handler(struct nl_msg *msg, void *arg)
47 nla_get_u32(tb[NL80211_ATTR_MAX_SCAN_PLAN_ITERATIONS]);
50 + if (tb[NL80211_ATTR_MAX_SCAN_IE_LEN])
51 + capa->max_scan_ie_len =
52 + nla_get_u16(tb[NL80211_ATTR_MAX_SCAN_IE_LEN]);
54 if (tb[NL80211_ATTR_MAX_MATCH_SETS])
55 capa->max_match_sets =
56 nla_get_u8(tb[NL80211_ATTR_MAX_MATCH_SETS]);
57 diff --git a/src/drivers/driver_nl80211_scan.c b/src/drivers/driver_nl80211_scan.c
58 index 1316084..b0f0951 100644
59 --- a/src/drivers/driver_nl80211_scan.c
60 +++ b/src/drivers/driver_nl80211_scan.c
61 @@ -207,7 +207,7 @@ nl80211_scan_common(struct i802_bss *bss, u8 cmd,
62 wpa_printf(MSG_DEBUG, "nl80211: Passive scan requested");
65 - if (params->extra_ies) {
66 + if (params->extra_ies && drv->capa.max_scan_ie_len >= params->extra_ies_len) {
67 wpa_hexdump(MSG_MSGDUMP, "nl80211: Scan extra IEs",
68 params->extra_ies, params->extra_ies_len);
69 if (nla_put(msg, NL80211_ATTR_IE, params->extra_ies_len,