Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

mac80211: mesh: don't use global channel type

Using local->_oper_channel_type in the mesh code is
completely wrong as this value is the combination
of the various interface channel types and can be
a different value from the mesh interface in case
there are multiple virtual interfaces.

Use sdata->vif.bss_conf.channel_type instead as it
tracks the per-vif channel type.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>

+10 -8
+6 -5
net/mac80211/mesh.c
··· 109 109 110 110 /* Disallow HT40+/- mismatch */ 111 111 if (ie->ht_operation && 112 - (local->_oper_channel_type == NL80211_CHAN_HT40MINUS || 113 - local->_oper_channel_type == NL80211_CHAN_HT40PLUS) && 112 + (sdata->vif.bss_conf.channel_type == NL80211_CHAN_HT40MINUS || 113 + sdata->vif.bss_conf.channel_type == NL80211_CHAN_HT40PLUS) && 114 114 (sta_channel_type == NL80211_CHAN_HT40MINUS || 115 115 sta_channel_type == NL80211_CHAN_HT40PLUS) && 116 - local->_oper_channel_type != sta_channel_type) 116 + sdata->vif.bss_conf.channel_type != sta_channel_type) 117 117 goto mismatch; 118 118 119 119 return true; ··· 375 375 376 376 sband = local->hw.wiphy->bands[local->oper_channel->band]; 377 377 if (!sband->ht_cap.ht_supported || 378 - local->_oper_channel_type == NL80211_CHAN_NO_HT) 378 + sdata->vif.bss_conf.channel_type == NL80211_CHAN_NO_HT) 379 379 return 0; 380 380 381 381 if (skb_tailroom(skb) < 2 + sizeof(struct ieee80211_ht_cap)) ··· 392 392 { 393 393 struct ieee80211_local *local = sdata->local; 394 394 struct ieee80211_channel *channel = local->oper_channel; 395 - enum nl80211_channel_type channel_type = local->_oper_channel_type; 395 + enum nl80211_channel_type channel_type = 396 + sdata->vif.bss_conf.channel_type; 396 397 struct ieee80211_supported_band *sband = 397 398 local->hw.wiphy->bands[channel->band]; 398 399 struct ieee80211_sta_ht_cap *ht_cap = &sband->ht_cap;
+4 -3
net/mac80211/mesh_plink.c
··· 117 117 u16 ht_opmode; 118 118 bool non_ht_sta = false, ht20_sta = false; 119 119 120 - if (local->_oper_channel_type == NL80211_CHAN_NO_HT) 120 + if (sdata->vif.bss_conf.channel_type == NL80211_CHAN_NO_HT) 121 121 return 0; 122 122 123 123 rcu_read_lock(); ··· 147 147 148 148 if (non_ht_sta) 149 149 ht_opmode = IEEE80211_HT_OP_MODE_PROTECTION_NONHT_MIXED; 150 - else if (ht20_sta && local->_oper_channel_type > NL80211_CHAN_HT20) 150 + else if (ht20_sta && 151 + sdata->vif.bss_conf.channel_type > NL80211_CHAN_HT20) 151 152 ht_opmode = IEEE80211_HT_OP_MODE_PROTECTION_20MHZ; 152 153 else 153 154 ht_opmode = IEEE80211_HT_OP_MODE_PROTECTION_NONE; ··· 380 379 381 380 sta->sta.supp_rates[band] = rates; 382 381 if (elems->ht_cap_elem && 383 - sdata->local->_oper_channel_type != NL80211_CHAN_NO_HT) 382 + sdata->vif.bss_conf.channel_type != NL80211_CHAN_NO_HT) 384 383 ieee80211_ht_cap_ie_to_sta_ht_cap(sdata, sband, 385 384 elems->ht_cap_elem, 386 385 &sta->sta.ht_cap);