summaryrefslogtreecommitdiffstats
path: root/net/mac80211/ibss.c
diff options
context:
space:
mode:
authorLuciano Coelho <luciano.coelho@intel.com>2014-02-18 04:40:36 -0500
committerJohannes Berg <johannes.berg@intel.com>2014-04-09 04:55:41 -0400
commit2beb6dab2d799ee8934cb0801845e551ad8c70f2 (patch)
tree58261561098a2bc3aaf747041382324119b00128 /net/mac80211/ibss.c
parentcb2d956dd329caa11b5ece454dc52253aa038e73 (diff)
cfg80211/mac80211: refactor cfg80211_chandef_dfs_required()
Some interface types don't require DFS (such as STATION, P2P_CLIENT etc). In order to centralize these decisions, make cfg80211_chandef_dfs_required() take the iftype into consideration. Signed-off-by: Luciano Coelho <luciano.coelho@intel.com> Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Diffstat (limited to 'net/mac80211/ibss.c')
-rw-r--r--net/mac80211/ibss.c32
1 files changed, 16 insertions, 16 deletions
diff --git a/net/mac80211/ibss.c b/net/mac80211/ibss.c
index 741445e498b0..1759bd661e25 100644
--- a/net/mac80211/ibss.c
+++ b/net/mac80211/ibss.c
@@ -228,7 +228,7 @@ static void __ieee80211_sta_join_ibss(struct ieee80211_sub_if_data *sdata,
228 struct beacon_data *presp; 228 struct beacon_data *presp;
229 enum nl80211_bss_scan_width scan_width; 229 enum nl80211_bss_scan_width scan_width;
230 bool have_higher_than_11mbit; 230 bool have_higher_than_11mbit;
231 bool radar_required = false; 231 bool radar_required;
232 int err; 232 int err;
233 233
234 sdata_assert_lock(sdata); 234 sdata_assert_lock(sdata);
@@ -284,21 +284,20 @@ static void __ieee80211_sta_join_ibss(struct ieee80211_sub_if_data *sdata,
284 } 284 }
285 285
286 err = cfg80211_chandef_dfs_required(sdata->local->hw.wiphy, 286 err = cfg80211_chandef_dfs_required(sdata->local->hw.wiphy,
287 &chandef); 287 &chandef, NL80211_IFTYPE_ADHOC);
288 if (err < 0) { 288 if (err < 0) {
289 sdata_info(sdata, 289 sdata_info(sdata,
290 "Failed to join IBSS, invalid chandef\n"); 290 "Failed to join IBSS, invalid chandef\n");
291 return; 291 return;
292 } 292 }
293 if (err > 0) { 293 if (err > 0 && !ifibss->userspace_handles_dfs) {
294 if (!ifibss->userspace_handles_dfs) { 294 sdata_info(sdata,
295 sdata_info(sdata, 295 "Failed to join IBSS, DFS channel without control program\n");
296 "Failed to join IBSS, DFS channel without control program\n"); 296 return;
297 return;
298 }
299 radar_required = true;
300 } 297 }
301 298
299 radar_required = err;
300
302 mutex_lock(&local->mtx); 301 mutex_lock(&local->mtx);
303 if (ieee80211_vif_use_channel(sdata, &chandef, 302 if (ieee80211_vif_use_channel(sdata, &chandef,
304 ifibss->fixed_channel ? 303 ifibss->fixed_channel ?
@@ -777,7 +776,8 @@ static void ieee80211_ibss_csa_mark_radar(struct ieee80211_sub_if_data *sdata)
777 * unavailable. 776 * unavailable.
778 */ 777 */
779 err = cfg80211_chandef_dfs_required(sdata->local->hw.wiphy, 778 err = cfg80211_chandef_dfs_required(sdata->local->hw.wiphy,
780 &ifibss->chandef); 779 &ifibss->chandef,
780 NL80211_IFTYPE_ADHOC);
781 if (err > 0) 781 if (err > 0)
782 cfg80211_radar_event(sdata->local->hw.wiphy, &ifibss->chandef, 782 cfg80211_radar_event(sdata->local->hw.wiphy, &ifibss->chandef,
783 GFP_ATOMIC); 783 GFP_ATOMIC);
@@ -876,17 +876,17 @@ ieee80211_ibss_process_chanswitch(struct ieee80211_sub_if_data *sdata,
876 } 876 }
877 877
878 err = cfg80211_chandef_dfs_required(sdata->local->hw.wiphy, 878 err = cfg80211_chandef_dfs_required(sdata->local->hw.wiphy,
879 &params.chandef); 879 &params.chandef,
880 NL80211_IFTYPE_ADHOC);
880 if (err < 0) 881 if (err < 0)
881 goto disconnect; 882 goto disconnect;
882 if (err) { 883 if (err > 0 && !ifibss->userspace_handles_dfs) {
883 /* IBSS-DFS only allowed with a control program */ 884 /* IBSS-DFS only allowed with a control program */
884 if (!ifibss->userspace_handles_dfs) 885 goto disconnect;
885 goto disconnect;
886
887 params.radar_required = true;
888 } 886 }
889 887
888 params.radar_required = err;
889
890 if (cfg80211_chandef_identical(&params.chandef, 890 if (cfg80211_chandef_identical(&params.chandef,
891 &sdata->vif.bss_conf.chandef)) { 891 &sdata->vif.bss_conf.chandef)) {
892 ibss_dbg(sdata, 892 ibss_dbg(sdata,