Before we will start radar detection check if we have correct DFS region. Fail in case we don't know DFS region (don't know CAC/NOP timing and how to configure DFS pattern detector). Signed-off-by: Janusz Dziedzic <janusz.dziedzic@xxxxxxxxx> --- net/wireless/nl80211.c | 5 +++++ net/wireless/reg.c | 16 ++++++++++++++++ net/wireless/reg.h | 1 + 3 files changed, 22 insertions(+) diff --git a/net/wireless/nl80211.c b/net/wireless/nl80211.c index 3f8c364..4669644 100644 --- a/net/wireless/nl80211.c +++ b/net/wireless/nl80211.c @@ -5631,8 +5631,13 @@ static int nl80211_start_radar_detection(struct sk_buff *skb, struct net_device *dev = info->user_ptr[1]; struct wireless_dev *wdev = dev->ieee80211_ptr; struct cfg80211_chan_def chandef; + enum nl80211_dfs_regions dfs_region; int err; + dfs_region = reg_get_dfs_region(wdev->wiphy); + if (dfs_region == NL80211_DFS_UNSET) + return -EINVAL; + err = nl80211_parse_chandef(rdev, info, &chandef); if (err) return err; diff --git a/net/wireless/reg.c b/net/wireless/reg.c index a75c5ed..bba81c7 100644 --- a/net/wireless/reg.c +++ b/net/wireless/reg.c @@ -2129,6 +2129,22 @@ bool reg_supported_dfs_region(u8 dfs_region) } } +enum nl80211_dfs_regions reg_get_dfs_region(struct wiphy *wiphy) +{ + const struct ieee80211_regdomain *regdom = NULL; + + ASSERT_RTNL(); + + if (wiphy) + regdom = get_wiphy_regdom(wiphy); + if (!regdom) + regdom = get_cfg80211_regdom(); + if (!regdom) + return NL80211_DFS_UNSET; + + return regdom->dfs_region; +} + static void print_dfs_region(u8 dfs_region) { if (!dfs_region) diff --git a/net/wireless/reg.h b/net/wireless/reg.h index b4076ba..f8c8a49 100644 --- a/net/wireless/reg.h +++ b/net/wireless/reg.h @@ -21,6 +21,7 @@ extern const struct ieee80211_regdomain __rcu *cfg80211_regdomain; bool reg_is_valid_request(const char *alpha2); bool is_world_regdom(const char *alpha2); bool reg_supported_dfs_region(u8 dfs_region); +enum nl80211_dfs_regions reg_get_dfs_region(struct wiphy *wiphy); int regulatory_hint_user(const char *alpha2, enum nl80211_user_reg_hint_type user_reg_hint_type); -- 1.7.9.5 -- To unsubscribe from this list: send the line "unsubscribe linux-wireless" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html