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