Hi !
When I'm using
* wpa_supplicant
* a static WEP network block
* wext-compat in linux-wl
I always get two errors when roaming (that is, not at the first
connection):
1252921234.926116: CTRL-EVENT-SCAN-RESULTS
1252921234.926185: 0: 00:13:19:80:da:30 ssid=MNFUNK q70/0/217 e-1
1252921234.926208: 1: 00:1b:d4:44:35:90 ssid=MNWPA q49/0/195 e-1
1252921234.926227: 2: 00:1b:53:11:dc:40 ssid=MNFUNK q46/0/192 e-1
1252921234.926255: Trying to associate with 00:13:19:80:da:30 (SSID='MNFUNK' freq=2437 MHz)
1252921234.927327: sock 3, ifname eth1
1252921235.060073: Associated with 00:13:19:80:da:30
1252921235.060090: CTRL-EVENT-CONNECTED - Connection to 00:13:19:80:da:30 completed (auth)
1252921275.106101: ROAM: search for a better AP
1252921276.182124: CTRL-EVENT-SCAN-RESULTS
1252921276.182148: 0: 00:1b:53:11:dc:40 ssid=MNFUNK q67/0/213 e-1
1252921276.182170: 1: 00:1b:d4:44:35:90 ssid=MNWPA q60/0/206 e-1
1252921276.182189: 2: 00:13:19:80:da:30 ssid=MNFUNK q53/0/199 e-1
1252921276.182218: Trying to associate with 00:1b:53:11:dc:40 (SSID='MNFUNK' freq=2412 MHz)
1252921276.184336: sock 3, ifname eth1
ioctl[SIOCSIWFREQ]: No such file or directory
ioctl[SIOCSIWESSID]: No such file or directory
1252921276.268451: Association request to the driver failed
1252921276.268477: CTRL-EVENT-DISCONNECTED - Disconnect event - remove keys
1252921276.355482: Associated with 00:1b:53:11:dc:40
I traced this down a bit into wext-sme.c, cfg80211_mgd_wext_siwfreq().
This function run's cfg80211_mgd_wext_connect() and this function
returns -2.
Isn't this a bit fishy? Why should a connect function be called
when user-space wants to changes the frequency? And if for some
reason this is really helpful/necessary, why return the failure
to do so as an error result back to the original "just change the
frequency" call?
In the end, this here:
1252921276.268451: Association request to the driver failed
1252921276.355482: Associated with 00:1b:53:11:dc:40
looks quite contradicting :-/
--
http://www.holgerschurig.de
On Mon, 2009-09-14 at 13:23 +0200, Holger Schurig wrote:
> Signed-off-by: Holger Schurig <[email protected]>
>
> ---
>
> This fixes
>
> 1252921276.182218: Trying to associate with 00:1b:53:11:dc:40 (SSID='TEST' freq=2412 MHz)
> ioctl[SIOCSIWFREQ]: No such file or directory
> ioctl[SIOCSIWESSID]: No such file or directory
> 1252921276.268451: Association request to the driver failed
> 1252921276.355482: Associated with 00:1b:53:11:dc:40
>
> and makes it
>
> 1252921276.182218: Trying to associate with 00:1b:53:11:dc:40 (SSID='TEST' freq=2412 MHz)
> 1252921276.355482: Associated with 00:1b:53:11:dc:40
>
> However, otherwise this hasn't been greatly tested and I
> don't have a great understanding of cfg80211, SME, etc ...
And doesn't look correct to me at all. probably something missing wrt.
disconnect() while connecting.
johannes
> Index: linux-wl/net/wireless/wext-sme.c
> ===================================================================
> --- linux-wl.orig/net/wireless/wext-sme.c 2009-09-14 12:05:54.000000000 +0200
> +++ linux-wl/net/wireless/wext-sme.c 2009-09-14 12:06:09.000000000 +0200
> @@ -110,7 +110,7 @@ int cfg80211_mgd_wext_siwfreq(struct net
> goto out;
> }
>
> - err = cfg80211_mgd_wext_connect(rdev, wdev);
> + cfg80211_mgd_wext_connect(rdev, wdev);
> out:
> wdev_unlock(wdev);
> mutex_unlock(&rdev->devlist_mtx);
> @@ -196,7 +196,7 @@ int cfg80211_mgd_wext_siwessid(struct ne
>
> wdev->wext.connect.crypto.control_port = false;
>
> - err = cfg80211_mgd_wext_connect(rdev, wdev);
> + cfg80211_mgd_wext_connect(rdev, wdev);
> out:
> wdev_unlock(wdev);
> mutex_unlock(&rdev->devlist_mtx);
> @@ -283,7 +283,7 @@ int cfg80211_mgd_wext_siwap(struct net_d
> } else
> wdev->wext.connect.bssid = NULL;
>
> - err = cfg80211_mgd_wext_connect(rdev, wdev);
> + cfg80211_mgd_wext_connect(rdev, wdev);
> out:
> wdev_unlock(wdev);
> mutex_unlock(&rdev->devlist_mtx);
>
> And doesn't look correct to me at all. probably something
> missing wrt. disconnect() while connecting.
Can you then outline the right solution ?
--
http://www.holgerschurig.de
Signed-off-by: Holger Schurig <[email protected]>
---
This fixes
1252921276.182218: Trying to associate with 00:1b:53:11:dc:40 (SSID='TEST' freq=2412 MHz)
ioctl[SIOCSIWFREQ]: No such file or directory
ioctl[SIOCSIWESSID]: No such file or directory
1252921276.268451: Association request to the driver failed
1252921276.355482: Associated with 00:1b:53:11:dc:40
and makes it
1252921276.182218: Trying to associate with 00:1b:53:11:dc:40 (SSID='TEST' freq=2412 MHz)
1252921276.355482: Associated with 00:1b:53:11:dc:40
However, otherwise this hasn't been greatly tested and I
don't have a great understanding of cfg80211, SME, etc ...
Index: linux-wl/net/wireless/wext-sme.c
===================================================================
--- linux-wl.orig/net/wireless/wext-sme.c 2009-09-14 12:05:54.000000000 +0200
+++ linux-wl/net/wireless/wext-sme.c 2009-09-14 12:06:09.000000000 +0200
@@ -110,7 +110,7 @@ int cfg80211_mgd_wext_siwfreq(struct net
goto out;
}
- err = cfg80211_mgd_wext_connect(rdev, wdev);
+ cfg80211_mgd_wext_connect(rdev, wdev);
out:
wdev_unlock(wdev);
mutex_unlock(&rdev->devlist_mtx);
@@ -196,7 +196,7 @@ int cfg80211_mgd_wext_siwessid(struct ne
wdev->wext.connect.crypto.control_port = false;
- err = cfg80211_mgd_wext_connect(rdev, wdev);
+ cfg80211_mgd_wext_connect(rdev, wdev);
out:
wdev_unlock(wdev);
mutex_unlock(&rdev->devlist_mtx);
@@ -283,7 +283,7 @@ int cfg80211_mgd_wext_siwap(struct net_d
} else
wdev->wext.connect.bssid = NULL;
- err = cfg80211_mgd_wext_connect(rdev, wdev);
+ cfg80211_mgd_wext_connect(rdev, wdev);
out:
wdev_unlock(wdev);
mutex_unlock(&rdev->devlist_mtx);
--
http://www.holgerschurig.de
On Tue, 2009-09-15 at 08:21 +0200, Holger Schurig wrote:
> > And doesn't look correct to me at all. probably something
> > missing wrt. disconnect() while connecting.
>
> Can you then outline the right solution ?
Try this please.
johannes
--- wireless-testing.orig/net/wireless/sme.c 2009-09-15 21:33:41.000000000 -0700
+++ wireless-testing/net/wireless/sme.c 2009-09-15 21:37:58.000000000 -0700
@@ -188,7 +188,7 @@ void cfg80211_conn_work(struct work_stru
rtnl_unlock();
}
-static bool cfg80211_get_conn_bss(struct wireless_dev *wdev)
+static struct cfg80211_bss *cfg80211_get_conn_bss(struct wireless_dev *wdev)
{
struct cfg80211_registered_device *rdev = wiphy_to_dev(wdev->wiphy);
struct cfg80211_bss *bss;
@@ -205,7 +205,7 @@ static bool cfg80211_get_conn_bss(struct
WLAN_CAPABILITY_ESS | WLAN_CAPABILITY_PRIVACY,
capa);
if (!bss)
- return false;
+ return NULL;
memcpy(wdev->conn->bssid, bss->bssid, ETH_ALEN);
wdev->conn->params.bssid = wdev->conn->bssid;
@@ -213,14 +213,14 @@ static bool cfg80211_get_conn_bss(struct
wdev->conn->state = CFG80211_CONN_AUTHENTICATE_NEXT;
schedule_work(&rdev->conn_work);
- cfg80211_put_bss(bss);
- return true;
+ return bss;
}
static void __cfg80211_sme_scan_done(struct net_device *dev)
{
struct wireless_dev *wdev = dev->ieee80211_ptr;
struct cfg80211_registered_device *rdev = wiphy_to_dev(wdev->wiphy);
+ struct cfg80211_bss *bss;
ASSERT_WDEV_LOCK(wdev);
@@ -234,7 +234,10 @@ static void __cfg80211_sme_scan_done(str
wdev->conn->state != CFG80211_CONN_SCAN_AGAIN)
return;
- if (!cfg80211_get_conn_bss(wdev)) {
+ bss = cfg80211_get_conn_bss(wdev);
+ if (bss) {
+ cfg80211_put_bss(bss);
+ } else {
/* not found */
if (wdev->conn->state == CFG80211_CONN_SCAN_AGAIN)
schedule_work(&rdev->conn_work);
@@ -670,6 +673,7 @@ int __cfg80211_connect(struct cfg80211_r
{
struct wireless_dev *wdev = dev->ieee80211_ptr;
struct ieee80211_channel *chan;
+ struct cfg80211_bss *bss = NULL;
int err;
ASSERT_WDEV_LOCK(wdev);
@@ -760,7 +764,7 @@ int __cfg80211_connect(struct cfg80211_r
/* don't care about result -- but fill bssid & channel */
if (!wdev->conn->params.bssid || !wdev->conn->params.channel)
- cfg80211_get_conn_bss(wdev);
+ bss = cfg80211_get_conn_bss(wdev);
wdev->sme_state = CFG80211_SME_CONNECTING;
wdev->connect_keys = connkeys;
@@ -770,10 +774,11 @@ int __cfg80211_connect(struct cfg80211_r
wdev->conn->prev_bssid_valid = true;
}
- /* we're good if we have both BSSID and channel */
- if (wdev->conn->params.bssid && wdev->conn->params.channel) {
+ /* we're good if we have a matching bss struct */
+ if (bss) {
wdev->conn->state = CFG80211_CONN_AUTHENTICATE_NEXT;
err = cfg80211_conn_do_work(wdev);
+ cfg80211_put_bss(bss);
} else {
/* otherwise we'll need to scan for the AP first */
err = cfg80211_conn_scan(wdev);
> Try this please.
Tested-by: Holger Schurig <[email protected]>
Works fine :-)