aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJohannes Berg <johannes@sipsolutions.net>2009-04-22 11:45:38 -0400
committerJohn W. Linville <linville@tuxdriver.com>2009-04-22 16:57:20 -0400
commit8e30bc55de98c000b0b836cb42525c82f605f191 (patch)
tree6b413976c2064157c3268b87921d4e2a7595f831
parente255d5eb2b478eec1416b46aea03798b64355402 (diff)
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>
-rw-r--r--include/linux/nl80211.h4
-rw-r--r--include/net/cfg80211.h2
-rw-r--r--net/wireless/ibss.c3
-rw-r--r--net/wireless/nl80211.c12
4 files changed, 19 insertions, 2 deletions
diff --git a/include/linux/nl80211.h b/include/linux/nl80211.h
index dc9d9ec5d1ae..b6a48dd502ce 100644
--- a/include/linux/nl80211.h
+++ b/include/linux/nl80211.h
@@ -230,7 +230,9 @@
230 * and optionally a MAC (as BSSID) and FREQ_FIXED attribute if those 230 * and optionally a MAC (as BSSID) and FREQ_FIXED attribute if those
231 * should be fixed rather than automatically determined. Can only be 231 * should be fixed rather than automatically determined. Can only be
232 * executed on a network interface that is UP, and fixed BSSID/FREQ 232 * executed on a network interface that is UP, and fixed BSSID/FREQ
233 * may be rejected. 233 * may be rejected. Another optional parameter is the beacon interval,
234 * given in the %NL80211_ATTR_BEACON_INTERVAL attribute, which if not
235 * given defaults to 100 TU (102.4ms).
234 * @NL80211_CMD_LEAVE_IBSS: Leave the IBSS -- no special arguments, the IBSS is 236 * @NL80211_CMD_LEAVE_IBSS: Leave the IBSS -- no special arguments, the IBSS is
235 * determined by the network interface. 237 * determined by the network interface.
236 * 238 *
diff --git a/include/net/cfg80211.h b/include/net/cfg80211.h
index 54bc69c83691..7f7b53b69cb2 100644
--- a/include/net/cfg80211.h
+++ b/include/net/cfg80211.h
@@ -733,6 +733,7 @@ struct cfg80211_disassoc_request {
733 * IBSSs to join on other channels. 733 * IBSSs to join on other channels.
734 * @ie: information element(s) to include in the beacon 734 * @ie: information element(s) to include in the beacon
735 * @ie_len: length of that 735 * @ie_len: length of that
736 * @beacon_interval: beacon interval to use
736 */ 737 */
737struct cfg80211_ibss_params { 738struct cfg80211_ibss_params {
738 u8 *ssid; 739 u8 *ssid;
@@ -740,6 +741,7 @@ struct cfg80211_ibss_params {
740 struct ieee80211_channel *channel; 741 struct ieee80211_channel *channel;
741 u8 *ie; 742 u8 *ie;
742 u8 ssid_len, ie_len; 743 u8 ssid_len, ie_len;
744 u16 beacon_interval;
743 bool channel_fixed; 745 bool channel_fixed;
744}; 746};
745 747
diff --git a/net/wireless/ibss.c b/net/wireless/ibss.c
index b5c601e1b1b7..3c38afaed28a 100644
--- a/net/wireless/ibss.c
+++ b/net/wireless/ibss.c
@@ -116,6 +116,9 @@ static int cfg80211_ibss_wext_join(struct cfg80211_registered_device *rdev,
116 enum ieee80211_band band; 116 enum ieee80211_band band;
117 int i; 117 int i;
118 118
119 if (!wdev->wext.beacon_interval)
120 wdev->wext.beacon_interval = 100;
121
119 /* try to find an IBSS channel if none requested ... */ 122 /* try to find an IBSS channel if none requested ... */
120 if (!wdev->wext.channel) { 123 if (!wdev->wext.channel) {
121 for (band = 0; band < IEEE80211_NUM_BANDS; band++) { 124 for (band = 0; band < IEEE80211_NUM_BANDS; band++) {
diff --git a/net/wireless/nl80211.c b/net/wireless/nl80211.c
index 97bb5c80125d..3b21b3e89e96 100644
--- a/net/wireless/nl80211.c
+++ b/net/wireless/nl80211.c
@@ -3159,6 +3159,8 @@ static int nl80211_join_ibss(struct sk_buff *skb, struct genl_info *info)
3159 struct wiphy *wiphy; 3159 struct wiphy *wiphy;
3160 int err; 3160 int err;
3161 3161
3162 memset(&ibss, 0, sizeof(ibss));
3163
3162 if (!is_valid_ie_attr(info->attrs[NL80211_ATTR_IE])) 3164 if (!is_valid_ie_attr(info->attrs[NL80211_ATTR_IE]))
3163 return -EINVAL; 3165 return -EINVAL;
3164 3166
@@ -3167,6 +3169,15 @@ static int nl80211_join_ibss(struct sk_buff *skb, struct genl_info *info)
3167 !nla_len(info->attrs[NL80211_ATTR_SSID])) 3169 !nla_len(info->attrs[NL80211_ATTR_SSID]))
3168 return -EINVAL; 3170 return -EINVAL;
3169 3171
3172 ibss.beacon_interval = 100;
3173
3174 if (info->attrs[NL80211_ATTR_BEACON_INTERVAL]) {
3175 ibss.beacon_interval =
3176 nla_get_u32(info->attrs[NL80211_ATTR_BEACON_INTERVAL]);
3177 if (ibss.beacon_interval < 1 || ibss.beacon_interval > 10000)
3178 return -EINVAL;
3179 }
3180
3170 rtnl_lock(); 3181 rtnl_lock();
3171 3182
3172 err = get_drv_dev_by_info_ifindex(info->attrs, &drv, &dev); 3183 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)
3189 } 3200 }
3190 3201
3191 wiphy = &drv->wiphy; 3202 wiphy = &drv->wiphy;
3192 memset(&ibss, 0, sizeof(ibss));
3193 3203
3194 if (info->attrs[NL80211_ATTR_MAC]) 3204 if (info->attrs[NL80211_ATTR_MAC])
3195 ibss.bssid = nla_data(info->attrs[NL80211_ATTR_MAC]); 3205 ibss.bssid = nla_data(info->attrs[NL80211_ATTR_MAC]);