diff options
Diffstat (limited to 'net/ieee80211/softmac/ieee80211softmac_assoc.c')
-rw-r--r-- | net/ieee80211/softmac/ieee80211softmac_assoc.c | 31 |
1 files changed, 24 insertions, 7 deletions
diff --git a/net/ieee80211/softmac/ieee80211softmac_assoc.c b/net/ieee80211/softmac/ieee80211softmac_assoc.c index 5e9a90651d04..44215ce64d4e 100644 --- a/net/ieee80211/softmac/ieee80211softmac_assoc.c +++ b/net/ieee80211/softmac/ieee80211softmac_assoc.c | |||
@@ -47,9 +47,7 @@ ieee80211softmac_assoc(struct ieee80211softmac_device *mac, struct ieee80211soft | |||
47 | 47 | ||
48 | dprintk(KERN_INFO PFX "sent association request!\n"); | 48 | dprintk(KERN_INFO PFX "sent association request!\n"); |
49 | 49 | ||
50 | /* Change the state to associating */ | ||
51 | spin_lock_irqsave(&mac->lock, flags); | 50 | spin_lock_irqsave(&mac->lock, flags); |
52 | mac->associnfo.associating = 1; | ||
53 | mac->associated = 0; /* just to make sure */ | 51 | mac->associated = 0; /* just to make sure */ |
54 | 52 | ||
55 | /* Set a timer for timeout */ | 53 | /* Set a timer for timeout */ |
@@ -63,6 +61,7 @@ void | |||
63 | ieee80211softmac_assoc_timeout(void *d) | 61 | ieee80211softmac_assoc_timeout(void *d) |
64 | { | 62 | { |
65 | struct ieee80211softmac_device *mac = (struct ieee80211softmac_device *)d; | 63 | struct ieee80211softmac_device *mac = (struct ieee80211softmac_device *)d; |
64 | struct ieee80211softmac_network *n; | ||
66 | unsigned long flags; | 65 | unsigned long flags; |
67 | 66 | ||
68 | spin_lock_irqsave(&mac->lock, flags); | 67 | spin_lock_irqsave(&mac->lock, flags); |
@@ -75,11 +74,12 @@ ieee80211softmac_assoc_timeout(void *d) | |||
75 | mac->associnfo.associating = 0; | 74 | mac->associnfo.associating = 0; |
76 | mac->associnfo.bssvalid = 0; | 75 | mac->associnfo.bssvalid = 0; |
77 | mac->associated = 0; | 76 | mac->associated = 0; |
77 | |||
78 | n = ieee80211softmac_get_network_by_bssid_locked(mac, mac->associnfo.bssid); | ||
78 | spin_unlock_irqrestore(&mac->lock, flags); | 79 | spin_unlock_irqrestore(&mac->lock, flags); |
79 | 80 | ||
80 | dprintk(KERN_INFO PFX "assoc request timed out!\n"); | 81 | dprintk(KERN_INFO PFX "assoc request timed out!\n"); |
81 | /* FIXME: we need to know the network here. that requires a bit of restructuring */ | 82 | ieee80211softmac_call_events(mac, IEEE80211SOFTMAC_EVENT_ASSOCIATE_TIMEOUT, n); |
82 | ieee80211softmac_call_events(mac, IEEE80211SOFTMAC_EVENT_ASSOCIATE_TIMEOUT, NULL); | ||
83 | } | 83 | } |
84 | 84 | ||
85 | void | 85 | void |
@@ -203,6 +203,10 @@ ieee80211softmac_assoc_work(void *d) | |||
203 | if (mac->associated) | 203 | if (mac->associated) |
204 | ieee80211softmac_send_disassoc_req(mac, WLAN_REASON_DISASSOC_STA_HAS_LEFT); | 204 | ieee80211softmac_send_disassoc_req(mac, WLAN_REASON_DISASSOC_STA_HAS_LEFT); |
205 | 205 | ||
206 | spin_lock_irqsave(&mac->lock, flags); | ||
207 | mac->associnfo.associating = 1; | ||
208 | spin_unlock_irqrestore(&mac->lock, flags); | ||
209 | |||
206 | /* try to find the requested network in our list, if we found one already */ | 210 | /* try to find the requested network in our list, if we found one already */ |
207 | if (bssvalid || mac->associnfo.bssfixed) | 211 | if (bssvalid || mac->associnfo.bssfixed) |
208 | found = ieee80211softmac_get_network_by_bssid(mac, mac->associnfo.bssid); | 212 | found = ieee80211softmac_get_network_by_bssid(mac, mac->associnfo.bssid); |
@@ -295,19 +299,32 @@ ieee80211softmac_assoc_work(void *d) | |||
295 | memcpy(mac->associnfo.associate_essid.data, found->essid.data, IW_ESSID_MAX_SIZE + 1); | 299 | memcpy(mac->associnfo.associate_essid.data, found->essid.data, IW_ESSID_MAX_SIZE + 1); |
296 | 300 | ||
297 | /* we found a network! authenticate (if necessary) and associate to it. */ | 301 | /* we found a network! authenticate (if necessary) and associate to it. */ |
298 | if (!found->authenticated) { | 302 | if (found->authenticating) { |
303 | dprintk(KERN_INFO PFX "Already requested authentication, waiting...\n"); | ||
304 | if(!mac->associnfo.assoc_wait) { | ||
305 | mac->associnfo.assoc_wait = 1; | ||
306 | ieee80211softmac_notify_internal(mac, IEEE80211SOFTMAC_EVENT_ANY, found, ieee80211softmac_assoc_notify_auth, NULL, GFP_KERNEL); | ||
307 | } | ||
308 | return; | ||
309 | } | ||
310 | if (!found->authenticated && !found->authenticating) { | ||
299 | /* This relies on the fact that _auth_req only queues the work, | 311 | /* This relies on the fact that _auth_req only queues the work, |
300 | * otherwise adding the notification would be racy. */ | 312 | * otherwise adding the notification would be racy. */ |
301 | if (!ieee80211softmac_auth_req(mac, found)) { | 313 | if (!ieee80211softmac_auth_req(mac, found)) { |
302 | dprintk(KERN_INFO PFX "cannot associate without being authenticated, requested authentication\n"); | 314 | if(!mac->associnfo.assoc_wait) { |
303 | ieee80211softmac_notify_internal(mac, IEEE80211SOFTMAC_EVENT_ANY, found, ieee80211softmac_assoc_notify_auth, NULL, GFP_KERNEL); | 315 | dprintk(KERN_INFO PFX "Cannot associate without being authenticated, requested authentication\n"); |
316 | mac->associnfo.assoc_wait = 1; | ||
317 | ieee80211softmac_notify_internal(mac, IEEE80211SOFTMAC_EVENT_ANY, found, ieee80211softmac_assoc_notify_auth, NULL, GFP_KERNEL); | ||
318 | } | ||
304 | } else { | 319 | } else { |
305 | printkl(KERN_WARNING PFX "Not authenticated, but requesting authentication failed. Giving up to associate\n"); | 320 | printkl(KERN_WARNING PFX "Not authenticated, but requesting authentication failed. Giving up to associate\n"); |
321 | mac->associnfo.assoc_wait = 0; | ||
306 | ieee80211softmac_call_events(mac, IEEE80211SOFTMAC_EVENT_ASSOCIATE_FAILED, found); | 322 | ieee80211softmac_call_events(mac, IEEE80211SOFTMAC_EVENT_ASSOCIATE_FAILED, found); |
307 | } | 323 | } |
308 | return; | 324 | return; |
309 | } | 325 | } |
310 | /* finally! now we can start associating */ | 326 | /* finally! now we can start associating */ |
327 | mac->associnfo.assoc_wait = 0; | ||
311 | ieee80211softmac_assoc(mac, found); | 328 | ieee80211softmac_assoc(mac, found); |
312 | } | 329 | } |
313 | 330 | ||