]> git.karo-electronics.de Git - karo-tx-linux.git/commitdiff
wireless: Only join DFS channels in mesh mode if userspace flags support
authorBenjamin Berg <benjamin@sipsolutions.net>
Tue, 16 May 2017 09:23:11 +0000 (11:23 +0200)
committerJohannes Berg <johannes.berg@intel.com>
Fri, 19 May 2017 11:25:58 +0000 (13:25 +0200)
When joining a mesh network it is not guaranteed that userspace has a
daemon listening for radar events. This is however required for channels
requiring DFS. To flag that userspace will handle radar events, it needs
to set NL80211_ATTR_HANDLE_DFS.

This matches the current mechanism used for IBSS mode.

Signed-off-by: Benjamin Berg <benjamin@sipsolutions.net>
Signed-off-by: Simon Wunderlich <sw@simonwunderlich.de>
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
include/net/cfg80211.h
net/wireless/mesh.c
net/wireless/nl80211.c

index b083e6cbae8cb33f3c9d9078bab5468cd80d31f1..fa25fbb67cb6a209850ad874b2b8838dc9231e76 100644 (file)
@@ -1441,6 +1441,9 @@ struct mesh_config {
  * @mcast_rate: multicat rate for Mesh Node [6Mbps is the default for 802.11a]
  * @basic_rates: basic rates to use when creating the mesh
  * @beacon_rate: bitrate to be used for beacons
+ * @userspace_handles_dfs: whether user space controls DFS operation, i.e.
+ *     changes the channel when a radar is detected. This is required
+ *     to operate on DFS channels.
  *
  * These parameters are fixed when the mesh is created.
  */
@@ -1462,6 +1465,7 @@ struct mesh_setup {
        int mcast_rate[NUM_NL80211_BANDS];
        u32 basic_rates;
        struct cfg80211_bitrate_mask beacon_rate;
+       bool userspace_handles_dfs;
 };
 
 /**
index ec0b1c20ac9920106efbc8798b53d1077a646e36..421a6b80ec62722ce98bc7d354b80a2a36d5f0ad 100644 (file)
@@ -174,6 +174,14 @@ int __cfg80211_join_mesh(struct cfg80211_registered_device *rdev,
                                                               scan_width);
        }
 
+       err = cfg80211_chandef_dfs_required(&rdev->wiphy,
+                                           &setup->chandef,
+                                           NL80211_IFTYPE_MESH_POINT);
+       if (err < 0)
+               return err;
+       if (err > 0 && !setup->userspace_handles_dfs)
+               return -EINVAL;
+
        if (!cfg80211_reg_can_beacon(&rdev->wiphy, &setup->chandef,
                                     NL80211_IFTYPE_MESH_POINT))
                return -EINVAL;
index c3bc9da30cff997970dc2cf8aebd05c4795c3cf9..d47e55e3f4457b41e01ca343c4e5c85131ad2a45 100644 (file)
@@ -9962,6 +9962,9 @@ static int nl80211_join_mesh(struct sk_buff *skb, struct genl_info *info)
                        return err;
        }
 
+       setup.userspace_handles_dfs =
+               nla_get_flag(info->attrs[NL80211_ATTR_HANDLE_DFS]);
+
        return cfg80211_join_mesh(rdev, dev, &setup, &cfg);
 }