diff options
Diffstat (limited to 'net/ieee80211/softmac/ieee80211softmac_assoc.c')
-rw-r--r-- | net/ieee80211/softmac/ieee80211softmac_assoc.c | 25 |
1 files changed, 20 insertions, 5 deletions
diff --git a/net/ieee80211/softmac/ieee80211softmac_assoc.c b/net/ieee80211/softmac/ieee80211softmac_assoc.c index be61de78dfa4..fb79ce7d6439 100644 --- a/net/ieee80211/softmac/ieee80211softmac_assoc.c +++ b/net/ieee80211/softmac/ieee80211softmac_assoc.c | |||
@@ -101,6 +101,7 @@ ieee80211softmac_disassoc(struct ieee80211softmac_device *mac, u16 reason) | |||
101 | /* Do NOT clear bssvalid as that will break ieee80211softmac_assoc_work! */ | 101 | /* Do NOT clear bssvalid as that will break ieee80211softmac_assoc_work! */ |
102 | mac->associated = 0; | 102 | mac->associated = 0; |
103 | mac->associnfo.associating = 0; | 103 | mac->associnfo.associating = 0; |
104 | ieee80211softmac_call_events_locked(mac, IEEE80211SOFTMAC_EVENT_DISASSOCIATED, NULL); | ||
104 | spin_unlock_irqrestore(&mac->lock, flags); | 105 | spin_unlock_irqrestore(&mac->lock, flags); |
105 | } | 106 | } |
106 | 107 | ||
@@ -143,6 +144,12 @@ network_matches_request(struct ieee80211softmac_device *mac, struct ieee80211_ne | |||
143 | if (!we_support_all_basic_rates(mac, net->rates_ex, net->rates_ex_len)) | 144 | if (!we_support_all_basic_rates(mac, net->rates_ex, net->rates_ex_len)) |
144 | return 0; | 145 | return 0; |
145 | 146 | ||
147 | /* assume that users know what they're doing ... | ||
148 | * (note we don't let them select a net we're incompatible with) */ | ||
149 | if (mac->associnfo.bssfixed) { | ||
150 | return !memcmp(mac->associnfo.bssid, net->bssid, ETH_ALEN); | ||
151 | } | ||
152 | |||
146 | /* if 'ANY' network requested, take any that doesn't have privacy enabled */ | 153 | /* if 'ANY' network requested, take any that doesn't have privacy enabled */ |
147 | if (mac->associnfo.req_essid.len == 0 | 154 | if (mac->associnfo.req_essid.len == 0 |
148 | && !(net->capability & WLAN_CAPABILITY_PRIVACY)) | 155 | && !(net->capability & WLAN_CAPABILITY_PRIVACY)) |
@@ -175,7 +182,7 @@ ieee80211softmac_assoc_work(void *d) | |||
175 | ieee80211softmac_disassoc(mac, WLAN_REASON_DISASSOC_STA_HAS_LEFT); | 182 | ieee80211softmac_disassoc(mac, WLAN_REASON_DISASSOC_STA_HAS_LEFT); |
176 | 183 | ||
177 | /* try to find the requested network in our list, if we found one already */ | 184 | /* try to find the requested network in our list, if we found one already */ |
178 | if (mac->associnfo.bssvalid) | 185 | if (mac->associnfo.bssvalid || mac->associnfo.bssfixed) |
179 | found = ieee80211softmac_get_network_by_bssid(mac, mac->associnfo.bssid); | 186 | found = ieee80211softmac_get_network_by_bssid(mac, mac->associnfo.bssid); |
180 | 187 | ||
181 | /* Search the ieee80211 networks for this network if we didn't find it by bssid, | 188 | /* Search the ieee80211 networks for this network if we didn't find it by bssid, |
@@ -240,19 +247,25 @@ ieee80211softmac_assoc_work(void *d) | |||
240 | if (ieee80211softmac_start_scan(mac)) | 247 | if (ieee80211softmac_start_scan(mac)) |
241 | dprintk(KERN_INFO PFX "Associate: failed to initiate scan. Is device up?\n"); | 248 | dprintk(KERN_INFO PFX "Associate: failed to initiate scan. Is device up?\n"); |
242 | return; | 249 | return; |
243 | } | 250 | } else { |
244 | else { | ||
245 | spin_lock_irqsave(&mac->lock, flags); | 251 | spin_lock_irqsave(&mac->lock, flags); |
246 | mac->associnfo.associating = 0; | 252 | mac->associnfo.associating = 0; |
247 | mac->associated = 0; | 253 | mac->associated = 0; |
248 | spin_unlock_irqrestore(&mac->lock, flags); | 254 | spin_unlock_irqrestore(&mac->lock, flags); |
249 | 255 | ||
250 | dprintk(KERN_INFO PFX "Unable to find matching network after scan!\n"); | 256 | dprintk(KERN_INFO PFX "Unable to find matching network after scan!\n"); |
257 | /* reset the retry counter for the next user request since we | ||
258 | * break out and don't reschedule ourselves after this point. */ | ||
259 | mac->associnfo.scan_retry = IEEE80211SOFTMAC_ASSOC_SCAN_RETRY_LIMIT; | ||
251 | ieee80211softmac_call_events(mac, IEEE80211SOFTMAC_EVENT_ASSOCIATE_NET_NOT_FOUND, NULL); | 260 | ieee80211softmac_call_events(mac, IEEE80211SOFTMAC_EVENT_ASSOCIATE_NET_NOT_FOUND, NULL); |
252 | return; | 261 | return; |
253 | } | 262 | } |
254 | } | 263 | } |
255 | 264 | ||
265 | /* reset the retry counter for the next user request since we | ||
266 | * now found a net and will try to associate to it, but not | ||
267 | * schedule this function again. */ | ||
268 | mac->associnfo.scan_retry = IEEE80211SOFTMAC_ASSOC_SCAN_RETRY_LIMIT; | ||
256 | mac->associnfo.bssvalid = 1; | 269 | mac->associnfo.bssvalid = 1; |
257 | memcpy(mac->associnfo.bssid, found->bssid, ETH_ALEN); | 270 | memcpy(mac->associnfo.bssid, found->bssid, ETH_ALEN); |
258 | /* copy the ESSID for displaying it */ | 271 | /* copy the ESSID for displaying it */ |
@@ -373,6 +386,7 @@ ieee80211softmac_handle_disassoc(struct net_device * dev, | |||
373 | spin_lock_irqsave(&mac->lock, flags); | 386 | spin_lock_irqsave(&mac->lock, flags); |
374 | mac->associnfo.bssvalid = 0; | 387 | mac->associnfo.bssvalid = 0; |
375 | mac->associated = 0; | 388 | mac->associated = 0; |
389 | ieee80211softmac_call_events_locked(mac, IEEE80211SOFTMAC_EVENT_DISASSOCIATED, NULL); | ||
376 | schedule_work(&mac->associnfo.work); | 390 | schedule_work(&mac->associnfo.work); |
377 | spin_unlock_irqrestore(&mac->lock, flags); | 391 | spin_unlock_irqrestore(&mac->lock, flags); |
378 | 392 | ||
@@ -391,6 +405,7 @@ ieee80211softmac_handle_reassoc_req(struct net_device * dev, | |||
391 | dprintkl(KERN_INFO PFX "reassoc request from unknown network\n"); | 405 | dprintkl(KERN_INFO PFX "reassoc request from unknown network\n"); |
392 | return 0; | 406 | return 0; |
393 | } | 407 | } |
394 | ieee80211softmac_assoc(mac, network); | 408 | schedule_work(&mac->associnfo.work); |
409 | |||
395 | return 0; | 410 | return 0; |
396 | } | 411 | } |