]>
Commit | Line | Data |
---|---|---|
1143c684 SL |
1 | From 6c17d17476b84f747c1ebb81fc922a5f8c10e966 Mon Sep 17 00:00:00 2001 |
2 | From: Sergey Matyukevich <sergey.matyukevich.os@quantenna.com> | |
3 | Date: Tue, 26 Mar 2019 09:27:37 +0000 | |
4 | Subject: mac80211/cfg80211: update bss channel on channel switch | |
5 | ||
6 | [ Upstream commit 5dc8cdce1d722c733f8c7af14c5fb595cfedbfa8 ] | |
7 | ||
8 | FullMAC STAs have no way to update bss channel after CSA channel switch | |
9 | completion. As a result, user-space tools may provide inconsistent | |
10 | channel info. For instance, consider the following two commands: | |
11 | $ sudo iw dev wlan0 link | |
12 | $ sudo iw dev wlan0 info | |
13 | The latter command gets channel info from the hardware, so most probably | |
14 | its output will be correct. However the former command gets channel info | |
15 | from scan cache, so its output will contain outdated channel info. | |
16 | In fact, current bss channel info will not be updated until the | |
17 | next [re-]connect. | |
18 | ||
19 | Note that mac80211 STAs have a workaround for this, but it requires | |
20 | access to internal cfg80211 data, see ieee80211_chswitch_work: | |
21 | ||
22 | /* XXX: shouldn't really modify cfg80211-owned data! */ | |
23 | ifmgd->associated->channel = sdata->csa_chandef.chan; | |
24 | ||
25 | This patch suggests to convert mac80211 workaround into cfg80211 behavior | |
26 | and to update current bss channel in cfg80211_ch_switch_notify. | |
27 | ||
28 | Signed-off-by: Sergey Matyukevich <sergey.matyukevich.os@quantenna.com> | |
29 | Signed-off-by: Johannes Berg <johannes.berg@intel.com> | |
30 | Signed-off-by: Sasha Levin <sashal@kernel.org> | |
31 | --- | |
32 | net/mac80211/mlme.c | 3 --- | |
33 | net/wireless/nl80211.c | 5 +++++ | |
34 | 2 files changed, 5 insertions(+), 3 deletions(-) | |
35 | ||
36 | diff --git a/net/mac80211/mlme.c b/net/mac80211/mlme.c | |
37 | index ed4fef32b394f..08384dbf426c8 100644 | |
38 | --- a/net/mac80211/mlme.c | |
39 | +++ b/net/mac80211/mlme.c | |
40 | @@ -1104,9 +1104,6 @@ static void ieee80211_chswitch_work(struct work_struct *work) | |
41 | goto out; | |
42 | } | |
43 | ||
44 | - /* XXX: shouldn't really modify cfg80211-owned data! */ | |
45 | - ifmgd->associated->channel = sdata->csa_chandef.chan; | |
46 | - | |
47 | ifmgd->csa_waiting_bcn = true; | |
48 | ||
49 | ieee80211_sta_reset_beacon_monitor(sdata); | |
50 | diff --git a/net/wireless/nl80211.c b/net/wireless/nl80211.c | |
51 | index 81013490a99f4..1968998e6c6c2 100644 | |
52 | --- a/net/wireless/nl80211.c | |
53 | +++ b/net/wireless/nl80211.c | |
54 | @@ -12788,6 +12788,11 @@ void cfg80211_ch_switch_notify(struct net_device *dev, | |
55 | ||
56 | wdev->chandef = *chandef; | |
57 | wdev->preset_chandef = *chandef; | |
58 | + | |
59 | + if (wdev->iftype == NL80211_IFTYPE_STATION && | |
60 | + !WARN_ON(!wdev->current_bss)) | |
61 | + wdev->current_bss->pub.channel = chandef->chan; | |
62 | + | |
63 | nl80211_ch_switch_notify(rdev, dev, chandef, GFP_KERNEL, | |
64 | NL80211_CMD_CH_SWITCH_NOTIFY, 0); | |
65 | } | |
66 | -- | |
67 | 2.20.1 | |
68 |