aboutsummaryrefslogtreecommitdiffstats
path: root/net/ieee80211/softmac/ieee80211softmac_assoc.c
diff options
context:
space:
mode:
authorJohannes Berg <johannes@sipsolutions.net>2006-04-20 14:02:03 -0400
committerJohn W. Linville <linville@tuxdriver.com>2006-04-24 15:20:23 -0400
commit818667f7c40dd0bd14029b5ac1d0f5282e12310e (patch)
treef270cfb4caeb26bceec7ea61ba93e268eae57324 /net/ieee80211/softmac/ieee80211softmac_assoc.c
parentdac322e39a2b82871cf514c9a533f24a1b4c7e19 (diff)
[PATCH] softmac: fix SIOCSIWAP
There are some bugs in the current implementation of the SIOCSIWAP wext, for example that when you do it twice and it fails, it may still try another access point for some reason. This patch fixes this by introducing a new flag that tells the association code that the bssid that is in use was fixed by the user and shouldn't be deviated from. Signed-off-by: Johannes Berg <johannes@sipsolutions.net> Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'net/ieee80211/softmac/ieee80211softmac_assoc.c')
-rw-r--r--net/ieee80211/softmac/ieee80211softmac_assoc.c20
1 files changed, 16 insertions, 4 deletions
diff --git a/net/ieee80211/softmac/ieee80211softmac_assoc.c b/net/ieee80211/softmac/ieee80211softmac_assoc.c
index 4498023841dc..fb79ce7d6439 100644
--- a/net/ieee80211/softmac/ieee80211softmac_assoc.c
+++ b/net/ieee80211/softmac/ieee80211softmac_assoc.c
@@ -144,6 +144,12 @@ network_matches_request(struct ieee80211softmac_device *mac, struct ieee80211_ne
144 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))
145 return 0; 145 return 0;
146 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
147 /* 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 */
148 if (mac->associnfo.req_essid.len == 0 154 if (mac->associnfo.req_essid.len == 0
149 && !(net->capability & WLAN_CAPABILITY_PRIVACY)) 155 && !(net->capability & WLAN_CAPABILITY_PRIVACY))
@@ -176,7 +182,7 @@ ieee80211softmac_assoc_work(void *d)
176 ieee80211softmac_disassoc(mac, WLAN_REASON_DISASSOC_STA_HAS_LEFT); 182 ieee80211softmac_disassoc(mac, WLAN_REASON_DISASSOC_STA_HAS_LEFT);
177 183
178 /* 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 */
179 if (mac->associnfo.bssvalid) 185 if (mac->associnfo.bssvalid || mac->associnfo.bssfixed)
180 found = ieee80211softmac_get_network_by_bssid(mac, mac->associnfo.bssid); 186 found = ieee80211softmac_get_network_by_bssid(mac, mac->associnfo.bssid);
181 187
182 /* 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,
@@ -241,19 +247,25 @@ ieee80211softmac_assoc_work(void *d)
241 if (ieee80211softmac_start_scan(mac)) 247 if (ieee80211softmac_start_scan(mac))
242 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");
243 return; 249 return;
244 } 250 } else {
245 else {
246 spin_lock_irqsave(&mac->lock, flags); 251 spin_lock_irqsave(&mac->lock, flags);
247 mac->associnfo.associating = 0; 252 mac->associnfo.associating = 0;
248 mac->associated = 0; 253 mac->associated = 0;
249 spin_unlock_irqrestore(&mac->lock, flags); 254 spin_unlock_irqrestore(&mac->lock, flags);
250 255
251 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;
252 ieee80211softmac_call_events(mac, IEEE80211SOFTMAC_EVENT_ASSOCIATE_NET_NOT_FOUND, NULL); 260 ieee80211softmac_call_events(mac, IEEE80211SOFTMAC_EVENT_ASSOCIATE_NET_NOT_FOUND, NULL);
253 return; 261 return;
254 } 262 }
255 } 263 }
256 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;
257 mac->associnfo.bssvalid = 1; 269 mac->associnfo.bssvalid = 1;
258 memcpy(mac->associnfo.bssid, found->bssid, ETH_ALEN); 270 memcpy(mac->associnfo.bssid, found->bssid, ETH_ALEN);
259 /* copy the ESSID for displaying it */ 271 /* copy the ESSID for displaying it */