Re: [PATCHv6 1/6] nl80211: check if channel can be used in join_ibss

Johannes Berg
2013-01-16T22:35:46Z

On Tue, 2013-01-08 at 14:04 +0100, Simon Wunderlich wrote:
> IBSS should also consider interface combinations.
>
> Signed-off-by: Simon Wunderlich <siwu@hrz.tu-chemnitz.de>
> ---
> net/wireless/nl80211.c | 10 ++++++++++
> 1 file changed, 10 insertions(+)
>
> diff --git a/net/wireless/nl80211.c b/net/wireless/nl80211.c
> index 9bd8340..62e98f5 100644
> --- a/net/wireless/nl80211.c
> +++ b/net/wireless/nl80211.c
> @@ -5463,6 +5463,7 @@ static int nl80211_join_ibss(struct sk_buff *skb, struct genl_info *info)
> {
> struct cfg80211_registered_device *rdev = info->user_ptr[0];
> struct net_device *dev = info->user_ptr[1];
> + struct wireless_dev *wdev = dev->ieee80211_ptr;
> struct cfg80211_ibss_params ibss;
> struct wiphy *wiphy;
> struct cfg80211_cached_keys *connkeys = NULL;
> @@ -5524,6 +5525,15 @@ static int nl80211_join_ibss(struct sk_buff *skb, struct genl_info *info)
> ibss.channel_fixed = !!info->attrs[NL80211_ATTR_FREQ_FIXED];
> ibss.privacy = !!info->attrs[NL80211_ATTR_PRIVACY];
>
> + mutex_lock(&rdev->devlist_mtx);
> + err = cfg80211_can_use_chan(rdev, wdev, ibss.chandef.chan,
> + ibss.channel_fixed ? CHAN_MODE_SHARED :
> + CHAN_MODE_EXCLUSIVE);
> + mutex_unlock(&rdev->devlist_mtx);
> +
> + if (err)
> + return -EINVAL;
> +

This is already in __cfg80211_join_ibss()

johannes