developer | bf0f2d6 | 2023-11-14 17:01:47 +0800 | [diff] [blame] | 1 | From: David Bauer <mail@david-bauer.net> |
| 2 | To: hostap@lists.infradead.org |
| 3 | Cc: =?utf-8?q?=C3=89tienne_Morice?= <neon.emorice@mail.com> |
| 4 | Subject: [PATCH] nl80211: add extra-ies only if allowed by driver |
| 5 | Date: Sun, 30 Jan 2022 20:22:00 +0100 |
| 6 | Message-Id: <20220130192200.10883-1-mail@david-bauer.net> |
| 7 | List-Id: <hostap.lists.infradead.org> |
| 8 | |
| 9 | Upgrading wpa_supplicant from 2.9 to 2.10 breaks broadcom-wl |
| 10 | based adapters. The reason for it is hostapd tries to install additional |
| 11 | IEs for scanning while the driver does not support this. |
| 12 | |
| 13 | The kernel indicates the maximum number of bytes for additional scan IEs |
| 14 | using the NL80211_ATTR_MAX_SCAN_IE_LEN attribute. Save this value and |
| 15 | only add additional scan IEs in case the driver can accommodate these |
| 16 | additional IEs. |
| 17 | |
| 18 | Reported-by: Étienne Morice <neon.emorice@mail.com> |
| 19 | Tested-by: Étienne Morice <neon.emorice@mail.com> |
| 20 | Signed-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, |