Skip to content

Commit d37d49c

Browse files
benzeajmberg-intel
authored andcommitted
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 <benjamin@sipsolutions.net> Signed-off-by: Simon Wunderlich <sw@simonwunderlich.de> Signed-off-by: Johannes Berg <johannes.berg@intel.com>
1 parent 61b81b4 commit d37d49c

3 files changed

Lines changed: 15 additions & 0 deletions

File tree

‎include/net/cfg80211.h‎

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1441,6 +1441,9 @@ struct mesh_config {
14411441
* @mcast_rate: multicat rate for Mesh Node [6Mbps is the default for 802.11a]
14421442
* @basic_rates: basic rates to use when creating the mesh
14431443
* @beacon_rate: bitrate to be used for beacons
1444+
* @userspace_handles_dfs: whether user space controls DFS operation, i.e.
1445+
* changes the channel when a radar is detected. This is required
1446+
* to operate on DFS channels.
14441447
*
14451448
* These parameters are fixed when the mesh is created.
14461449
*/
@@ -1462,6 +1465,7 @@ struct mesh_setup {
14621465
int mcast_rate[NUM_NL80211_BANDS];
14631466
u32 basic_rates;
14641467
struct cfg80211_bitrate_mask beacon_rate;
1468+
bool userspace_handles_dfs;
14651469
};
14661470

14671471
/**

‎net/wireless/mesh.c‎

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -174,6 +174,14 @@ int __cfg80211_join_mesh(struct cfg80211_registered_device *rdev,
174174
scan_width);
175175
}
176176

177+
err = cfg80211_chandef_dfs_required(&rdev->wiphy,
178+
&setup->chandef,
179+
NL80211_IFTYPE_MESH_POINT);
180+
if (err < 0)
181+
return err;
182+
if (err > 0 && !setup->userspace_handles_dfs)
183+
return -EINVAL;
184+
177185
if (!cfg80211_reg_can_beacon(&rdev->wiphy, &setup->chandef,
178186
NL80211_IFTYPE_MESH_POINT))
179187
return -EINVAL;

‎net/wireless/nl80211.c‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9962,6 +9962,9 @@ static int nl80211_join_mesh(struct sk_buff *skb, struct genl_info *info)
99629962
return err;
99639963
}
99649964

9965+
setup.userspace_handles_dfs =
9966+
nla_get_flag(info->attrs[NL80211_ATTR_HANDLE_DFS]);
9967+
99659968
return cfg80211_join_mesh(rdev, dev, &setup, &cfg);
99669969
}
99679970

0 commit comments

Comments
 (0)