2010-01-29 18:02:17

by Zhao, Shanyu

[permalink] [raw]
Subject: [PATCH 1/1] cfg80211: wext: fix cfg80211's SIOCSIWAP function

From: Shanyu Zhao <[email protected]>

The cfg80211's SIOCSIWAP function is broken, the reason is we cannot
get the correct bss with previously set ssid. Need to clear it by
setting ssid_len to 0 in cfg80211_mgd_wext_siwap() and fix other
places accordingly.

Signed-off-by: Shanyu Zhao <[email protected]>
---
net/wireless/sme.c | 9 +++++++--
net/wireless/wext-sme.c | 3 ++-
2 files changed, 9 insertions(+), 3 deletions(-)

diff --git a/net/wireless/sme.c b/net/wireless/sme.c
index 745c37e..51c3cdb 100644
--- a/net/wireless/sme.c
+++ b/net/wireless/sme.c
@@ -779,10 +779,15 @@ int __cfg80211_connect(struct cfg80211_registered_device *rdev,
wdev->conn->auto_auth = false;
}

- memcpy(wdev->ssid, connect->ssid, connect->ssid_len);
+ /* make sure it can connect if only bssid is provided */
wdev->ssid_len = connect->ssid_len;
- wdev->conn->params.ssid = wdev->ssid;
wdev->conn->params.ssid_len = connect->ssid_len;
+ if (connect->ssid_len) {
+ memcpy(wdev->ssid, connect->ssid, connect->ssid_len);
+ wdev->conn->params.ssid = wdev->ssid;
+ }
+ else
+ wdev->conn->params.ssid = NULL;

/* see if we have the bss already */
bss = cfg80211_get_conn_bss(wdev);
diff --git a/net/wireless/wext-sme.c b/net/wireless/wext-sme.c
index 5615a88..eede356 100644
--- a/net/wireless/wext-sme.c
+++ b/net/wireless/wext-sme.c
@@ -34,7 +34,7 @@ int cfg80211_mgd_wext_connect(struct cfg80211_registered_device *rdev,
wdev->wext.connect.privacy = true;
}

- if (!wdev->wext.connect.ssid_len)
+ if (!wdev->wext.connect.ssid_len && !wdev->wext.connect.bssid)
return 0;

if (wdev->wext.keys) {
@@ -280,6 +280,7 @@ int cfg80211_mgd_wext_siwap(struct net_device *dev,
if (bssid) {
memcpy(wdev->wext.bssid, bssid, ETH_ALEN);
wdev->wext.connect.bssid = wdev->wext.bssid;
+ wdev->wext.connect.ssid_len = 0;
} else
wdev->wext.connect.bssid = NULL;

--
1.6.0.4



2010-01-29 18:08:27

by Luis R. Rodriguez

[permalink] [raw]
Subject: Re: [PATCH 1/1] cfg80211: wext: fix cfg80211's SIOCSIWAP function

On Fri, Jan 29, 2010 at 10:02 AM, <[email protected]> wrote:
> From: Shanyu Zhao <[email protected]>
>
> The cfg80211's SIOCSIWAP function is broken, the reason is we cannot
> get the correct bss with previously set ssid. Need to clear it by
> setting ssid_len to 0 in cfg80211_mgd_wext_siwap() and fix other
> places accordingly.

Is this a stable fix as well?

Luis