diff options
author | Johannes Berg <johannes@sipsolutions.net> | 2006-01-11 04:46:16 -0500 |
---|---|---|
committer | John W. Linville <linville@tuxdriver.com> | 2006-03-22 22:16:55 -0500 |
commit | 1dc09776d79e0162553f6434c0b1ccb0cceea0b3 (patch) | |
tree | 9328e50b85e01f754dc2c4d0e0f78461a76269ad /net | |
parent | 48b2e4ce690dfbf4097e89e6ce0861ab85fd89c9 (diff) |
[PATCH] softmac: scan at least once before selecting a network by essid
Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'net')
-rw-r--r-- | net/ieee80211/softmac/ieee80211softmac_assoc.c | 15 |
1 files changed, 8 insertions, 7 deletions
diff --git a/net/ieee80211/softmac/ieee80211softmac_assoc.c b/net/ieee80211/softmac/ieee80211softmac_assoc.c index dd5d5cf7189a..aef018f8000e 100644 --- a/net/ieee80211/softmac/ieee80211softmac_assoc.c +++ b/net/ieee80211/softmac/ieee80211softmac_assoc.c | |||
@@ -164,8 +164,11 @@ ieee80211softmac_assoc_work(void *d) | |||
164 | if (mac->associnfo.bssvalid) | 164 | if (mac->associnfo.bssvalid) |
165 | found = ieee80211softmac_get_network_by_bssid(mac, mac->associnfo.bssid); | 165 | found = ieee80211softmac_get_network_by_bssid(mac, mac->associnfo.bssid); |
166 | 166 | ||
167 | /* Search the ieee80211 networks for this network if we didn't find it */ | 167 | /* Search the ieee80211 networks for this network if we didn't find it by bssid, |
168 | if (!found) | 168 | * but only if we've scanned at least once (to get a better list of networks to |
169 | * select from). If we have not scanned before, the !found logic below will be | ||
170 | * invoked and will scan. */ | ||
171 | if (!found && (mac->associnfo.scan_retry < IEEE80211SOFTMAC_ASSOC_SCAN_RETRY_LIMIT)) | ||
169 | { | 172 | { |
170 | s8 rssi = -128; /* if I don't initialise, gcc emits an invalid warning | 173 | s8 rssi = -128; /* if I don't initialise, gcc emits an invalid warning |
171 | because it cannot follow the best pointer logic. */ | 174 | because it cannot follow the best pointer logic. */ |
@@ -218,12 +221,10 @@ ieee80211softmac_assoc_work(void *d) | |||
218 | * NB: this also happens if we had no memory to copy the network info... | 221 | * NB: this also happens if we had no memory to copy the network info... |
219 | * Maybe we can hope to have more memory after scanning finishes ;) | 222 | * Maybe we can hope to have more memory after scanning finishes ;) |
220 | */ | 223 | */ |
221 | dprintk(KERN_INFO PFX "Associate: Network not known, trying to initiate scan: "); | 224 | dprintk(KERN_INFO PFX "Associate: Scanning for networks first.\n"); |
222 | ieee80211softmac_notify(mac->dev, IEEE80211SOFTMAC_EVENT_SCAN_FINISHED, ieee80211softmac_assoc_notify, NULL); | 225 | ieee80211softmac_notify(mac->dev, IEEE80211SOFTMAC_EVENT_SCAN_FINISHED, ieee80211softmac_assoc_notify, NULL); |
223 | if (ieee80211softmac_start_scan(mac)) | 226 | if (ieee80211softmac_start_scan(mac)) |
224 | dprintk("failed.\n"); | 227 | dprintk(KERN_INFO PFX "Associate: failed to initiate scan. Is device up?\n"); |
225 | else | ||
226 | dprintk("ok.\n"); | ||
227 | return; | 228 | return; |
228 | } | 229 | } |
229 | else { | 230 | else { |
@@ -232,7 +233,7 @@ ieee80211softmac_assoc_work(void *d) | |||
232 | mac->associated = 0; | 233 | mac->associated = 0; |
233 | spin_unlock_irqrestore(&mac->lock, flags); | 234 | spin_unlock_irqrestore(&mac->lock, flags); |
234 | 235 | ||
235 | dprintk(KERN_INFO PFX "Unable to find network after scan!\n"); | 236 | dprintk(KERN_INFO PFX "Unable to find matching network after scan!\n"); |
236 | ieee80211softmac_call_events(mac, IEEE80211SOFTMAC_EVENT_ASSOCIATE_NET_NOT_FOUND, NULL); | 237 | ieee80211softmac_call_events(mac, IEEE80211SOFTMAC_EVENT_ASSOCIATE_NET_NOT_FOUND, NULL); |
237 | return; | 238 | return; |
238 | } | 239 | } |