aboutsummaryrefslogtreecommitdiffstats
path: root/net/ieee80211/softmac
diff options
context:
space:
mode:
Diffstat (limited to 'net/ieee80211/softmac')
-rw-r--r--net/ieee80211/softmac/ieee80211softmac_assoc.c20
-rw-r--r--net/ieee80211/softmac/ieee80211softmac_auth.c78
-rw-r--r--net/ieee80211/softmac/ieee80211softmac_event.c12
-rw-r--r--net/ieee80211/softmac/ieee80211softmac_io.c64
-rw-r--r--net/ieee80211/softmac/ieee80211softmac_module.c48
-rw-r--r--net/ieee80211/softmac/ieee80211softmac_priv.h12
-rw-r--r--net/ieee80211/softmac/ieee80211softmac_scan.c14
-rw-r--r--net/ieee80211/softmac/ieee80211softmac_wx.c18
8 files changed, 133 insertions, 133 deletions
diff --git a/net/ieee80211/softmac/ieee80211softmac_assoc.c b/net/ieee80211/softmac/ieee80211softmac_assoc.c
index a824852909e4..cc8110bdd579 100644
--- a/net/ieee80211/softmac/ieee80211softmac_assoc.c
+++ b/net/ieee80211/softmac/ieee80211softmac_assoc.c
@@ -30,7 +30,7 @@
30 * Overview 30 * Overview
31 * 31 *
32 * Before you can associate, you have to authenticate. 32 * Before you can associate, you have to authenticate.
33 * 33 *
34 */ 34 */
35 35
36/* Sends out an association request to the desired AP */ 36/* Sends out an association request to the desired AP */
@@ -41,10 +41,10 @@ ieee80211softmac_assoc(struct ieee80211softmac_device *mac, struct ieee80211soft
41 41
42 /* Switch to correct channel for this network */ 42 /* Switch to correct channel for this network */
43 mac->set_channel(mac->dev, net->channel); 43 mac->set_channel(mac->dev, net->channel);
44 44
45 /* Send association request */ 45 /* Send association request */
46 ieee80211softmac_send_mgt_frame(mac, net, IEEE80211_STYPE_ASSOC_REQ, 0); 46 ieee80211softmac_send_mgt_frame(mac, net, IEEE80211_STYPE_ASSOC_REQ, 0);
47 47
48 dprintk(KERN_INFO PFX "sent association request!\n"); 48 dprintk(KERN_INFO PFX "sent association request!\n");
49 49
50 spin_lock_irqsave(&mac->lock, flags); 50 spin_lock_irqsave(&mac->lock, flags);
@@ -153,7 +153,7 @@ network_matches_request(struct ieee80211softmac_device *mac, struct ieee80211_ne
153 } 153 }
154 154
155 /* if 'ANY' network requested, take any that doesn't have privacy enabled */ 155 /* if 'ANY' network requested, take any that doesn't have privacy enabled */
156 if (mac->associnfo.req_essid.len == 0 156 if (mac->associnfo.req_essid.len == 0
157 && !(net->capability & WLAN_CAPABILITY_PRIVACY)) 157 && !(net->capability & WLAN_CAPABILITY_PRIVACY))
158 return 1; 158 return 1;
159 if (net->ssid_len != mac->associnfo.req_essid.len) 159 if (net->ssid_len != mac->associnfo.req_essid.len)
@@ -212,8 +212,8 @@ ieee80211softmac_assoc_work(struct work_struct *work)
212 212
213 /* try to find the requested network in our list, if we found one already */ 213 /* try to find the requested network in our list, if we found one already */
214 if (bssvalid || mac->associnfo.bssfixed) 214 if (bssvalid || mac->associnfo.bssfixed)
215 found = ieee80211softmac_get_network_by_bssid(mac, mac->associnfo.bssid); 215 found = ieee80211softmac_get_network_by_bssid(mac, mac->associnfo.bssid);
216 216
217 /* Search the ieee80211 networks for this network if we didn't find it by bssid, 217 /* Search the ieee80211 networks for this network if we didn't find it by bssid,
218 * but only if we've scanned at least once (to get a better list of networks to 218 * but only if we've scanned at least once (to get a better list of networks to
219 * select from). If we have not scanned before, the !found logic below will be 219 * select from). If we have not scanned before, the !found logic below will be
@@ -265,7 +265,7 @@ ieee80211softmac_assoc_work(struct work_struct *work)
265 if (mac->associnfo.scan_retry > 0) { 265 if (mac->associnfo.scan_retry > 0) {
266 mac->associnfo.scan_retry--; 266 mac->associnfo.scan_retry--;
267 267
268 /* We know of no such network. Let's scan. 268 /* We know of no such network. Let's scan.
269 * NB: this also happens if we had no memory to copy the network info... 269 * NB: this also happens if we had no memory to copy the network info...
270 * Maybe we can hope to have more memory after scanning finishes ;) 270 * Maybe we can hope to have more memory after scanning finishes ;)
271 */ 271 */
@@ -353,7 +353,7 @@ ieee80211softmac_associated(struct ieee80211softmac_device *mac,
353 mac->set_bssid_filter(mac->dev, net->bssid); 353 mac->set_bssid_filter(mac->dev, net->bssid);
354 memcpy(mac->ieee->bssid, net->bssid, ETH_ALEN); 354 memcpy(mac->ieee->bssid, net->bssid, ETH_ALEN);
355 netif_carrier_on(mac->dev); 355 netif_carrier_on(mac->dev);
356 356
357 mac->association_id = le16_to_cpup(&resp->aid); 357 mac->association_id = le16_to_cpup(&resp->aid);
358} 358}
359 359
@@ -374,7 +374,7 @@ ieee80211softmac_handle_assoc_response(struct net_device * dev,
374 374
375 if (unlikely(!mac->running)) 375 if (unlikely(!mac->running))
376 return -ENODEV; 376 return -ENODEV;
377 377
378 spin_lock_irqsave(&mac->lock, flags); 378 spin_lock_irqsave(&mac->lock, flags);
379 379
380 if (!mac->associnfo.associating) { 380 if (!mac->associnfo.associating) {
@@ -426,7 +426,7 @@ ieee80211softmac_handle_assoc_response(struct net_device * dev,
426 mac->associnfo.associated = 0; 426 mac->associnfo.associated = 0;
427 ieee80211softmac_call_events_locked(mac, IEEE80211SOFTMAC_EVENT_ASSOCIATE_FAILED, network); 427 ieee80211softmac_call_events_locked(mac, IEEE80211SOFTMAC_EVENT_ASSOCIATE_FAILED, network);
428 } 428 }
429 429
430 spin_unlock_irqrestore(&mac->lock, flags); 430 spin_unlock_irqrestore(&mac->lock, flags);
431 return 0; 431 return 0;
432} 432}
diff --git a/net/ieee80211/softmac/ieee80211softmac_auth.c b/net/ieee80211/softmac/ieee80211softmac_auth.c
index 8ed3e59b8024..826c32d24461 100644
--- a/net/ieee80211/softmac/ieee80211softmac_auth.c
+++ b/net/ieee80211/softmac/ieee80211softmac_auth.c
@@ -30,12 +30,12 @@ static void ieee80211softmac_auth_queue(struct work_struct *work);
30 30
31/* Queues an auth request to the desired AP */ 31/* Queues an auth request to the desired AP */
32int 32int
33ieee80211softmac_auth_req(struct ieee80211softmac_device *mac, 33ieee80211softmac_auth_req(struct ieee80211softmac_device *mac,
34 struct ieee80211softmac_network *net) 34 struct ieee80211softmac_network *net)
35{ 35{
36 struct ieee80211softmac_auth_queue_item *auth; 36 struct ieee80211softmac_auth_queue_item *auth;
37 unsigned long flags; 37 unsigned long flags;
38 38
39 if (net->authenticating || net->authenticated) 39 if (net->authenticating || net->authenticated)
40 return 0; 40 return 0;
41 net->authenticating = 1; 41 net->authenticating = 1;
@@ -55,7 +55,7 @@ ieee80211softmac_auth_req(struct ieee80211softmac_device *mac,
55 auth->retry = IEEE80211SOFTMAC_AUTH_RETRY_LIMIT; 55 auth->retry = IEEE80211SOFTMAC_AUTH_RETRY_LIMIT;
56 auth->state = IEEE80211SOFTMAC_AUTH_OPEN_REQUEST; 56 auth->state = IEEE80211SOFTMAC_AUTH_OPEN_REQUEST;
57 INIT_DELAYED_WORK(&auth->work, ieee80211softmac_auth_queue); 57 INIT_DELAYED_WORK(&auth->work, ieee80211softmac_auth_queue);
58 58
59 /* Lock (for list) */ 59 /* Lock (for list) */
60 spin_lock_irqsave(&mac->lock, flags); 60 spin_lock_irqsave(&mac->lock, flags);
61 61
@@ -63,7 +63,7 @@ ieee80211softmac_auth_req(struct ieee80211softmac_device *mac,
63 list_add_tail(&auth->list, &mac->auth_queue); 63 list_add_tail(&auth->list, &mac->auth_queue);
64 schedule_delayed_work(&auth->work, 0); 64 schedule_delayed_work(&auth->work, 0);
65 spin_unlock_irqrestore(&mac->lock, flags); 65 spin_unlock_irqrestore(&mac->lock, flags);
66 66
67 return 0; 67 return 0;
68} 68}
69 69
@@ -85,7 +85,7 @@ ieee80211softmac_auth_queue(struct work_struct *work)
85 if(auth->retry > 0) { 85 if(auth->retry > 0) {
86 /* Switch to correct channel for this network */ 86 /* Switch to correct channel for this network */
87 mac->set_channel(mac->dev, net->channel); 87 mac->set_channel(mac->dev, net->channel);
88 88
89 /* Lock and set flags */ 89 /* Lock and set flags */
90 spin_lock_irqsave(&mac->lock, flags); 90 spin_lock_irqsave(&mac->lock, flags);
91 if (unlikely(!mac->running)) { 91 if (unlikely(!mac->running)) {
@@ -130,11 +130,11 @@ ieee80211softmac_auth_challenge_response(struct work_struct *work)
130} 130}
131 131
132/* Handle the auth response from the AP 132/* Handle the auth response from the AP
133 * This should be registered with ieee80211 as handle_auth 133 * This should be registered with ieee80211 as handle_auth
134 */ 134 */
135int 135int
136ieee80211softmac_auth_resp(struct net_device *dev, struct ieee80211_auth *auth) 136ieee80211softmac_auth_resp(struct net_device *dev, struct ieee80211_auth *auth)
137{ 137{
138 138
139 struct list_head *list_ptr; 139 struct list_head *list_ptr;
140 struct ieee80211softmac_device *mac = ieee80211_priv(dev); 140 struct ieee80211softmac_device *mac = ieee80211_priv(dev);
@@ -142,7 +142,7 @@ ieee80211softmac_auth_resp(struct net_device *dev, struct ieee80211_auth *auth)
142 struct ieee80211softmac_network *net = NULL; 142 struct ieee80211softmac_network *net = NULL;
143 unsigned long flags; 143 unsigned long flags;
144 u8 * data; 144 u8 * data;
145 145
146 if (unlikely(!mac->running)) 146 if (unlikely(!mac->running))
147 return -ENODEV; 147 return -ENODEV;
148 148
@@ -157,15 +157,15 @@ ieee80211softmac_auth_resp(struct net_device *dev, struct ieee80211_auth *auth)
157 aq = NULL; 157 aq = NULL;
158 } 158 }
159 spin_unlock_irqrestore(&mac->lock, flags); 159 spin_unlock_irqrestore(&mac->lock, flags);
160 160
161 /* Make sure that we've got an auth queue item for this request */ 161 /* Make sure that we've got an auth queue item for this request */
162 if(aq == NULL) 162 if(aq == NULL)
163 { 163 {
164 dprintkl(KERN_DEBUG PFX "Authentication response received from "MAC_FMT" but no queue item exists.\n", MAC_ARG(auth->header.addr2)); 164 dprintkl(KERN_DEBUG PFX "Authentication response received from "MAC_FMT" but no queue item exists.\n", MAC_ARG(auth->header.addr2));
165 /* Error #? */ 165 /* Error #? */
166 return -1; 166 return -1;
167 } 167 }
168 168
169 /* Check for out of order authentication */ 169 /* Check for out of order authentication */
170 if(!net->authenticating) 170 if(!net->authenticating)
171 { 171 {
@@ -182,10 +182,10 @@ ieee80211softmac_auth_resp(struct net_device *dev, struct ieee80211_auth *auth)
182 case WLAN_STATUS_SUCCESS: 182 case WLAN_STATUS_SUCCESS:
183 /* Update the status to Authenticated */ 183 /* Update the status to Authenticated */
184 spin_lock_irqsave(&mac->lock, flags); 184 spin_lock_irqsave(&mac->lock, flags);
185 net->authenticating = 0; 185 net->authenticating = 0;
186 net->authenticated = 1; 186 net->authenticated = 1;
187 spin_unlock_irqrestore(&mac->lock, flags); 187 spin_unlock_irqrestore(&mac->lock, flags);
188 188
189 /* Send event */ 189 /* Send event */
190 printkl(KERN_NOTICE PFX "Open Authentication completed with "MAC_FMT"\n", MAC_ARG(net->bssid)); 190 printkl(KERN_NOTICE PFX "Open Authentication completed with "MAC_FMT"\n", MAC_ARG(net->bssid));
191 ieee80211softmac_call_events(mac, IEEE80211SOFTMAC_EVENT_AUTHENTICATED, net); 191 ieee80211softmac_call_events(mac, IEEE80211SOFTMAC_EVENT_AUTHENTICATED, net);
@@ -196,8 +196,8 @@ ieee80211softmac_auth_resp(struct net_device *dev, struct ieee80211_auth *auth)
196 net->authenticated = 0; 196 net->authenticated = 0;
197 net->authenticating = 0; 197 net->authenticating = 0;
198 spin_unlock_irqrestore(&mac->lock, flags); 198 spin_unlock_irqrestore(&mac->lock, flags);
199 199
200 printkl(KERN_NOTICE PFX "Open Authentication with "MAC_FMT" failed, error code: %i\n", 200 printkl(KERN_NOTICE PFX "Open Authentication with "MAC_FMT" failed, error code: %i\n",
201 MAC_ARG(net->bssid), le16_to_cpup(&auth->status)); 201 MAC_ARG(net->bssid), le16_to_cpup(&auth->status));
202 /* Count the error? */ 202 /* Count the error? */
203 break; 203 break;
@@ -212,11 +212,11 @@ ieee80211softmac_auth_resp(struct net_device *dev, struct ieee80211_auth *auth)
212 data = (u8 *)auth->info_element; 212 data = (u8 *)auth->info_element;
213 if (*data++ != MFIE_TYPE_CHALLENGE) { 213 if (*data++ != MFIE_TYPE_CHALLENGE) {
214 printkl(KERN_NOTICE PFX "Shared Key Authentication failed due to a missing challenge.\n"); 214 printkl(KERN_NOTICE PFX "Shared Key Authentication failed due to a missing challenge.\n");
215 break; 215 break;
216 } 216 }
217 /* Save the challenge */ 217 /* Save the challenge */
218 spin_lock_irqsave(&mac->lock, flags); 218 spin_lock_irqsave(&mac->lock, flags);
219 net->challenge_len = *data++; 219 net->challenge_len = *data++;
220 if (net->challenge_len > WLAN_AUTH_CHALLENGE_LEN) 220 if (net->challenge_len > WLAN_AUTH_CHALLENGE_LEN)
221 net->challenge_len = WLAN_AUTH_CHALLENGE_LEN; 221 net->challenge_len = WLAN_AUTH_CHALLENGE_LEN;
222 kfree(net->challenge); 222 kfree(net->challenge);
@@ -229,7 +229,7 @@ ieee80211softmac_auth_resp(struct net_device *dev, struct ieee80211_auth *auth)
229 spin_unlock_irqrestore(&mac->lock, flags); 229 spin_unlock_irqrestore(&mac->lock, flags);
230 break; 230 break;
231 } 231 }
232 aq->state = IEEE80211SOFTMAC_AUTH_SHARED_RESPONSE; 232 aq->state = IEEE80211SOFTMAC_AUTH_SHARED_RESPONSE;
233 233
234 /* We reuse the work struct from the auth request here. 234 /* We reuse the work struct from the auth request here.
235 * It is safe to do so as each one is per-request, and 235 * It is safe to do so as each one is per-request, and
@@ -248,22 +248,22 @@ ieee80211softmac_auth_resp(struct net_device *dev, struct ieee80211_auth *auth)
248 /* Check the status code of the response */ 248 /* Check the status code of the response */
249 switch(auth->status) { 249 switch(auth->status) {
250 case WLAN_STATUS_SUCCESS: 250 case WLAN_STATUS_SUCCESS:
251 /* Update the status to Authenticated */ 251 /* Update the status to Authenticated */
252 spin_lock_irqsave(&mac->lock, flags); 252 spin_lock_irqsave(&mac->lock, flags);
253 net->authenticating = 0; 253 net->authenticating = 0;
254 net->authenticated = 1; 254 net->authenticated = 1;
255 spin_unlock_irqrestore(&mac->lock, flags); 255 spin_unlock_irqrestore(&mac->lock, flags);
256 printkl(KERN_NOTICE PFX "Shared Key Authentication completed with "MAC_FMT"\n", 256 printkl(KERN_NOTICE PFX "Shared Key Authentication completed with "MAC_FMT"\n",
257 MAC_ARG(net->bssid)); 257 MAC_ARG(net->bssid));
258 ieee80211softmac_call_events(mac, IEEE80211SOFTMAC_EVENT_AUTHENTICATED, net); 258 ieee80211softmac_call_events(mac, IEEE80211SOFTMAC_EVENT_AUTHENTICATED, net);
259 break; 259 break;
260 default: 260 default:
261 printkl(KERN_NOTICE PFX "Shared Key Authentication with "MAC_FMT" failed, error code: %i\n", 261 printkl(KERN_NOTICE PFX "Shared Key Authentication with "MAC_FMT" failed, error code: %i\n",
262 MAC_ARG(net->bssid), le16_to_cpup(&auth->status)); 262 MAC_ARG(net->bssid), le16_to_cpup(&auth->status));
263 /* Lock and reset flags */ 263 /* Lock and reset flags */
264 spin_lock_irqsave(&mac->lock, flags); 264 spin_lock_irqsave(&mac->lock, flags);
265 net->authenticating = 0; 265 net->authenticating = 0;
266 net->authenticated = 0; 266 net->authenticated = 0;
267 spin_unlock_irqrestore(&mac->lock, flags); 267 spin_unlock_irqrestore(&mac->lock, flags);
268 /* Count the error? */ 268 /* Count the error? */
269 break; 269 break;
@@ -277,7 +277,7 @@ ieee80211softmac_auth_resp(struct net_device *dev, struct ieee80211_auth *auth)
277 goto free_aq; 277 goto free_aq;
278 break; 278 break;
279 default: 279 default:
280 /* ERROR */ 280 /* ERROR */
281 goto free_aq; 281 goto free_aq;
282 break; 282 break;
283 } 283 }
@@ -313,7 +313,7 @@ ieee80211softmac_deauth_from_net(struct ieee80211softmac_device *mac,
313 spin_lock_irqsave(&mac->lock, flags); 313 spin_lock_irqsave(&mac->lock, flags);
314 net->authenticating = 0; 314 net->authenticating = 0;
315 net->authenticated = 0; 315 net->authenticated = 0;
316 316
317 /* Find correct auth queue item, if it exists */ 317 /* Find correct auth queue item, if it exists */
318 list_for_each(list_ptr, &mac->auth_queue) { 318 list_for_each(list_ptr, &mac->auth_queue) {
319 aq = list_entry(list_ptr, struct ieee80211softmac_auth_queue_item, list); 319 aq = list_entry(list_ptr, struct ieee80211softmac_auth_queue_item, list);
@@ -322,7 +322,7 @@ ieee80211softmac_deauth_from_net(struct ieee80211softmac_device *mac,
322 else 322 else
323 aq = NULL; 323 aq = NULL;
324 } 324 }
325 325
326 /* Cancel pending work */ 326 /* Cancel pending work */
327 if(aq != NULL) 327 if(aq != NULL)
328 /* Not entirely safe? What about running work? */ 328 /* Not entirely safe? What about running work? */
@@ -333,7 +333,7 @@ ieee80211softmac_deauth_from_net(struct ieee80211softmac_device *mac,
333 if(net->challenge != NULL) 333 if(net->challenge != NULL)
334 kfree(net->challenge); 334 kfree(net->challenge);
335 kfree(net); 335 kfree(net);
336 336
337 /* can't transmit data right now... */ 337 /* can't transmit data right now... */
338 netif_carrier_off(mac->dev); 338 netif_carrier_off(mac->dev);
339 spin_unlock_irqrestore(&mac->lock, flags); 339 spin_unlock_irqrestore(&mac->lock, flags);
@@ -341,15 +341,15 @@ ieee80211softmac_deauth_from_net(struct ieee80211softmac_device *mac,
341 ieee80211softmac_try_reassoc(mac); 341 ieee80211softmac_try_reassoc(mac);
342} 342}
343 343
344/* 344/*
345 * Sends a deauth request to the desired AP 345 * Sends a deauth request to the desired AP
346 */ 346 */
347int 347int
348ieee80211softmac_deauth_req(struct ieee80211softmac_device *mac, 348ieee80211softmac_deauth_req(struct ieee80211softmac_device *mac,
349 struct ieee80211softmac_network *net, int reason) 349 struct ieee80211softmac_network *net, int reason)
350{ 350{
351 int ret; 351 int ret;
352 352
353 /* Make sure the network is authenticated */ 353 /* Make sure the network is authenticated */
354 if (!net->authenticated) 354 if (!net->authenticated)
355 { 355 {
@@ -357,25 +357,25 @@ ieee80211softmac_deauth_req(struct ieee80211softmac_device *mac,
357 /* Error okay? */ 357 /* Error okay? */
358 return -EPERM; 358 return -EPERM;
359 } 359 }
360 360
361 /* Send the de-auth packet */ 361 /* Send the de-auth packet */
362 if((ret = ieee80211softmac_send_mgt_frame(mac, net, IEEE80211_STYPE_DEAUTH, reason))) 362 if((ret = ieee80211softmac_send_mgt_frame(mac, net, IEEE80211_STYPE_DEAUTH, reason)))
363 return ret; 363 return ret;
364 364
365 ieee80211softmac_deauth_from_net(mac, net); 365 ieee80211softmac_deauth_from_net(mac, net);
366 return 0; 366 return 0;
367} 367}
368 368
369/* 369/*
370 * This should be registered with ieee80211 as handle_deauth 370 * This should be registered with ieee80211 as handle_deauth
371 */ 371 */
372int 372int
373ieee80211softmac_deauth_resp(struct net_device *dev, struct ieee80211_deauth *deauth) 373ieee80211softmac_deauth_resp(struct net_device *dev, struct ieee80211_deauth *deauth)
374{ 374{
375 375
376 struct ieee80211softmac_network *net = NULL; 376 struct ieee80211softmac_network *net = NULL;
377 struct ieee80211softmac_device *mac = ieee80211_priv(dev); 377 struct ieee80211softmac_device *mac = ieee80211_priv(dev);
378 378
379 if (unlikely(!mac->running)) 379 if (unlikely(!mac->running))
380 return -ENODEV; 380 return -ENODEV;
381 381
@@ -385,7 +385,7 @@ ieee80211softmac_deauth_resp(struct net_device *dev, struct ieee80211_deauth *de
385 } 385 }
386 386
387 net = ieee80211softmac_get_network_by_bssid(mac, deauth->header.addr2); 387 net = ieee80211softmac_get_network_by_bssid(mac, deauth->header.addr2);
388 388
389 if (net == NULL) { 389 if (net == NULL) {
390 dprintkl(KERN_DEBUG PFX "Received deauthentication packet from "MAC_FMT", but that network is unknown.\n", 390 dprintkl(KERN_DEBUG PFX "Received deauthentication packet from "MAC_FMT", but that network is unknown.\n",
391 MAC_ARG(deauth->header.addr2)); 391 MAC_ARG(deauth->header.addr2));
diff --git a/net/ieee80211/softmac/ieee80211softmac_event.c b/net/ieee80211/softmac/ieee80211softmac_event.c
index b9015656cfb3..b3e33a4d4869 100644
--- a/net/ieee80211/softmac/ieee80211softmac_event.c
+++ b/net/ieee80211/softmac/ieee80211softmac_event.c
@@ -79,7 +79,7 @@ ieee80211softmac_notify_callback(struct work_struct *work)
79 container_of(work, struct ieee80211softmac_event, work.work); 79 container_of(work, struct ieee80211softmac_event, work.work);
80 struct ieee80211softmac_event event = *pevent; 80 struct ieee80211softmac_event event = *pevent;
81 kfree(pevent); 81 kfree(pevent);
82 82
83 event.fun(event.mac->dev, event.event_type, event.context); 83 event.fun(event.mac->dev, event.event_type, event.context);
84} 84}
85 85
@@ -92,14 +92,14 @@ ieee80211softmac_notify_internal(struct ieee80211softmac_device *mac,
92 92
93 if (event < -1 || event > IEEE80211SOFTMAC_EVENT_LAST) 93 if (event < -1 || event > IEEE80211SOFTMAC_EVENT_LAST)
94 return -ENOSYS; 94 return -ENOSYS;
95 95
96 if (!fun) 96 if (!fun)
97 return -EINVAL; 97 return -EINVAL;
98 98
99 eventptr = kmalloc(sizeof(struct ieee80211softmac_event), gfp_mask); 99 eventptr = kmalloc(sizeof(struct ieee80211softmac_event), gfp_mask);
100 if (!eventptr) 100 if (!eventptr)
101 return -ENOMEM; 101 return -ENOMEM;
102 102
103 eventptr->event_type = event; 103 eventptr->event_type = event;
104 INIT_DELAYED_WORK(&eventptr->work, ieee80211softmac_notify_callback); 104 INIT_DELAYED_WORK(&eventptr->work, ieee80211softmac_notify_callback);
105 eventptr->fun = fun; 105 eventptr->fun = fun;
@@ -122,7 +122,7 @@ ieee80211softmac_notify_gfp(struct net_device *dev,
122 122
123 if (event < 0 || event > IEEE80211SOFTMAC_EVENT_LAST) 123 if (event < 0 || event > IEEE80211SOFTMAC_EVENT_LAST)
124 return -ENOSYS; 124 return -ENOSYS;
125 125
126 return ieee80211softmac_notify_internal(mac, event, NULL, fun, context, gfp_mask); 126 return ieee80211softmac_notify_internal(mac, event, NULL, fun, context, gfp_mask);
127} 127}
128EXPORT_SYMBOL_GPL(ieee80211softmac_notify_gfp); 128EXPORT_SYMBOL_GPL(ieee80211softmac_notify_gfp);
@@ -133,7 +133,7 @@ ieee80211softmac_call_events_locked(struct ieee80211softmac_device *mac, int eve
133{ 133{
134 struct ieee80211softmac_event *eventptr, *tmp; 134 struct ieee80211softmac_event *eventptr, *tmp;
135 struct ieee80211softmac_network *network; 135 struct ieee80211softmac_network *network;
136 136
137 if (event >= 0) { 137 if (event >= 0) {
138 union iwreq_data wrqu; 138 union iwreq_data wrqu;
139 int we_event; 139 int we_event;
diff --git a/net/ieee80211/softmac/ieee80211softmac_io.c b/net/ieee80211/softmac/ieee80211softmac_io.c
index b96931001b43..26c35253be33 100644
--- a/net/ieee80211/softmac/ieee80211softmac_io.c
+++ b/net/ieee80211/softmac/ieee80211softmac_io.c
@@ -1,4 +1,4 @@
1/* 1/*
2 * Some parts based on code from net80211 2 * Some parts based on code from net80211
3 * Copyright (c) 2001 Atsushi Onoe 3 * Copyright (c) 2001 Atsushi Onoe
4 * Copyright (c) 2002-2005 Sam Leffler, Errno Consulting 4 * Copyright (c) 2002-2005 Sam Leffler, Errno Consulting
@@ -29,14 +29,14 @@
29 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 29 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
30 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 30 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
31 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 31 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
32 * 32 *
33 */ 33 */
34 34
35#include "ieee80211softmac_priv.h" 35#include "ieee80211softmac_priv.h"
36 36
37/* Helper functions for inserting data into the frames */ 37/* Helper functions for inserting data into the frames */
38 38
39/* 39/*
40 * Adds an ESSID element to the frame 40 * Adds an ESSID element to the frame
41 * 41 *
42 */ 42 */
@@ -53,7 +53,7 @@ ieee80211softmac_add_essid(u8 *dst, struct ieee80211softmac_essid *essid)
53 *dst++ = 0; 53 *dst++ = 0;
54 return dst; 54 return dst;
55 } 55 }
56} 56}
57 57
58/* Adds Supported Rates and if required Extended Rates Information Element 58/* Adds Supported Rates and if required Extended Rates Information Element
59 * to the frame, ASSUMES WE HAVE A SORTED LIST OF RATES */ 59 * to the frame, ASSUMES WE HAVE A SORTED LIST OF RATES */
@@ -81,18 +81,18 @@ ieee80211softmac_frame_add_rates(u8 *dst, const struct ieee80211softmac_ratesinf
81 memcpy(dst, r->rates + cck_len, ofdm_len); 81 memcpy(dst, r->rates + cck_len, ofdm_len);
82 dst += ofdm_len; 82 dst += ofdm_len;
83 } 83 }
84 } 84 }
85 return dst; 85 return dst;
86} 86}
87 87
88/* Allocate a management frame */ 88/* Allocate a management frame */
89static u8 * 89static u8 *
90ieee80211softmac_alloc_mgt(u32 size) 90ieee80211softmac_alloc_mgt(u32 size)
91{ 91{
92 u8 * data; 92 u8 * data;
93 93
94 /* Add the header and FCS to the size */ 94 /* Add the header and FCS to the size */
95 size = size + IEEE80211_3ADDR_LEN; 95 size = size + IEEE80211_3ADDR_LEN;
96 if(size > IEEE80211_DATA_LEN) 96 if(size > IEEE80211_DATA_LEN)
97 return NULL; 97 return NULL;
98 /* Allocate the frame */ 98 /* Allocate the frame */
@@ -103,13 +103,13 @@ ieee80211softmac_alloc_mgt(u32 size)
103/* 103/*
104 * Add a 2 Address Header 104 * Add a 2 Address Header
105 */ 105 */
106static void 106static void
107ieee80211softmac_hdr_2addr(struct ieee80211softmac_device *mac, 107ieee80211softmac_hdr_2addr(struct ieee80211softmac_device *mac,
108 struct ieee80211_hdr_2addr *header, u32 type, u8 *dest) 108 struct ieee80211_hdr_2addr *header, u32 type, u8 *dest)
109{ 109{
110 /* Fill in the frame control flags */ 110 /* Fill in the frame control flags */
111 header->frame_ctl = cpu_to_le16(type); 111 header->frame_ctl = cpu_to_le16(type);
112 /* Control packets always have WEP turned off */ 112 /* Control packets always have WEP turned off */
113 if(type > IEEE80211_STYPE_CFENDACK && type < IEEE80211_STYPE_PSPOLL) 113 if(type > IEEE80211_STYPE_CFENDACK && type < IEEE80211_STYPE_PSPOLL)
114 header->frame_ctl |= mac->ieee->sec.level ? cpu_to_le16(IEEE80211_FCTL_PROTECTED) : 0; 114 header->frame_ctl |= mac->ieee->sec.level ? cpu_to_le16(IEEE80211_FCTL_PROTECTED) : 0;
115 115
@@ -130,13 +130,13 @@ ieee80211softmac_hdr_2addr(struct ieee80211softmac_device *mac,
130 130
131 131
132/* Add a 3 Address Header */ 132/* Add a 3 Address Header */
133static void 133static void
134ieee80211softmac_hdr_3addr(struct ieee80211softmac_device *mac, 134ieee80211softmac_hdr_3addr(struct ieee80211softmac_device *mac,
135 struct ieee80211_hdr_3addr *header, u32 type, u8 *dest, u8 *bssid) 135 struct ieee80211_hdr_3addr *header, u32 type, u8 *dest, u8 *bssid)
136{ 136{
137 /* This is common with 2addr, so use that instead */ 137 /* This is common with 2addr, so use that instead */
138 ieee80211softmac_hdr_2addr(mac, (struct ieee80211_hdr_2addr *)header, type, dest); 138 ieee80211softmac_hdr_2addr(mac, (struct ieee80211_hdr_2addr *)header, type, dest);
139 139
140 /* Fill in the BSS ID */ 140 /* Fill in the BSS ID */
141 if(bssid == NULL) 141 if(bssid == NULL)
142 memset(header->addr3, 0xFF, ETH_ALEN); 142 memset(header->addr3, 0xFF, ETH_ALEN);
@@ -201,11 +201,11 @@ ieee80211softmac_capabilities(struct ieee80211softmac_device *mac,
201 201
202/***************************************************************************** 202/*****************************************************************************
203 * Create Management packets 203 * Create Management packets
204 *****************************************************************************/ 204 *****************************************************************************/
205 205
206/* Creates an association request packet */ 206/* Creates an association request packet */
207static u32 207static u32
208ieee80211softmac_assoc_req(struct ieee80211_assoc_request **pkt, 208ieee80211softmac_assoc_req(struct ieee80211_assoc_request **pkt,
209 struct ieee80211softmac_device *mac, struct ieee80211softmac_network *net) 209 struct ieee80211softmac_device *mac, struct ieee80211softmac_network *net)
210{ 210{
211 u8 *data; 211 u8 *data;
@@ -233,7 +233,7 @@ ieee80211softmac_assoc_req(struct ieee80211_assoc_request **pkt,
233 233
234 /* Fill in Listen Interval (?) */ 234 /* Fill in Listen Interval (?) */
235 (*pkt)->listen_interval = cpu_to_le16(10); 235 (*pkt)->listen_interval = cpu_to_le16(10);
236 236
237 data = (u8 *)(*pkt)->info_element; 237 data = (u8 *)(*pkt)->info_element;
238 /* Add SSID */ 238 /* Add SSID */
239 data = ieee80211softmac_add_essid(data, &net->essid); 239 data = ieee80211softmac_add_essid(data, &net->essid);
@@ -250,7 +250,7 @@ ieee80211softmac_assoc_req(struct ieee80211_assoc_request **pkt,
250 250
251/* Create a reassociation request packet */ 251/* Create a reassociation request packet */
252static u32 252static u32
253ieee80211softmac_reassoc_req(struct ieee80211_reassoc_request **pkt, 253ieee80211softmac_reassoc_req(struct ieee80211_reassoc_request **pkt,
254 struct ieee80211softmac_device *mac, struct ieee80211softmac_network *net) 254 struct ieee80211softmac_device *mac, struct ieee80211softmac_network *net)
255{ 255{
256 u8 *data; 256 u8 *data;
@@ -263,9 +263,9 @@ ieee80211softmac_reassoc_req(struct ieee80211_reassoc_request **pkt,
263 /* Rates IE */ 263 /* Rates IE */
264 1 + 1 + IEEE80211SOFTMAC_MAX_RATES_LEN + 264 1 + 1 + IEEE80211SOFTMAC_MAX_RATES_LEN +
265 /* Extended Rates IE */ 265 /* Extended Rates IE */
266 1 + 1 + IEEE80211SOFTMAC_MAX_EX_RATES_LEN 266 1 + 1 + IEEE80211SOFTMAC_MAX_EX_RATES_LEN
267 /* Other IE's? */ 267 /* Other IE's? */
268 ); 268 );
269 if (unlikely((*pkt) == NULL)) 269 if (unlikely((*pkt) == NULL))
270 return 0; 270 return 0;
271 ieee80211softmac_hdr_3addr(mac, &((*pkt)->header), IEEE80211_STYPE_REASSOC_REQ, net->bssid, net->bssid); 271 ieee80211softmac_hdr_3addr(mac, &((*pkt)->header), IEEE80211_STYPE_REASSOC_REQ, net->bssid, net->bssid);
@@ -277,10 +277,10 @@ ieee80211softmac_reassoc_req(struct ieee80211_reassoc_request **pkt,
277 (*pkt)->listen_interval = cpu_to_le16(10); 277 (*pkt)->listen_interval = cpu_to_le16(10);
278 /* Fill in the current AP MAC */ 278 /* Fill in the current AP MAC */
279 memcpy((*pkt)->current_ap, mac->ieee->bssid, ETH_ALEN); 279 memcpy((*pkt)->current_ap, mac->ieee->bssid, ETH_ALEN);
280 280
281 data = (u8 *)(*pkt)->info_element; 281 data = (u8 *)(*pkt)->info_element;
282 /* Add SSID */ 282 /* Add SSID */
283 data = ieee80211softmac_add_essid(data, &net->essid); 283 data = ieee80211softmac_add_essid(data, &net->essid);
284 /* Add Rates */ 284 /* Add Rates */
285 data = ieee80211softmac_frame_add_rates(data, &mac->ratesinfo); 285 data = ieee80211softmac_frame_add_rates(data, &mac->ratesinfo);
286 /* Return packet size */ 286 /* Return packet size */
@@ -289,7 +289,7 @@ ieee80211softmac_reassoc_req(struct ieee80211_reassoc_request **pkt,
289 289
290/* Create an authentication packet */ 290/* Create an authentication packet */
291static u32 291static u32
292ieee80211softmac_auth(struct ieee80211_auth **pkt, 292ieee80211softmac_auth(struct ieee80211_auth **pkt,
293 struct ieee80211softmac_device *mac, struct ieee80211softmac_network *net, 293 struct ieee80211softmac_device *mac, struct ieee80211softmac_network *net,
294 u16 transaction, u16 status, int *encrypt_mpdu) 294 u16 transaction, u16 status, int *encrypt_mpdu)
295{ 295{
@@ -309,20 +309,20 @@ ieee80211softmac_auth(struct ieee80211_auth **pkt,
309 if (unlikely((*pkt) == NULL)) 309 if (unlikely((*pkt) == NULL))
310 return 0; 310 return 0;
311 ieee80211softmac_hdr_3addr(mac, &((*pkt)->header), IEEE80211_STYPE_AUTH, net->bssid, net->bssid); 311 ieee80211softmac_hdr_3addr(mac, &((*pkt)->header), IEEE80211_STYPE_AUTH, net->bssid, net->bssid);
312 312
313 /* Algorithm */ 313 /* Algorithm */
314 (*pkt)->algorithm = cpu_to_le16(auth_mode); 314 (*pkt)->algorithm = cpu_to_le16(auth_mode);
315 /* Transaction */ 315 /* Transaction */
316 (*pkt)->transaction = cpu_to_le16(transaction); 316 (*pkt)->transaction = cpu_to_le16(transaction);
317 /* Status */ 317 /* Status */
318 (*pkt)->status = cpu_to_le16(status); 318 (*pkt)->status = cpu_to_le16(status);
319 319
320 data = (u8 *)(*pkt)->info_element; 320 data = (u8 *)(*pkt)->info_element;
321 /* Challenge Text */ 321 /* Challenge Text */
322 if (is_shared_response) { 322 if (is_shared_response) {
323 *data = MFIE_TYPE_CHALLENGE; 323 *data = MFIE_TYPE_CHALLENGE;
324 data++; 324 data++;
325 325
326 /* Copy the challenge in */ 326 /* Copy the challenge in */
327 *data = net->challenge_len; 327 *data = net->challenge_len;
328 data++; 328 data++;
@@ -360,7 +360,7 @@ static u32
360ieee80211softmac_probe_req(struct ieee80211_probe_request **pkt, 360ieee80211softmac_probe_req(struct ieee80211_probe_request **pkt,
361 struct ieee80211softmac_device *mac, struct ieee80211softmac_essid *essid) 361 struct ieee80211softmac_device *mac, struct ieee80211softmac_essid *essid)
362{ 362{
363 u8 *data; 363 u8 *data;
364 /* Allocate Packet */ 364 /* Allocate Packet */
365 (*pkt) = (struct ieee80211_probe_request *)ieee80211softmac_alloc_mgt( 365 (*pkt) = (struct ieee80211_probe_request *)ieee80211softmac_alloc_mgt(
366 /* SSID of requested network */ 366 /* SSID of requested network */
@@ -368,12 +368,12 @@ ieee80211softmac_probe_req(struct ieee80211_probe_request **pkt,
368 /* Rates IE */ 368 /* Rates IE */
369 1 + 1 + IEEE80211SOFTMAC_MAX_RATES_LEN + 369 1 + 1 + IEEE80211SOFTMAC_MAX_RATES_LEN +
370 /* Extended Rates IE */ 370 /* Extended Rates IE */
371 1 + 1 + IEEE80211SOFTMAC_MAX_EX_RATES_LEN 371 1 + 1 + IEEE80211SOFTMAC_MAX_EX_RATES_LEN
372 ); 372 );
373 if (unlikely((*pkt) == NULL)) 373 if (unlikely((*pkt) == NULL))
374 return 0; 374 return 0;
375 ieee80211softmac_hdr_3addr(mac, &((*pkt)->header), IEEE80211_STYPE_PROBE_REQ, NULL, NULL); 375 ieee80211softmac_hdr_3addr(mac, &((*pkt)->header), IEEE80211_STYPE_PROBE_REQ, NULL, NULL);
376 376
377 data = (u8 *)(*pkt)->info_element; 377 data = (u8 *)(*pkt)->info_element;
378 /* Add ESSID (can be NULL) */ 378 /* Add ESSID (can be NULL) */
379 data = ieee80211softmac_add_essid(data, essid); 379 data = ieee80211softmac_add_essid(data, essid);
@@ -401,7 +401,7 @@ ieee80211softmac_probe_resp(struct ieee80211_probe_response **pkt,
401 2 + /* DS Parameter Set */ 401 2 + /* DS Parameter Set */
402 8 + /* CF Parameter Set */ 402 8 + /* CF Parameter Set */
403 4 /* IBSS Parameter Set */ 403 4 /* IBSS Parameter Set */
404 ); 404 );
405 if (unlikely((*pkt) == NULL)) 405 if (unlikely((*pkt) == NULL))
406 return 0; 406 return 0;
407 ieee80211softmac_hdr_3addr(mac, &((*pkt)->header), IEEE80211_STYPE_PROBE_RESP, net->bssid, net->bssid); 407 ieee80211softmac_hdr_3addr(mac, &((*pkt)->header), IEEE80211_STYPE_PROBE_RESP, net->bssid, net->bssid);
@@ -445,15 +445,15 @@ ieee80211softmac_send_mgt_frame(struct ieee80211softmac_device *mac,
445 pkt_size = ieee80211softmac_probe_resp((struct ieee80211_probe_response **)(&pkt), mac, (struct ieee80211softmac_network *)ptrarg); 445 pkt_size = ieee80211softmac_probe_resp((struct ieee80211_probe_response **)(&pkt), mac, (struct ieee80211softmac_network *)ptrarg);
446 break; 446 break;
447 default: 447 default:
448 printkl(KERN_DEBUG PFX "Unsupported Management Frame type: %i\n", type); 448 printkl(KERN_DEBUG PFX "Unsupported Management Frame type: %i\n", type);
449 return -EINVAL; 449 return -EINVAL;
450 }; 450 };
451 451
452 if(pkt_size == 0 || pkt == NULL) { 452 if(pkt_size == 0 || pkt == NULL) {
453 printkl(KERN_DEBUG PFX "Error, packet is nonexistant or 0 length\n"); 453 printkl(KERN_DEBUG PFX "Error, packet is nonexistant or 0 length\n");
454 return -ENOMEM; 454 return -ENOMEM;
455 } 455 }
456 456
457 /* Send the packet to the ieee80211 layer for tx */ 457 /* Send the packet to the ieee80211 layer for tx */
458 /* we defined softmac->mgmt_xmit for this. Should we keep it 458 /* we defined softmac->mgmt_xmit for this. Should we keep it
459 * as it is (that means we'd need to wrap this into a txb), 459 * as it is (that means we'd need to wrap this into a txb),
diff --git a/net/ieee80211/softmac/ieee80211softmac_module.c b/net/ieee80211/softmac/ieee80211softmac_module.c
index 256207b71dc9..4f8c3ef70819 100644
--- a/net/ieee80211/softmac/ieee80211softmac_module.c
+++ b/net/ieee80211/softmac/ieee80211softmac_module.c
@@ -32,19 +32,19 @@ struct net_device *alloc_ieee80211softmac(int sizeof_priv)
32{ 32{
33 struct ieee80211softmac_device *softmac; 33 struct ieee80211softmac_device *softmac;
34 struct net_device *dev; 34 struct net_device *dev;
35 35
36 dev = alloc_ieee80211(sizeof(struct ieee80211softmac_device) + sizeof_priv); 36 dev = alloc_ieee80211(sizeof(struct ieee80211softmac_device) + sizeof_priv);
37 softmac = ieee80211_priv(dev); 37 softmac = ieee80211_priv(dev);
38 softmac->dev = dev; 38 softmac->dev = dev;
39 softmac->ieee = netdev_priv(dev); 39 softmac->ieee = netdev_priv(dev);
40 spin_lock_init(&softmac->lock); 40 spin_lock_init(&softmac->lock);
41 41
42 softmac->ieee->handle_auth = ieee80211softmac_auth_resp; 42 softmac->ieee->handle_auth = ieee80211softmac_auth_resp;
43 softmac->ieee->handle_deauth = ieee80211softmac_deauth_resp; 43 softmac->ieee->handle_deauth = ieee80211softmac_deauth_resp;
44 softmac->ieee->handle_assoc_response = ieee80211softmac_handle_assoc_response; 44 softmac->ieee->handle_assoc_response = ieee80211softmac_handle_assoc_response;
45 softmac->ieee->handle_reassoc_request = ieee80211softmac_handle_reassoc_req; 45 softmac->ieee->handle_reassoc_request = ieee80211softmac_handle_reassoc_req;
46 softmac->ieee->handle_disassoc = ieee80211softmac_handle_disassoc; 46 softmac->ieee->handle_disassoc = ieee80211softmac_handle_disassoc;
47 softmac->ieee->handle_beacon = ieee80211softmac_handle_beacon; 47 softmac->ieee->handle_beacon = ieee80211softmac_handle_beacon;
48 softmac->scaninfo = NULL; 48 softmac->scaninfo = NULL;
49 49
50 softmac->associnfo.scan_retry = IEEE80211SOFTMAC_ASSOC_SCAN_RETRY_LIMIT; 50 softmac->associnfo.scan_retry = IEEE80211SOFTMAC_ASSOC_SCAN_RETRY_LIMIT;
@@ -66,37 +66,37 @@ struct net_device *alloc_ieee80211softmac(int sizeof_priv)
66 66
67 /* to start with, we can't send anything ... */ 67 /* to start with, we can't send anything ... */
68 netif_carrier_off(dev); 68 netif_carrier_off(dev);
69 69
70 return dev; 70 return dev;
71} 71}
72EXPORT_SYMBOL_GPL(alloc_ieee80211softmac); 72EXPORT_SYMBOL_GPL(alloc_ieee80211softmac);
73 73
74/* Clears the pending work queue items, stops all scans, etc. */ 74/* Clears the pending work queue items, stops all scans, etc. */
75void 75void
76ieee80211softmac_clear_pending_work(struct ieee80211softmac_device *sm) 76ieee80211softmac_clear_pending_work(struct ieee80211softmac_device *sm)
77{ 77{
78 unsigned long flags; 78 unsigned long flags;
79 struct ieee80211softmac_event *eventptr, *eventtmp; 79 struct ieee80211softmac_event *eventptr, *eventtmp;
80 struct ieee80211softmac_auth_queue_item *authptr, *authtmp; 80 struct ieee80211softmac_auth_queue_item *authptr, *authtmp;
81 struct ieee80211softmac_network *netptr, *nettmp; 81 struct ieee80211softmac_network *netptr, *nettmp;
82 82
83 ieee80211softmac_stop_scan(sm); 83 ieee80211softmac_stop_scan(sm);
84 ieee80211softmac_wait_for_scan(sm); 84 ieee80211softmac_wait_for_scan(sm);
85 85
86 spin_lock_irqsave(&sm->lock, flags); 86 spin_lock_irqsave(&sm->lock, flags);
87 sm->running = 0; 87 sm->running = 0;
88 88
89 /* Free all pending assoc work items */ 89 /* Free all pending assoc work items */
90 cancel_delayed_work(&sm->associnfo.work); 90 cancel_delayed_work(&sm->associnfo.work);
91 91
92 /* Free all pending scan work items */ 92 /* Free all pending scan work items */
93 if(sm->scaninfo != NULL) 93 if(sm->scaninfo != NULL)
94 cancel_delayed_work(&sm->scaninfo->softmac_scan); 94 cancel_delayed_work(&sm->scaninfo->softmac_scan);
95 95
96 /* Free all pending auth work items */ 96 /* Free all pending auth work items */
97 list_for_each_entry(authptr, &sm->auth_queue, list) 97 list_for_each_entry(authptr, &sm->auth_queue, list)
98 cancel_delayed_work(&authptr->work); 98 cancel_delayed_work(&authptr->work);
99 99
100 /* delete all pending event calls and work items */ 100 /* delete all pending event calls and work items */
101 list_for_each_entry_safe(eventptr, eventtmp, &sm->events, list) 101 list_for_each_entry_safe(eventptr, eventtmp, &sm->events, list)
102 cancel_delayed_work(&eventptr->work); 102 cancel_delayed_work(&eventptr->work);
@@ -111,13 +111,13 @@ ieee80211softmac_clear_pending_work(struct ieee80211softmac_device *sm)
111 list_del(&authptr->list); 111 list_del(&authptr->list);
112 kfree(authptr); 112 kfree(authptr);
113 } 113 }
114 114
115 /* delete all pending event calls and work items */ 115 /* delete all pending event calls and work items */
116 list_for_each_entry_safe(eventptr, eventtmp, &sm->events, list) { 116 list_for_each_entry_safe(eventptr, eventtmp, &sm->events, list) {
117 list_del(&eventptr->list); 117 list_del(&eventptr->list);
118 kfree(eventptr); 118 kfree(eventptr);
119 } 119 }
120 120
121 /* Free all networks */ 121 /* Free all networks */
122 list_for_each_entry_safe(netptr, nettmp, &sm->network_list, list) { 122 list_for_each_entry_safe(netptr, nettmp, &sm->network_list, list) {
123 ieee80211softmac_del_network_locked(sm, netptr); 123 ieee80211softmac_del_network_locked(sm, netptr);
@@ -133,7 +133,7 @@ EXPORT_SYMBOL_GPL(ieee80211softmac_clear_pending_work);
133void free_ieee80211softmac(struct net_device *dev) 133void free_ieee80211softmac(struct net_device *dev)
134{ 134{
135 struct ieee80211softmac_device *sm = ieee80211_priv(dev); 135 struct ieee80211softmac_device *sm = ieee80211_priv(dev);
136 ieee80211softmac_clear_pending_work(sm); 136 ieee80211softmac_clear_pending_work(sm);
137 kfree(sm->scaninfo); 137 kfree(sm->scaninfo);
138 kfree(sm->wpa.IE); 138 kfree(sm->wpa.IE);
139 free_ieee80211(dev); 139 free_ieee80211(dev);
@@ -208,9 +208,9 @@ EXPORT_SYMBOL_GPL(ieee80211softmac_highest_supported_rate);
208void ieee80211softmac_process_erp(struct ieee80211softmac_device *mac, 208void ieee80211softmac_process_erp(struct ieee80211softmac_device *mac,
209 u8 erp_value) 209 u8 erp_value)
210{ 210{
211 int use_protection; 211 int use_protection;
212 int short_preamble; 212 int short_preamble;
213 u32 changes = 0; 213 u32 changes = 0;
214 214
215 /* Barker preamble mode */ 215 /* Barker preamble mode */
216 short_preamble = ((erp_value & WLAN_ERP_BARKER_PREAMBLE) == 0 216 short_preamble = ((erp_value & WLAN_ERP_BARKER_PREAMBLE) == 0
@@ -269,7 +269,7 @@ void ieee80211softmac_init_bss(struct ieee80211softmac_device *mac)
269 rates, so 801.11g devices start off at 11M for now. People 269 rates, so 801.11g devices start off at 11M for now. People
270 can manually change it if they really need to, but 11M is 270 can manually change it if they really need to, but 11M is
271 more reliable. Note similar logic in 271 more reliable. Note similar logic in
272 ieee80211softmac_wx_set_rate() */ 272 ieee80211softmac_wx_set_rate() */
273 if (ieee->modulation & IEEE80211_CCK_MODULATION) { 273 if (ieee->modulation & IEEE80211_CCK_MODULATION) {
274 txrates->user_rate = IEEE80211_CCK_RATE_11MB; 274 txrates->user_rate = IEEE80211_CCK_RATE_11MB;
275 } else if (ieee->modulation & IEEE80211_OFDM_MODULATION) { 275 } else if (ieee->modulation & IEEE80211_OFDM_MODULATION) {
@@ -332,7 +332,7 @@ void ieee80211softmac_set_rates(struct net_device *dev, u8 count, u8 *rates)
332{ 332{
333 struct ieee80211softmac_device *mac = ieee80211_priv(dev); 333 struct ieee80211softmac_device *mac = ieee80211_priv(dev);
334 unsigned long flags; 334 unsigned long flags;
335 335
336 spin_lock_irqsave(&mac->lock, flags); 336 spin_lock_irqsave(&mac->lock, flags);
337 memcpy(mac->ratesinfo.rates, rates, count); 337 memcpy(mac->ratesinfo.rates, rates, count);
338 mac->ratesinfo.count = count; 338 mac->ratesinfo.count = count;
@@ -344,7 +344,7 @@ static u8 raise_rate(struct ieee80211softmac_device *mac, u8 rate)
344{ 344{
345 int i; 345 int i;
346 struct ieee80211softmac_ratesinfo *ri = &mac->ratesinfo; 346 struct ieee80211softmac_ratesinfo *ri = &mac->ratesinfo;
347 347
348 for (i=0; i<ri->count-1; i++) { 348 for (i=0; i<ri->count-1; i++) {
349 if (ri->rates[i] == rate) 349 if (ri->rates[i] == rate)
350 return ri->rates[i+1]; 350 return ri->rates[i+1];
@@ -357,7 +357,7 @@ u8 ieee80211softmac_lower_rate_delta(struct ieee80211softmac_device *mac, u8 rat
357{ 357{
358 int i; 358 int i;
359 struct ieee80211softmac_ratesinfo *ri = &mac->ratesinfo; 359 struct ieee80211softmac_ratesinfo *ri = &mac->ratesinfo;
360 360
361 for (i=delta; i<ri->count; i++) { 361 for (i=delta; i<ri->count; i++) {
362 if (ri->rates[i] == rate) 362 if (ri->rates[i] == rate)
363 return ri->rates[i-delta]; 363 return ri->rates[i-delta];
@@ -438,7 +438,7 @@ ieee80211softmac_create_network(struct ieee80211softmac_device *mac,
438 softnet->channel = net->channel; 438 softnet->channel = net->channel;
439 softnet->essid.len = net->ssid_len; 439 softnet->essid.len = net->ssid_len;
440 memcpy(softnet->essid.data, net->ssid, softnet->essid.len); 440 memcpy(softnet->essid.data, net->ssid, softnet->essid.len);
441 441
442 /* copy rates over */ 442 /* copy rates over */
443 softnet->supported_rates.count = net->rates_len; 443 softnet->supported_rates.count = net->rates_len;
444 memcpy(&softnet->supported_rates.rates[0], net->rates, net->rates_len); 444 memcpy(&softnet->supported_rates.rates[0], net->rates, net->rates_len);
@@ -529,7 +529,7 @@ ieee80211softmac_get_network_by_bssid(struct ieee80211softmac_device *mac,
529{ 529{
530 unsigned long flags; 530 unsigned long flags;
531 struct ieee80211softmac_network *softmac_net; 531 struct ieee80211softmac_network *softmac_net;
532 532
533 spin_lock_irqsave(&mac->lock, flags); 533 spin_lock_irqsave(&mac->lock, flags);
534 softmac_net = ieee80211softmac_get_network_by_bssid_locked(mac, bssid); 534 softmac_net = ieee80211softmac_get_network_by_bssid_locked(mac, bssid);
535 spin_unlock_irqrestore(&mac->lock, flags); 535 spin_unlock_irqrestore(&mac->lock, flags);
@@ -556,13 +556,13 @@ ieee80211softmac_get_network_by_essid_locked(struct ieee80211softmac_device *mac
556/* Get a network from the list by ESSID with locking */ 556/* Get a network from the list by ESSID with locking */
557struct ieee80211softmac_network * 557struct ieee80211softmac_network *
558ieee80211softmac_get_network_by_essid(struct ieee80211softmac_device *mac, 558ieee80211softmac_get_network_by_essid(struct ieee80211softmac_device *mac,
559 struct ieee80211softmac_essid *essid) 559 struct ieee80211softmac_essid *essid)
560{ 560{
561 unsigned long flags; 561 unsigned long flags;
562 struct ieee80211softmac_network *softmac_net = NULL; 562 struct ieee80211softmac_network *softmac_net = NULL;
563 563
564 spin_lock_irqsave(&mac->lock, flags); 564 spin_lock_irqsave(&mac->lock, flags);
565 softmac_net = ieee80211softmac_get_network_by_essid_locked(mac, essid); 565 softmac_net = ieee80211softmac_get_network_by_essid_locked(mac, essid);
566 spin_unlock_irqrestore(&mac->lock, flags); 566 spin_unlock_irqrestore(&mac->lock, flags);
567 return softmac_net; 567 return softmac_net;
568} 568}
diff --git a/net/ieee80211/softmac/ieee80211softmac_priv.h b/net/ieee80211/softmac/ieee80211softmac_priv.h
index 4c2bba34d328..c43b189634df 100644
--- a/net/ieee80211/softmac/ieee80211softmac_priv.h
+++ b/net/ieee80211/softmac/ieee80211softmac_priv.h
@@ -130,7 +130,7 @@ static inline u8 get_fallback_rate(struct ieee80211softmac_device *mac, u8 rate)
130{ 130{
131 return ieee80211softmac_lower_rate_delta(mac, rate, 2); 131 return ieee80211softmac_lower_rate_delta(mac, rate, 2);
132} 132}
133 133
134 134
135/*** prototypes from _io.c */ 135/*** prototypes from _io.c */
136int ieee80211softmac_send_mgt_frame(struct ieee80211softmac_device *mac, 136int ieee80211softmac_send_mgt_frame(struct ieee80211softmac_device *mac,
@@ -156,7 +156,7 @@ int ieee80211softmac_handle_assoc_response(struct net_device * dev,
156int ieee80211softmac_handle_disassoc(struct net_device * dev, 156int ieee80211softmac_handle_disassoc(struct net_device * dev,
157 struct ieee80211_disassoc * disassoc); 157 struct ieee80211_disassoc * disassoc);
158int ieee80211softmac_handle_reassoc_req(struct net_device * dev, 158int ieee80211softmac_handle_reassoc_req(struct net_device * dev,
159 struct ieee80211_reassoc_request * reassoc); 159 struct ieee80211_reassoc_request * reassoc);
160void ieee80211softmac_assoc_timeout(struct work_struct *work); 160void ieee80211softmac_assoc_timeout(struct work_struct *work);
161void ieee80211softmac_send_disassoc_req(struct ieee80211softmac_device *mac, u16 reason); 161void ieee80211softmac_send_disassoc_req(struct ieee80211softmac_device *mac, u16 reason);
162void ieee80211softmac_disassoc(struct ieee80211softmac_device *mac); 162void ieee80211softmac_disassoc(struct ieee80211softmac_device *mac);
@@ -164,15 +164,15 @@ void ieee80211softmac_disassoc(struct ieee80211softmac_device *mac);
164/* some helper functions */ 164/* some helper functions */
165static inline int ieee80211softmac_scan_handlers_check_self(struct ieee80211softmac_device *sm) 165static inline int ieee80211softmac_scan_handlers_check_self(struct ieee80211softmac_device *sm)
166{ 166{
167 return (sm->start_scan == ieee80211softmac_start_scan_implementation) && 167 return (sm->start_scan == ieee80211softmac_start_scan_implementation) &&
168 (sm->stop_scan == ieee80211softmac_stop_scan_implementation) && 168 (sm->stop_scan == ieee80211softmac_stop_scan_implementation) &&
169 (sm->wait_for_scan == ieee80211softmac_wait_for_scan_implementation); 169 (sm->wait_for_scan == ieee80211softmac_wait_for_scan_implementation);
170} 170}
171 171
172static inline int ieee80211softmac_scan_sanity_check(struct ieee80211softmac_device *sm) 172static inline int ieee80211softmac_scan_sanity_check(struct ieee80211softmac_device *sm)
173{ 173{
174 return ((sm->start_scan != ieee80211softmac_start_scan_implementation) && 174 return ((sm->start_scan != ieee80211softmac_start_scan_implementation) &&
175 (sm->stop_scan != ieee80211softmac_stop_scan_implementation) && 175 (sm->stop_scan != ieee80211softmac_stop_scan_implementation) &&
176 (sm->wait_for_scan != ieee80211softmac_wait_for_scan_implementation) 176 (sm->wait_for_scan != ieee80211softmac_wait_for_scan_implementation)
177 ) || ieee80211softmac_scan_handlers_check_self(sm); 177 ) || ieee80211softmac_scan_handlers_check_self(sm);
178} 178}
diff --git a/net/ieee80211/softmac/ieee80211softmac_scan.c b/net/ieee80211/softmac/ieee80211softmac_scan.c
index 0c85d6c24cdb..abea3648680e 100644
--- a/net/ieee80211/softmac/ieee80211softmac_scan.c
+++ b/net/ieee80211/softmac/ieee80211softmac_scan.c
@@ -62,12 +62,12 @@ ieee80211softmac_stop_scan(struct ieee80211softmac_device *sm)
62 unsigned long flags; 62 unsigned long flags;
63 63
64 spin_lock_irqsave(&sm->lock, flags); 64 spin_lock_irqsave(&sm->lock, flags);
65 65
66 if (!sm->scanning) { 66 if (!sm->scanning) {
67 spin_unlock_irqrestore(&sm->lock, flags); 67 spin_unlock_irqrestore(&sm->lock, flags);
68 return; 68 return;
69 } 69 }
70 70
71 spin_unlock_irqrestore(&sm->lock, flags); 71 spin_unlock_irqrestore(&sm->lock, flags);
72 sm->stop_scan(sm->dev); 72 sm->stop_scan(sm->dev);
73} 73}
@@ -78,12 +78,12 @@ ieee80211softmac_wait_for_scan(struct ieee80211softmac_device *sm)
78 unsigned long flags; 78 unsigned long flags;
79 79
80 spin_lock_irqsave(&sm->lock, flags); 80 spin_lock_irqsave(&sm->lock, flags);
81 81
82 if (!sm->scanning) { 82 if (!sm->scanning) {
83 spin_unlock_irqrestore(&sm->lock, flags); 83 spin_unlock_irqrestore(&sm->lock, flags);
84 return; 84 return;
85 } 85 }
86 86
87 spin_unlock_irqrestore(&sm->lock, flags); 87 spin_unlock_irqrestore(&sm->lock, flags);
88 sm->wait_for_scan(sm->dev); 88 sm->wait_for_scan(sm->dev);
89} 89}
@@ -158,14 +158,14 @@ int ieee80211softmac_start_scan_implementation(struct net_device *dev)
158{ 158{
159 struct ieee80211softmac_device *sm = ieee80211_priv(dev); 159 struct ieee80211softmac_device *sm = ieee80211_priv(dev);
160 unsigned long flags; 160 unsigned long flags;
161 161
162 if (!(dev->flags & IFF_UP)) 162 if (!(dev->flags & IFF_UP))
163 return -ENODEV; 163 return -ENODEV;
164 164
165 assert(ieee80211softmac_scan_handlers_check_self(sm)); 165 assert(ieee80211softmac_scan_handlers_check_self(sm));
166 if (!ieee80211softmac_scan_handlers_check_self(sm)) 166 if (!ieee80211softmac_scan_handlers_check_self(sm))
167 return -EINVAL; 167 return -EINVAL;
168 168
169 spin_lock_irqsave(&sm->lock, flags); 169 spin_lock_irqsave(&sm->lock, flags);
170 /* it looks like we need to hold the lock here 170 /* it looks like we need to hold the lock here
171 * to make sure we don't allocate two of these... */ 171 * to make sure we don't allocate two of these... */
@@ -241,7 +241,7 @@ void ieee80211softmac_scan_finished(struct ieee80211softmac_device *sm)
241 spin_lock_irqsave(&sm->lock, flags); 241 spin_lock_irqsave(&sm->lock, flags);
242 sm->scanning = 0; 242 sm->scanning = 0;
243 spin_unlock_irqrestore(&sm->lock, flags); 243 spin_unlock_irqrestore(&sm->lock, flags);
244 244
245 if (sm->associnfo.bssvalid) { 245 if (sm->associnfo.bssvalid) {
246 struct ieee80211softmac_network *net; 246 struct ieee80211softmac_network *net;
247 247
diff --git a/net/ieee80211/softmac/ieee80211softmac_wx.c b/net/ieee80211/softmac/ieee80211softmac_wx.c
index fb58e03b3fbd..c306d52566e0 100644
--- a/net/ieee80211/softmac/ieee80211softmac_wx.c
+++ b/net/ieee80211/softmac/ieee80211softmac_wx.c
@@ -142,14 +142,14 @@ ieee80211softmac_wx_get_essid(struct net_device *net_dev,
142 /* If all fails, return ANY (empty) */ 142 /* If all fails, return ANY (empty) */
143 data->essid.length = 0; 143 data->essid.length = 0;
144 data->essid.flags = 0; /* active */ 144 data->essid.flags = 0; /* active */
145 145
146 /* If we have a statically configured ESSID then return it */ 146 /* If we have a statically configured ESSID then return it */
147 if (sm->associnfo.static_essid) { 147 if (sm->associnfo.static_essid) {
148 data->essid.length = sm->associnfo.req_essid.len; 148 data->essid.length = sm->associnfo.req_essid.len;
149 data->essid.flags = 1; /* active */ 149 data->essid.flags = 1; /* active */
150 memcpy(extra, sm->associnfo.req_essid.data, sm->associnfo.req_essid.len); 150 memcpy(extra, sm->associnfo.req_essid.data, sm->associnfo.req_essid.len);
151 } 151 }
152 152
153 /* If we're associating/associated, return that */ 153 /* If we're associating/associated, return that */
154 if (sm->associnfo.associated || sm->associnfo.associating) { 154 if (sm->associnfo.associated || sm->associnfo.associating) {
155 data->essid.length = sm->associnfo.associate_essid.len; 155 data->essid.length = sm->associnfo.associate_essid.len;
@@ -181,7 +181,7 @@ ieee80211softmac_wx_set_rate(struct net_device *net_dev,
181 rates, so 801.11g devices start off at 11M for now. People 181 rates, so 801.11g devices start off at 11M for now. People
182 can manually change it if they really need to, but 11M is 182 can manually change it if they really need to, but 11M is
183 more reliable. Note similar logic in 183 more reliable. Note similar logic in
184 ieee80211softmac_wx_set_rate() */ 184 ieee80211softmac_wx_set_rate() */
185 if (ieee->modulation & IEEE80211_CCK_MODULATION) 185 if (ieee->modulation & IEEE80211_CCK_MODULATION)
186 in_rate = 11000000; 186 in_rate = 11000000;
187 else 187 else
@@ -247,7 +247,7 @@ ieee80211softmac_wx_set_rate(struct net_device *net_dev,
247 ieee80211softmac_recalc_txrates(mac); 247 ieee80211softmac_recalc_txrates(mac);
248 err = 0; 248 err = 0;
249 249
250out_unlock: 250out_unlock:
251 spin_unlock_irqrestore(&mac->lock, flags); 251 spin_unlock_irqrestore(&mac->lock, flags);
252out: 252out:
253 return err; 253 return err;
@@ -366,7 +366,7 @@ ieee80211softmac_wx_set_wap(struct net_device *net_dev,
366 } else if (is_zero_ether_addr(data->ap_addr.sa_data)) { 366 } else if (is_zero_ether_addr(data->ap_addr.sa_data)) {
367 /* the bssid we have is no longer fixed */ 367 /* the bssid we have is no longer fixed */
368 mac->associnfo.bssfixed = 0; 368 mac->associnfo.bssfixed = 0;
369 } else { 369 } else {
370 if (!memcmp(mac->associnfo.bssid, data->ap_addr.sa_data, ETH_ALEN)) { 370 if (!memcmp(mac->associnfo.bssid, data->ap_addr.sa_data, ETH_ALEN)) {
371 if (mac->associnfo.associating || mac->associnfo.associated) { 371 if (mac->associnfo.associating || mac->associnfo.associated) {
372 /* bssid unchanged and associated or associating - just return */ 372 /* bssid unchanged and associated or associating - just return */
@@ -380,7 +380,7 @@ ieee80211softmac_wx_set_wap(struct net_device *net_dev,
380 mac->associnfo.bssfixed = 1; 380 mac->associnfo.bssfixed = 1;
381 /* queue associate if new bssid or (old one again and not associated) */ 381 /* queue associate if new bssid or (old one again and not associated) */
382 schedule_delayed_work(&mac->associnfo.work, 0); 382 schedule_delayed_work(&mac->associnfo.work, 0);
383 } 383 }
384 384
385 out: 385 out:
386 mutex_unlock(&mac->associnfo.mutex); 386 mutex_unlock(&mac->associnfo.mutex);
@@ -437,7 +437,7 @@ ieee80211softmac_wx_set_genie(struct net_device *dev,
437 mac->wpa.IEbuflen = 0; 437 mac->wpa.IEbuflen = 0;
438 } 438 }
439 439
440 out: 440 out:
441 spin_unlock_irqrestore(&mac->lock, flags); 441 spin_unlock_irqrestore(&mac->lock, flags);
442 mutex_unlock(&mac->associnfo.mutex); 442 mutex_unlock(&mac->associnfo.mutex);
443 443
@@ -458,9 +458,9 @@ ieee80211softmac_wx_get_genie(struct net_device *dev,
458 458
459 mutex_lock(&mac->associnfo.mutex); 459 mutex_lock(&mac->associnfo.mutex);
460 spin_lock_irqsave(&mac->lock, flags); 460 spin_lock_irqsave(&mac->lock, flags);
461 461
462 wrqu->data.length = 0; 462 wrqu->data.length = 0;
463 463
464 if (mac->wpa.IE && mac->wpa.IElen) { 464 if (mac->wpa.IE && mac->wpa.IElen) {
465 wrqu->data.length = mac->wpa.IElen; 465 wrqu->data.length = mac->wpa.IElen;
466 if (mac->wpa.IElen <= space) 466 if (mac->wpa.IElen <= space)