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 IEs10using the NL80211_ATTR_MAX_SCAN_IE_LEN attribute. Save this value and11only add additional scan IEs in case the driver can accommodate these12additional IEs.1314Reported-by: Étienne Morice <neon.emorice@mail.com>15Tested-by: Étienne Morice <neon.emorice@mail.com>16Signed-off-by: David Bauer <mail@david-bauer.net>1718Bug: http://lists.infradead.org/pipermail/hostap/2022-January/040178.html19Bug-ArchLinux: https://bugs.archlinux.org/task/7349520Bug-Debian: https://bugs.debian.org/100452421Origin: http://lists.infradead.org/pipermail/hostap/2022-January/040185.html22---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(-)2728diff --git a/src/drivers/driver.h b/src/drivers/driver.h29index d3312a3..b5b6264 10064430--- a/src/drivers/driver.h31+++ b/src/drivers/driver.h32@@ -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;3536+ /** 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;4142diff --git a/src/drivers/driver_nl80211_capa.c b/src/drivers/driver_nl80211_capa.c43index 83868b7..b33b6ba 10064444--- a/src/drivers/driver_nl80211_capa.c45+++ b/src/drivers/driver_nl80211_capa.c46@@ -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 }4950+ 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.c58index 1316084..b0f0951 10064459--- a/src/drivers/driver_nl80211_scan.c60+++ b/src/drivers/driver_nl80211_scan.c61@@ -207,7 +207,7 @@ nl80211_scan_common(struct i802_bss *bss, u8 cmd,62 wpa_printf(MSG_DEBUG, "nl80211: Passive scan requested");63 }6465- 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,