aboutsummaryrefslogtreecommitdiffstats
path: root/net/wireless/ibss.c
diff options
context:
space:
mode:
authorJohannes Berg <johannes@sipsolutions.net>2009-05-09 14:09:03 -0400
committerJohn W. Linville <linville@tuxdriver.com>2009-05-11 15:24:07 -0400
commitcbe8fa9c5e88fd5f554ebc519af3b0ed17dde0dd (patch)
tree0ec44646879e49f7254ba15970ca9a168bc00d8f /net/wireless/ibss.c
parent4e943900fb9675d3a5ebdabc2cd4a9a54edace97 (diff)
cfg80211: put wext data into substructure
To make it more apparent in the code what is for wext only (and needs to be #ifdef'ed) put all the info for wext into a substruct in each wireless_dev. Signed-off-by: Johannes Berg <johannes@sipsolutions.net> Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'net/wireless/ibss.c')
-rw-r--r--net/wireless/ibss.c60
1 files changed, 30 insertions, 30 deletions
diff --git a/net/wireless/ibss.c b/net/wireless/ibss.c
index 3c38afaed28a..a4a1c3498ff2 100644
--- a/net/wireless/ibss.c
+++ b/net/wireless/ibss.c
@@ -63,7 +63,7 @@ int cfg80211_join_ibss(struct cfg80211_registered_device *rdev,
63 return -EALREADY; 63 return -EALREADY;
64 64
65#ifdef CONFIG_WIRELESS_EXT 65#ifdef CONFIG_WIRELESS_EXT
66 wdev->wext.channel = params->channel; 66 wdev->wext.ibss.channel = params->channel;
67#endif 67#endif
68 err = rdev->ops->join_ibss(&rdev->wiphy, dev, params); 68 err = rdev->ops->join_ibss(&rdev->wiphy, dev, params);
69 69
@@ -90,7 +90,7 @@ void cfg80211_clear_ibss(struct net_device *dev, bool nowext)
90 memset(wdev->bssid, 0, ETH_ALEN); 90 memset(wdev->bssid, 0, ETH_ALEN);
91#ifdef CONFIG_WIRELESS_EXT 91#ifdef CONFIG_WIRELESS_EXT
92 if (!nowext) 92 if (!nowext)
93 wdev->wext.ssid_len = 0; 93 wdev->wext.ibss.ssid_len = 0;
94#endif 94#endif
95} 95}
96 96
@@ -116,11 +116,11 @@ 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) 119 if (!wdev->wext.ibss.beacon_interval)
120 wdev->wext.beacon_interval = 100; 120 wdev->wext.ibss.beacon_interval = 100;
121 121
122 /* try to find an IBSS channel if none requested ... */ 122 /* try to find an IBSS channel if none requested ... */
123 if (!wdev->wext.channel) { 123 if (!wdev->wext.ibss.channel) {
124 for (band = 0; band < IEEE80211_NUM_BANDS; band++) { 124 for (band = 0; band < IEEE80211_NUM_BANDS; band++) {
125 struct ieee80211_supported_band *sband; 125 struct ieee80211_supported_band *sband;
126 struct ieee80211_channel *chan; 126 struct ieee80211_channel *chan;
@@ -135,27 +135,27 @@ static int cfg80211_ibss_wext_join(struct cfg80211_registered_device *rdev,
135 continue; 135 continue;
136 if (chan->flags & IEEE80211_CHAN_DISABLED) 136 if (chan->flags & IEEE80211_CHAN_DISABLED)
137 continue; 137 continue;
138 wdev->wext.channel = chan; 138 wdev->wext.ibss.channel = chan;
139 break; 139 break;
140 } 140 }
141 141
142 if (wdev->wext.channel) 142 if (wdev->wext.ibss.channel)
143 break; 143 break;
144 } 144 }
145 145
146 if (!wdev->wext.channel) 146 if (!wdev->wext.ibss.channel)
147 return -EINVAL; 147 return -EINVAL;
148 } 148 }
149 149
150 /* don't join -- SSID is not there */ 150 /* don't join -- SSID is not there */
151 if (!wdev->wext.ssid_len) 151 if (!wdev->wext.ibss.ssid_len)
152 return 0; 152 return 0;
153 153
154 if (!netif_running(wdev->netdev)) 154 if (!netif_running(wdev->netdev))
155 return 0; 155 return 0;
156 156
157 return cfg80211_join_ibss(wiphy_to_dev(wdev->wiphy), 157 return cfg80211_join_ibss(wiphy_to_dev(wdev->wiphy),
158 wdev->netdev, &wdev->wext); 158 wdev->netdev, &wdev->wext.ibss);
159} 159}
160 160
161int cfg80211_ibss_wext_siwfreq(struct net_device *dev, 161int cfg80211_ibss_wext_siwfreq(struct net_device *dev,
@@ -182,7 +182,7 @@ int cfg80211_ibss_wext_siwfreq(struct net_device *dev,
182 chan->flags & IEEE80211_CHAN_DISABLED)) 182 chan->flags & IEEE80211_CHAN_DISABLED))
183 return -EINVAL; 183 return -EINVAL;
184 184
185 if (wdev->wext.channel == chan) 185 if (wdev->wext.ibss.channel == chan)
186 return 0; 186 return 0;
187 187
188 if (wdev->ssid_len) { 188 if (wdev->ssid_len) {
@@ -193,11 +193,11 @@ int cfg80211_ibss_wext_siwfreq(struct net_device *dev,
193 } 193 }
194 194
195 if (chan) { 195 if (chan) {
196 wdev->wext.channel = chan; 196 wdev->wext.ibss.channel = chan;
197 wdev->wext.channel_fixed = true; 197 wdev->wext.ibss.channel_fixed = true;
198 } else { 198 } else {
199 /* cfg80211_ibss_wext_join will pick one if needed */ 199 /* cfg80211_ibss_wext_join will pick one if needed */
200 wdev->wext.channel_fixed = false; 200 wdev->wext.ibss.channel_fixed = false;
201 } 201 }
202 202
203 return cfg80211_ibss_wext_join(wiphy_to_dev(wdev->wiphy), wdev); 203 return cfg80211_ibss_wext_join(wiphy_to_dev(wdev->wiphy), wdev);
@@ -218,8 +218,8 @@ int cfg80211_ibss_wext_giwfreq(struct net_device *dev,
218 218
219 if (wdev->current_bss) 219 if (wdev->current_bss)
220 chan = wdev->current_bss->channel; 220 chan = wdev->current_bss->channel;
221 else if (wdev->wext.channel) 221 else if (wdev->wext.ibss.channel)
222 chan = wdev->wext.channel; 222 chan = wdev->wext.ibss.channel;
223 223
224 if (chan) { 224 if (chan) {
225 freq->m = chan->center_freq; 225 freq->m = chan->center_freq;
@@ -259,9 +259,9 @@ int cfg80211_ibss_wext_siwessid(struct net_device *dev,
259 if (len > 0 && ssid[len - 1] == '\0') 259 if (len > 0 && ssid[len - 1] == '\0')
260 len--; 260 len--;
261 261
262 wdev->wext.ssid = wdev->ssid; 262 wdev->wext.ibss.ssid = wdev->ssid;
263 memcpy(wdev->wext.ssid, ssid, len); 263 memcpy(wdev->wext.ibss.ssid, ssid, len);
264 wdev->wext.ssid_len = len; 264 wdev->wext.ibss.ssid_len = len;
265 265
266 return cfg80211_ibss_wext_join(wiphy_to_dev(wdev->wiphy), wdev); 266 return cfg80211_ibss_wext_join(wiphy_to_dev(wdev->wiphy), wdev);
267} 267}
@@ -284,10 +284,10 @@ int cfg80211_ibss_wext_giwessid(struct net_device *dev,
284 data->flags = 1; 284 data->flags = 1;
285 data->length = wdev->ssid_len; 285 data->length = wdev->ssid_len;
286 memcpy(ssid, wdev->ssid, data->length); 286 memcpy(ssid, wdev->ssid, data->length);
287 } else if (wdev->wext.ssid && wdev->wext.ssid_len) { 287 } else if (wdev->wext.ibss.ssid && wdev->wext.ibss.ssid_len) {
288 data->flags = 1; 288 data->flags = 1;
289 data->length = wdev->wext.ssid_len; 289 data->length = wdev->wext.ibss.ssid_len;
290 memcpy(ssid, wdev->wext.ssid, data->length); 290 memcpy(ssid, wdev->wext.ibss.ssid, data->length);
291 } 291 }
292 292
293 return 0; 293 return 0;
@@ -318,12 +318,12 @@ int cfg80211_ibss_wext_siwap(struct net_device *dev,
318 bssid = NULL; 318 bssid = NULL;
319 319
320 /* both automatic */ 320 /* both automatic */
321 if (!bssid && !wdev->wext.bssid) 321 if (!bssid && !wdev->wext.ibss.bssid)
322 return 0; 322 return 0;
323 323
324 /* fixed already - and no change */ 324 /* fixed already - and no change */
325 if (wdev->wext.bssid && bssid && 325 if (wdev->wext.ibss.bssid && bssid &&
326 compare_ether_addr(bssid, wdev->wext.bssid) == 0) 326 compare_ether_addr(bssid, wdev->wext.ibss.bssid) == 0)
327 return 0; 327 return 0;
328 328
329 if (wdev->ssid_len) { 329 if (wdev->ssid_len) {
@@ -334,10 +334,10 @@ int cfg80211_ibss_wext_siwap(struct net_device *dev,
334 } 334 }
335 335
336 if (bssid) { 336 if (bssid) {
337 memcpy(wdev->wext_bssid, bssid, ETH_ALEN); 337 memcpy(wdev->wext.bssid, bssid, ETH_ALEN);
338 wdev->wext.bssid = wdev->wext_bssid; 338 wdev->wext.ibss.bssid = wdev->wext.bssid;
339 } else 339 } else
340 wdev->wext.bssid = NULL; 340 wdev->wext.ibss.bssid = NULL;
341 341
342 return cfg80211_ibss_wext_join(wiphy_to_dev(wdev->wiphy), wdev); 342 return cfg80211_ibss_wext_join(wiphy_to_dev(wdev->wiphy), wdev);
343} 343}
@@ -356,8 +356,8 @@ int cfg80211_ibss_wext_giwap(struct net_device *dev,
356 356
357 ap_addr->sa_family = ARPHRD_ETHER; 357 ap_addr->sa_family = ARPHRD_ETHER;
358 358
359 if (wdev->wext.bssid) { 359 if (wdev->wext.ibss.bssid) {
360 memcpy(ap_addr->sa_data, wdev->wext.bssid, ETH_ALEN); 360 memcpy(ap_addr->sa_data, wdev->wext.ibss.bssid, ETH_ALEN);
361 return 0; 361 return 0;
362 } 362 }
363 363