369-cfg80211-use-only-1Mbps-for-basic-rates-in-mesh.patch 2.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  1. From: Johannes Berg <[email protected]>
  2. Date: Tue, 30 Jan 2018 13:17:38 +0100
  3. Subject: [PATCH] cfg80211: use only 1Mbps for basic rates in mesh
  4. Mesh used to use the mandatory rates as basic rates, but we got
  5. the calculation of mandatory rates wrong until some time ago.
  6. Fix this this broke interoperability with older versions since
  7. now more basic rates are required, and thus the MBSS isn't the
  8. same and the network stops working.
  9. Fix this by simply using only 1Mbps as the basic rate in 2.4GHz.
  10. Since the changed mandatory rates only affected 2.4GHz, this is
  11. all we need to make it work again.
  12. Reported-and-tested-by: Matthias Schiffer <[email protected]>
  13. Fixes: 1bd773c077de ("wireless: set correct mandatory rate flags")
  14. Signed-off-by: Johannes Berg <[email protected]>
  15. ---
  16. net/wireless/mesh.c | 25 ++++++++++++++++++++++---
  17. 1 file changed, 22 insertions(+), 3 deletions(-)
  18. --- a/net/wireless/mesh.c
  19. +++ b/net/wireless/mesh.c
  20. @@ -169,9 +169,28 @@ int __cfg80211_join_mesh(struct cfg80211
  21. enum nl80211_bss_scan_width scan_width;
  22. struct ieee80211_supported_band *sband =
  23. rdev->wiphy.bands[setup->chandef.chan->band];
  24. - scan_width = cfg80211_chandef_to_scan_width(&setup->chandef);
  25. - setup->basic_rates = ieee80211_mandatory_rates(sband,
  26. - scan_width);
  27. +
  28. + if (setup->chandef.chan->band == NL80211_BAND_2GHZ) {
  29. + int i;
  30. +
  31. + /*
  32. + * Older versions selected the mandatory rates for
  33. + * 2.4 GHz as well, but were broken in that only
  34. + * 1 Mbps was regarded as a mandatory rate. Keep
  35. + * using just 1 Mbps as the default basic rate for
  36. + * mesh to be interoperable with older versions.
  37. + */
  38. + for (i = 0; i < sband->n_bitrates; i++) {
  39. + if (sband->bitrates[i].bitrate == 10) {
  40. + setup->basic_rates = BIT(i);
  41. + break;
  42. + }
  43. + }
  44. + } else {
  45. + scan_width = cfg80211_chandef_to_scan_width(&setup->chandef);
  46. + setup->basic_rates = ieee80211_mandatory_rates(sband,
  47. + scan_width);
  48. + }
  49. }
  50. err = cfg80211_chandef_dfs_required(&rdev->wiphy,