nl80211: allow configuring IBSS beacon interval
Make the JOIN_IBSS command look at the beacon interval attribute to see if the user requested a specific beacon interval, if not default to 100 TU (wext too). Signed-off-by: Johannes Berg <johannes@sipsolutions.net> Signed-off-by: John W. Linville <linville@tuxdriver.com>
This commit is contained in:
committed by
John W. Linville
parent
e255d5eb2b
commit
8e30bc55de
@@ -230,7 +230,9 @@
|
|||||||
* and optionally a MAC (as BSSID) and FREQ_FIXED attribute if those
|
* and optionally a MAC (as BSSID) and FREQ_FIXED attribute if those
|
||||||
* should be fixed rather than automatically determined. Can only be
|
* should be fixed rather than automatically determined. Can only be
|
||||||
* executed on a network interface that is UP, and fixed BSSID/FREQ
|
* executed on a network interface that is UP, and fixed BSSID/FREQ
|
||||||
* may be rejected.
|
* may be rejected. Another optional parameter is the beacon interval,
|
||||||
|
* given in the %NL80211_ATTR_BEACON_INTERVAL attribute, which if not
|
||||||
|
* given defaults to 100 TU (102.4ms).
|
||||||
* @NL80211_CMD_LEAVE_IBSS: Leave the IBSS -- no special arguments, the IBSS is
|
* @NL80211_CMD_LEAVE_IBSS: Leave the IBSS -- no special arguments, the IBSS is
|
||||||
* determined by the network interface.
|
* determined by the network interface.
|
||||||
*
|
*
|
||||||
|
@@ -733,6 +733,7 @@ struct cfg80211_disassoc_request {
|
|||||||
* IBSSs to join on other channels.
|
* IBSSs to join on other channels.
|
||||||
* @ie: information element(s) to include in the beacon
|
* @ie: information element(s) to include in the beacon
|
||||||
* @ie_len: length of that
|
* @ie_len: length of that
|
||||||
|
* @beacon_interval: beacon interval to use
|
||||||
*/
|
*/
|
||||||
struct cfg80211_ibss_params {
|
struct cfg80211_ibss_params {
|
||||||
u8 *ssid;
|
u8 *ssid;
|
||||||
@@ -740,6 +741,7 @@ struct cfg80211_ibss_params {
|
|||||||
struct ieee80211_channel *channel;
|
struct ieee80211_channel *channel;
|
||||||
u8 *ie;
|
u8 *ie;
|
||||||
u8 ssid_len, ie_len;
|
u8 ssid_len, ie_len;
|
||||||
|
u16 beacon_interval;
|
||||||
bool channel_fixed;
|
bool channel_fixed;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@@ -116,6 +116,9 @@ static int cfg80211_ibss_wext_join(struct cfg80211_registered_device *rdev,
|
|||||||
enum ieee80211_band band;
|
enum ieee80211_band band;
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
|
if (!wdev->wext.beacon_interval)
|
||||||
|
wdev->wext.beacon_interval = 100;
|
||||||
|
|
||||||
/* try to find an IBSS channel if none requested ... */
|
/* try to find an IBSS channel if none requested ... */
|
||||||
if (!wdev->wext.channel) {
|
if (!wdev->wext.channel) {
|
||||||
for (band = 0; band < IEEE80211_NUM_BANDS; band++) {
|
for (band = 0; band < IEEE80211_NUM_BANDS; band++) {
|
||||||
|
@@ -3159,6 +3159,8 @@ static int nl80211_join_ibss(struct sk_buff *skb, struct genl_info *info)
|
|||||||
struct wiphy *wiphy;
|
struct wiphy *wiphy;
|
||||||
int err;
|
int err;
|
||||||
|
|
||||||
|
memset(&ibss, 0, sizeof(ibss));
|
||||||
|
|
||||||
if (!is_valid_ie_attr(info->attrs[NL80211_ATTR_IE]))
|
if (!is_valid_ie_attr(info->attrs[NL80211_ATTR_IE]))
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
|
|
||||||
@@ -3167,6 +3169,15 @@ static int nl80211_join_ibss(struct sk_buff *skb, struct genl_info *info)
|
|||||||
!nla_len(info->attrs[NL80211_ATTR_SSID]))
|
!nla_len(info->attrs[NL80211_ATTR_SSID]))
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
|
|
||||||
|
ibss.beacon_interval = 100;
|
||||||
|
|
||||||
|
if (info->attrs[NL80211_ATTR_BEACON_INTERVAL]) {
|
||||||
|
ibss.beacon_interval =
|
||||||
|
nla_get_u32(info->attrs[NL80211_ATTR_BEACON_INTERVAL]);
|
||||||
|
if (ibss.beacon_interval < 1 || ibss.beacon_interval > 10000)
|
||||||
|
return -EINVAL;
|
||||||
|
}
|
||||||
|
|
||||||
rtnl_lock();
|
rtnl_lock();
|
||||||
|
|
||||||
err = get_drv_dev_by_info_ifindex(info->attrs, &drv, &dev);
|
err = get_drv_dev_by_info_ifindex(info->attrs, &drv, &dev);
|
||||||
@@ -3189,7 +3200,6 @@ static int nl80211_join_ibss(struct sk_buff *skb, struct genl_info *info)
|
|||||||
}
|
}
|
||||||
|
|
||||||
wiphy = &drv->wiphy;
|
wiphy = &drv->wiphy;
|
||||||
memset(&ibss, 0, sizeof(ibss));
|
|
||||||
|
|
||||||
if (info->attrs[NL80211_ATTR_MAC])
|
if (info->attrs[NL80211_ATTR_MAC])
|
||||||
ibss.bssid = nla_data(info->attrs[NL80211_ATTR_MAC]);
|
ibss.bssid = nla_data(info->attrs[NL80211_ATTR_MAC]);
|
||||||
|
Reference in New Issue
Block a user