aports

Custom Alpine Linux aports

git clone https://git.8pit.net/aports.git

 1From: David Bauer <mail@david-bauer.net>
 2Date: Sun, 30 Jan 2022 20:22:00 +0100
 3Subject: nl80211: add extra-ies only if allowed by driver
 4
 5Upgrading wpa_supplicant from 2.9 to 2.10 breaks broadcom-wl
 6based adapters. The reason for it is hostapd tries to install additional
 7IEs for scanning while the driver does not support this.
 8
 9The kernel indicates the maximum number of bytes for additional scan IEs
10using the NL80211_ATTR_MAX_SCAN_IE_LEN attribute. Save this value and
11only add additional scan IEs in case the driver can accommodate these
12additional IEs.
13
14Reported-by: Étienne Morice <neon.emorice@mail.com>
15Tested-by: Étienne Morice <neon.emorice@mail.com>
16Signed-off-by: David Bauer <mail@david-bauer.net>
17
18Bug: http://lists.infradead.org/pipermail/hostap/2022-January/040178.html
19Bug-ArchLinux: https://bugs.archlinux.org/task/73495
20Bug-Debian: https://bugs.debian.org/1004524
21Origin: 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(-)
27
28diff --git a/src/drivers/driver.h b/src/drivers/driver.h
29index 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;
35 
36+	/** Maximum number of extra IE bytes for scans */
37+	u16 max_scan_ie_len;
38+
39 	/** Whether sched_scan (offloaded scanning) is supported */
40 	int sched_scan_supported;
41 
42diff --git a/src/drivers/driver_nl80211_capa.c b/src/drivers/driver_nl80211_capa.c
43index 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]);
48 	}
49 
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]);
53+
54 	if (tb[NL80211_ATTR_MAX_MATCH_SETS])
55 		capa->max_match_sets =
56 			nla_get_u8(tb[NL80211_ATTR_MAX_MATCH_SETS]);
57diff --git a/src/drivers/driver_nl80211_scan.c b/src/drivers/driver_nl80211_scan.c
58index 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");
63 	}
64 
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,