Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 314825
b: refs/heads/master
c: 46c1dd0
h: refs/heads/master
i:
  314823: a3a2dc9
v: v3
  • Loading branch information
Felix Fietkau authored and Johannes Berg committed Jun 20, 2012
1 parent 78e86ef commit 163e961
Show file tree
Hide file tree
Showing 2 changed files with 33 additions and 3 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 2bd7e35da011f51d4fdb3b71f888c3a50194bfcd
refs/heads/master: 46c1dd0c7fac54d3739d62b6362024d9b568c6de
34 changes: 32 additions & 2 deletions trunk/net/wireless/nl80211.c
Original file line number Diff line number Diff line change
Expand Up @@ -2335,6 +2335,33 @@ static int nl80211_parse_beacon(struct genl_info *info,
return 0;
}

static bool nl80211_get_ap_channel(struct cfg80211_registered_device *rdev,
struct cfg80211_ap_settings *params)
{
struct wireless_dev *wdev;
bool ret = false;

mutex_lock(&rdev->devlist_mtx);

list_for_each_entry(wdev, &rdev->netdev_list, list) {
if (wdev->iftype != NL80211_IFTYPE_AP &&
wdev->iftype != NL80211_IFTYPE_P2P_GO)
continue;

if (!wdev->preset_chan)
continue;

params->channel = wdev->preset_chan;
params->channel_type = wdev->preset_chantype;
ret = true;
break;
}

mutex_unlock(&rdev->devlist_mtx);

return ret;
}

static int nl80211_start_ap(struct sk_buff *skb, struct genl_info *info)
{
struct cfg80211_registered_device *rdev = info->user_ptr[0];
Expand Down Expand Up @@ -2437,16 +2464,19 @@ static int nl80211_start_ap(struct sk_buff *skb, struct genl_info *info)
} else if (wdev->preset_chan) {
params.channel = wdev->preset_chan;
params.channel_type = wdev->preset_chantype;
} else
} else if (!nl80211_get_ap_channel(rdev, &params))
return -EINVAL;

if (!cfg80211_can_beacon_sec_chan(&rdev->wiphy, params.channel,
params.channel_type))
return -EINVAL;

err = rdev->ops->start_ap(&rdev->wiphy, dev, &params);
if (!err)
if (!err) {
wdev->preset_chan = params.channel;
wdev->preset_chantype = params.channel_type;
wdev->beacon_interval = params.beacon_interval;
}
return err;
}

Expand Down

0 comments on commit 163e961

Please sign in to comment.