992-nl80211-add-extra-ies-only-if-allowed-by-driver.patch 2.3 KB

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