From d37d49c2f18fb53c6315b2b0fd7f1fb3d8be57ac Mon Sep 17 00:00:00 2001 From: Benjamin Berg Date: Tue, 16 May 2017 11:23:11 +0200 Subject: wireless: Only join DFS channels in mesh mode if userspace flags support 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 Signed-off-by: Simon Wunderlich Signed-off-by: Johannes Berg --- net/wireless/mesh.c | 8 ++++++++ net/wireless/nl80211.c | 3 +++ 2 files changed, 11 insertions(+) (limited to 'net/wireless') diff --git a/net/wireless/mesh.c b/net/wireless/mesh.c index ec0b1c20ac99..421a6b80ec62 100644 --- a/net/wireless/mesh.c +++ b/net/wireless/mesh.c @@ -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; diff --git a/net/wireless/nl80211.c b/net/wireless/nl80211.c index c3bc9da30cff..d47e55e3f445 100644 --- a/net/wireless/nl80211.c +++ b/net/wireless/nl80211.c @@ -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); } -- cgit v1.2.3