Skip to content

Commit

Permalink
wireless: Only join DFS channels in mesh mode if userspace flags support
Browse files Browse the repository at this point in the history
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 <[email protected]>
Signed-off-by: Simon Wunderlich <[email protected]>
Signed-off-by: Johannes Berg <[email protected]>
  • Loading branch information
benzea authored and jmberg-intel committed May 19, 2017
1 parent 61b81b4 commit d37d49c
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 0 deletions.
4 changes: 4 additions & 0 deletions include/net/cfg80211.h
Original file line number Diff line number Diff line change
Expand Up @@ -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.
*/
Expand All @@ -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;
};

/**
Expand Down
8 changes: 8 additions & 0 deletions net/wireless/mesh.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
3 changes: 3 additions & 0 deletions net/wireless/nl80211.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}

Expand Down

0 comments on commit d37d49c

Please sign in to comment.