Commit efe870f9 authored by Larry Finger's avatar Larry Finger Committed by John W. Linville

[PATCH] softmac: Fix inability to associate with WEP networks

Commit 4cf92a3c was submitted as a fix for bug #8686 at bugzilla.kernel.org
(http://bugzilla.kernel.org/show_bug.cgi?id=8686). Unfortunately, the fix led to
a new bug, reported by Yoshifuji Hideaki, that prevented association for WEP
encrypted networks that use ifconfig to control the device. This patch effectively
reverts the earlier commit and does a proper fix for bug #8686.
Signed-off-by: default avatarLarry Finger <Larry.Finger@lwfinger.net>
Signed-off-by: default avatarJohn W. Linville <linville@tuxdriver.com>
parent 81cfe79b
...@@ -273,8 +273,6 @@ ieee80211softmac_assoc_work(struct work_struct *work) ...@@ -273,8 +273,6 @@ ieee80211softmac_assoc_work(struct work_struct *work)
ieee80211softmac_notify(mac->dev, IEEE80211SOFTMAC_EVENT_SCAN_FINISHED, ieee80211softmac_assoc_notify_scan, NULL); ieee80211softmac_notify(mac->dev, IEEE80211SOFTMAC_EVENT_SCAN_FINISHED, ieee80211softmac_assoc_notify_scan, NULL);
if (ieee80211softmac_start_scan(mac)) { if (ieee80211softmac_start_scan(mac)) {
dprintk(KERN_INFO PFX "Associate: failed to initiate scan. Is device up?\n"); dprintk(KERN_INFO PFX "Associate: failed to initiate scan. Is device up?\n");
mac->associnfo.associating = 0;
mac->associnfo.associated = 0;
} }
goto out; goto out;
} else { } else {
......
...@@ -70,44 +70,30 @@ ieee80211softmac_wx_set_essid(struct net_device *net_dev, ...@@ -70,44 +70,30 @@ ieee80211softmac_wx_set_essid(struct net_device *net_dev,
char *extra) char *extra)
{ {
struct ieee80211softmac_device *sm = ieee80211_priv(net_dev); struct ieee80211softmac_device *sm = ieee80211_priv(net_dev);
struct ieee80211softmac_network *n;
struct ieee80211softmac_auth_queue_item *authptr; struct ieee80211softmac_auth_queue_item *authptr;
int length = 0; int length = 0;
check_assoc_again: check_assoc_again:
mutex_lock(&sm->associnfo.mutex); mutex_lock(&sm->associnfo.mutex);
/* Check if we're already associating to this or another network
* If it's another network, cancel and start over with our new network
* If it's our network, ignore the change, we're already doing it!
*/
if((sm->associnfo.associating || sm->associnfo.associated) && if((sm->associnfo.associating || sm->associnfo.associated) &&
(data->essid.flags && data->essid.length)) { (data->essid.flags && data->essid.length)) {
/* Get the associating network */ dprintk(KERN_INFO PFX "Canceling existing associate request!\n");
n = ieee80211softmac_get_network_by_bssid(sm, sm->associnfo.bssid); /* Cancel assoc work */
if(n && n->essid.len == data->essid.length && cancel_delayed_work(&sm->associnfo.work);
!memcmp(n->essid.data, extra, n->essid.len)) { /* We don't have to do this, but it's a little cleaner */
dprintk(KERN_INFO PFX "Already associating or associated to "MAC_FMT"\n", list_for_each_entry(authptr, &sm->auth_queue, list)
MAC_ARG(sm->associnfo.bssid)); cancel_delayed_work(&authptr->work);
goto out; sm->associnfo.bssvalid = 0;
} else { sm->associnfo.bssfixed = 0;
dprintk(KERN_INFO PFX "Canceling existing associate request!\n"); sm->associnfo.associating = 0;
/* Cancel assoc work */ sm->associnfo.associated = 0;
cancel_delayed_work(&sm->associnfo.work); /* We must unlock to avoid deadlocks with the assoc workqueue
/* We don't have to do this, but it's a little cleaner */ * on the associnfo.mutex */
list_for_each_entry(authptr, &sm->auth_queue, list) mutex_unlock(&sm->associnfo.mutex);
cancel_delayed_work(&authptr->work); flush_scheduled_work();
sm->associnfo.bssvalid = 0; /* Avoid race! Check assoc status again. Maybe someone started an
sm->associnfo.bssfixed = 0; * association while we flushed. */
sm->associnfo.associating = 0; goto check_assoc_again;
sm->associnfo.associated = 0;
/* We must unlock to avoid deadlocks with the assoc workqueue
* on the associnfo.mutex */
mutex_unlock(&sm->associnfo.mutex);
flush_scheduled_work();
/* Avoid race! Check assoc status again. Maybe someone started an
* association while we flushed. */
goto check_assoc_again;
}
} }
sm->associnfo.static_essid = 0; sm->associnfo.static_essid = 0;
...@@ -153,13 +139,13 @@ ieee80211softmac_wx_get_essid(struct net_device *net_dev, ...@@ -153,13 +139,13 @@ ieee80211softmac_wx_get_essid(struct net_device *net_dev,
data->essid.length = sm->associnfo.req_essid.len; data->essid.length = sm->associnfo.req_essid.len;
data->essid.flags = 1; /* active */ data->essid.flags = 1; /* active */
memcpy(extra, sm->associnfo.req_essid.data, sm->associnfo.req_essid.len); memcpy(extra, sm->associnfo.req_essid.data, sm->associnfo.req_essid.len);
} dprintk(KERN_INFO PFX "Getting essid from req_essid\n");
} else if (sm->associnfo.associated || sm->associnfo.associating) {
/* If we're associating/associated, return that */ /* If we're associating/associated, return that */
if (sm->associnfo.associated || sm->associnfo.associating) {
data->essid.length = sm->associnfo.associate_essid.len; data->essid.length = sm->associnfo.associate_essid.len;
data->essid.flags = 1; /* active */ data->essid.flags = 1; /* active */
memcpy(extra, sm->associnfo.associate_essid.data, sm->associnfo.associate_essid.len); memcpy(extra, sm->associnfo.associate_essid.data, sm->associnfo.associate_essid.len);
dprintk(KERN_INFO PFX "Getting essid from associate_essid\n");
} }
mutex_unlock(&sm->associnfo.mutex); mutex_unlock(&sm->associnfo.mutex);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment