summaryrefslogtreecommitdiffstats
path: root/net/wireless/ibss.c
diff options
context:
space:
mode:
authorSimon Wunderlich <simon.wunderlich@s2003.tu-chemnitz.de>2013-10-07 18:41:05 +0200
committerJohannes Berg <johannes.berg@intel.com>2013-10-28 15:05:21 +0100
commit5336fa88e8ac6b666a3db9902a4797d94d86a702 (patch)
tree0dacc5508f7ab1e65f894d6f09c4b56e7a6da9fb /net/wireless/ibss.c
parent687da132234feb70748df04a007bc1820f392254 (diff)
downloadlinux-5336fa88e8ac6b666a3db9902a4797d94d86a702.tar.bz2
nl80211/cfg80211: enable DFS for IBSS mode
To use DFS in IBSS mode, userspace is required to react to radar events. It can inform nl80211 that it is capable of doing so by adding a NL80211_ATTR_HANDLE_DFS attribute when joining the IBSS. This attribute is supplied to let the kernelspace know that the userspace application can and will handle radar events, e.g. by intiating channel switches to a valid channel. DFS channels may only be used if this attribute is supplied and the driver supports it. Driver support will be checked even if a channel without DFS will be initially joined, as a DFS channel may be chosen later. Signed-off-by: Simon Wunderlich <siwu@hrz.tu-chemnitz.de> Signed-off-by: Mathias Kretschmer <mathias.kretschmer@fokus.fraunhofer.de> [fix attribute name in commit message] Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Diffstat (limited to 'net/wireless/ibss.c')
-rw-r--r--net/wireless/ibss.c24
1 files changed, 20 insertions, 4 deletions
diff --git a/net/wireless/ibss.c b/net/wireless/ibss.c
index 39bff7d36768..fa7461b6ba39 100644
--- a/net/wireless/ibss.c
+++ b/net/wireless/ibss.c
@@ -83,6 +83,8 @@ int __cfg80211_join_ibss(struct cfg80211_registered_device *rdev,
struct cfg80211_cached_keys *connkeys)
{
struct wireless_dev *wdev = dev->ieee80211_ptr;
+ struct ieee80211_channel *check_chan;
+ u8 radar_detect_width = 0;
int err;
ASSERT_WDEV_LOCK(wdev);
@@ -114,14 +116,28 @@ int __cfg80211_join_ibss(struct cfg80211_registered_device *rdev,
wdev->connect_keys = connkeys;
wdev->ibss_fixed = params->channel_fixed;
+ wdev->ibss_dfs_possible = params->userspace_handles_dfs;
#ifdef CONFIG_CFG80211_WEXT
wdev->wext.ibss.chandef = params->chandef;
#endif
+ check_chan = params->chandef.chan;
+ if (params->userspace_handles_dfs) {
+ /* use channel NULL to check for radar even if the current
+ * channel is not a radar channel - it might decide to change
+ * to DFS channel later.
+ */
+ radar_detect_width = BIT(params->chandef.width);
+ check_chan = NULL;
+ }
+
+ err = cfg80211_can_use_iftype_chan(rdev, wdev, wdev->iftype,
+ check_chan,
+ (params->channel_fixed &&
+ !radar_detect_width)
+ ? CHAN_MODE_SHARED
+ : CHAN_MODE_EXCLUSIVE,
+ radar_detect_width);
- err = cfg80211_can_use_chan(rdev, wdev, params->chandef.chan,
- params->channel_fixed
- ? CHAN_MODE_SHARED
- : CHAN_MODE_EXCLUSIVE);
if (err) {
wdev->connect_keys = NULL;
return err;