提交 5d55371b 编写于 作者: B Benjamin Berg 提交者: Johannes Berg

mac80211: mesh: mark channel as unusable if a regulatory MESH CSA is received

In the Mesh Channel Switch Parameters (8.4.2.105) the reason is specified
to WLAN_REASON_MESH_CHAN_REGULATORY in the case that a regulatory
limitation was the cause for the switch. This means another station
detected a radar event.

Mark the channel as unusable if this happens.
Signed-off-by: NBenjamin Berg <benjamin@sipsolutions.net>
[sw: style cleanup, rebase]
Signed-off-by: NSimon Wunderlich <sw@simonwunderlich.de>
Signed-off-by: NJohannes Berg <johannes.berg@intel.com>
上级 484a54c2
...@@ -1440,6 +1440,7 @@ struct ieee80211_csa_ie { ...@@ -1440,6 +1440,7 @@ struct ieee80211_csa_ie {
u8 count; u8 count;
u8 ttl; u8 ttl;
u16 pre_value; u16 pre_value;
u16 reason_code;
}; };
/* Parsed Information Elements */ /* Parsed Information Elements */
......
...@@ -916,6 +916,21 @@ void ieee80211_stop_mesh(struct ieee80211_sub_if_data *sdata) ...@@ -916,6 +916,21 @@ void ieee80211_stop_mesh(struct ieee80211_sub_if_data *sdata)
ieee80211_configure_filter(local); ieee80211_configure_filter(local);
} }
static void ieee80211_mesh_csa_mark_radar(struct ieee80211_sub_if_data *sdata)
{
int err;
/* if the current channel is a DFS channel, mark the channel as
* unavailable.
*/
err = cfg80211_chandef_dfs_required(sdata->local->hw.wiphy,
&sdata->vif.bss_conf.chandef,
NL80211_IFTYPE_MESH_POINT);
if (err > 0)
cfg80211_radar_event(sdata->local->hw.wiphy,
&sdata->vif.bss_conf.chandef, GFP_ATOMIC);
}
static bool static bool
ieee80211_mesh_process_chnswitch(struct ieee80211_sub_if_data *sdata, ieee80211_mesh_process_chnswitch(struct ieee80211_sub_if_data *sdata,
struct ieee802_11_elems *elems, bool beacon) struct ieee802_11_elems *elems, bool beacon)
...@@ -954,6 +969,12 @@ ieee80211_mesh_process_chnswitch(struct ieee80211_sub_if_data *sdata, ...@@ -954,6 +969,12 @@ ieee80211_mesh_process_chnswitch(struct ieee80211_sub_if_data *sdata,
if (err) if (err)
return false; return false;
/* Mark the channel unavailable if the reason for the switch is
* regulatory.
*/
if (csa_ie.reason_code == WLAN_REASON_MESH_CHAN_REGULATORY)
ieee80211_mesh_csa_mark_radar(sdata);
params.chandef = csa_ie.chandef; params.chandef = csa_ie.chandef;
params.count = csa_ie.count; params.count = csa_ie.count;
......
...@@ -76,6 +76,11 @@ int ieee80211_parse_ch_switch_ie(struct ieee80211_sub_if_data *sdata, ...@@ -76,6 +76,11 @@ int ieee80211_parse_ch_switch_ie(struct ieee80211_sub_if_data *sdata,
csa_ie->mode = elems->mesh_chansw_params_ie->mesh_flags; csa_ie->mode = elems->mesh_chansw_params_ie->mesh_flags;
csa_ie->pre_value = le16_to_cpu( csa_ie->pre_value = le16_to_cpu(
elems->mesh_chansw_params_ie->mesh_pre_value); elems->mesh_chansw_params_ie->mesh_pre_value);
if (elems->mesh_chansw_params_ie->mesh_flags &
WLAN_EID_CHAN_SWITCH_PARAM_REASON)
csa_ie->reason_code = le16_to_cpu(
elems->mesh_chansw_params_ie->mesh_reason);
} }
new_freq = ieee80211_channel_to_frequency(new_chan_no, new_band); new_freq = ieee80211_channel_to_frequency(new_chan_no, new_band);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册