Skip to content

Commit 84469a4

Browse files
lucacoelhojmberg-intel
authored andcommitted
mac80211: use secondary channel offset IE also beacons during CSA
If we are switching from an HT40+ to an HT40- channel (or vice-versa), we need the secondary channel offset IE to specify what is the post-CSA offset to be used. This applies both to beacons and to probe responses. In ieee80211_parse_ch_switch_ie() we were ignoring this IE from beacons and using the *current* HT information IE instead. This was causing us to use the same offset as before the switch. Fix that by using the secondary channel offset IE also for beacons and don't ever use the pre-switch offset. Additionally, remove the "beacon" argument from ieee80211_parse_ch_switch_ie(), since it's not needed anymore. Cc: stable@vger.kernel.org Reported-by: Jouni Malinen <j@w1.fi> Signed-off-by: Luciano Coelho <luciano.coelho@intel.com> Signed-off-by: Johannes Berg <johannes.berg@intel.com>
1 parent 10b6848 commit 84469a4

5 files changed

Lines changed: 10 additions & 17 deletions

File tree

‎net/mac80211/ibss.c‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -805,7 +805,7 @@ ieee80211_ibss_process_chanswitch(struct ieee80211_sub_if_data *sdata,
805805

806806
memset(&params, 0, sizeof(params));
807807
memset(&csa_ie, 0, sizeof(csa_ie));
808-
err = ieee80211_parse_ch_switch_ie(sdata, elems, beacon,
808+
err = ieee80211_parse_ch_switch_ie(sdata, elems,
809809
ifibss->chandef.chan->band,
810810
sta_flags, ifibss->bssid, &csa_ie);
811811
/* can't switch to destination channel, fail */

‎net/mac80211/ieee80211_i.h‎

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1642,7 +1642,6 @@ void ieee80211_process_measurement_req(struct ieee80211_sub_if_data *sdata,
16421642
* ieee80211_parse_ch_switch_ie - parses channel switch IEs
16431643
* @sdata: the sdata of the interface which has received the frame
16441644
* @elems: parsed 802.11 elements received with the frame
1645-
* @beacon: indicates if the frame was a beacon or probe response
16461645
* @current_band: indicates the current band
16471646
* @sta_flags: contains information about own capabilities and restrictions
16481647
* to decide which channel switch announcements can be accepted. Only the
@@ -1656,7 +1655,7 @@ void ieee80211_process_measurement_req(struct ieee80211_sub_if_data *sdata,
16561655
* Return: 0 on success, <0 on error and >0 if there is nothing to parse.
16571656
*/
16581657
int ieee80211_parse_ch_switch_ie(struct ieee80211_sub_if_data *sdata,
1659-
struct ieee802_11_elems *elems, bool beacon,
1658+
struct ieee802_11_elems *elems,
16601659
enum ieee80211_band current_band,
16611660
u32 sta_flags, u8 *bssid,
16621661
struct ieee80211_csa_ie *csa_ie);

‎net/mac80211/mesh.c‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -874,7 +874,7 @@ ieee80211_mesh_process_chnswitch(struct ieee80211_sub_if_data *sdata,
874874

875875
memset(&params, 0, sizeof(params));
876876
memset(&csa_ie, 0, sizeof(csa_ie));
877-
err = ieee80211_parse_ch_switch_ie(sdata, elems, beacon, band,
877+
err = ieee80211_parse_ch_switch_ie(sdata, elems, band,
878878
sta_flags, sdata->vif.addr,
879879
&csa_ie);
880880
if (err < 0)

‎net/mac80211/mlme.c‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1072,7 +1072,7 @@ ieee80211_sta_process_chanswitch(struct ieee80211_sub_if_data *sdata,
10721072

10731073
current_band = cbss->channel->band;
10741074
memset(&csa_ie, 0, sizeof(csa_ie));
1075-
res = ieee80211_parse_ch_switch_ie(sdata, elems, beacon, current_band,
1075+
res = ieee80211_parse_ch_switch_ie(sdata, elems, current_band,
10761076
ifmgd->flags,
10771077
ifmgd->associated->bssid, &csa_ie);
10781078
if (res < 0)

‎net/mac80211/spectmgmt.c‎

Lines changed: 6 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
#include "wme.h"
2323

2424
int ieee80211_parse_ch_switch_ie(struct ieee80211_sub_if_data *sdata,
25-
struct ieee802_11_elems *elems, bool beacon,
25+
struct ieee802_11_elems *elems,
2626
enum ieee80211_band current_band,
2727
u32 sta_flags, u8 *bssid,
2828
struct ieee80211_csa_ie *csa_ie)
@@ -91,19 +91,13 @@ int ieee80211_parse_ch_switch_ie(struct ieee80211_sub_if_data *sdata,
9191
return -EINVAL;
9292
}
9393

94-
if (!beacon && sec_chan_offs) {
94+
if (sec_chan_offs) {
9595
secondary_channel_offset = sec_chan_offs->sec_chan_offs;
96-
} else if (beacon && ht_oper) {
97-
secondary_channel_offset =
98-
ht_oper->ht_param & IEEE80211_HT_PARAM_CHA_SEC_OFFSET;
9996
} else if (!(sta_flags & IEEE80211_STA_DISABLE_HT)) {
100-
/* If it's not a beacon, HT is enabled and the IE not present,
101-
* it's 20 MHz, 802.11-2012 8.5.2.6:
102-
* This element [the Secondary Channel Offset Element] is
103-
* present when switching to a 40 MHz channel. It may be
104-
* present when switching to a 20 MHz channel (in which
105-
* case the secondary channel offset is set to SCN).
106-
*/
97+
/* If the secondary channel offset IE is not present,
98+
* we can't know what's the post-CSA offset, so the
99+
* best we can do is use 20MHz.
100+
*/
107101
secondary_channel_offset = IEEE80211_HT_PARAM_CHA_SEC_NONE;
108102
}
109103

0 commit comments

Comments
 (0)