diff options
Diffstat (limited to 'net/ieee80211/softmac/ieee80211softmac_auth.c')
-rw-r--r-- | net/ieee80211/softmac/ieee80211softmac_auth.c | 78 |
1 files changed, 39 insertions, 39 deletions
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 */ |
32 | int | 32 | int |
33 | ieee80211softmac_auth_req(struct ieee80211softmac_device *mac, | 33 | ieee80211softmac_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 | */ |
135 | int | 135 | int |
136 | ieee80211softmac_auth_resp(struct net_device *dev, struct ieee80211_auth *auth) | 136 | ieee80211softmac_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 | */ |
347 | int | 347 | int |
348 | ieee80211softmac_deauth_req(struct ieee80211softmac_device *mac, | 348 | ieee80211softmac_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 | */ |
372 | int | 372 | int |
373 | ieee80211softmac_deauth_resp(struct net_device *dev, struct ieee80211_deauth *deauth) | 373 | ieee80211softmac_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)); |