linux-wireless.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 1/1 v3] cfg80211: wext: fix cfg80211's SIOCSIWAP function
@ 2010-01-29 21:47 shanyu.zhao
  2010-01-29 22:04 ` John W. Linville
  2010-01-30  8:35 ` Johannes Berg
  0 siblings, 2 replies; 7+ messages in thread
From: shanyu.zhao @ 2010-01-29 21:47 UTC (permalink / raw)
  To: linux-wireless; +Cc: Shanyu Zhao

From: Shanyu Zhao <shanyu.zhao@intel.com>

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.

Cc: stable@kernel.org

Signed-off-by: Shanyu Zhao <shanyu.zhao@intel.com>
---
v2: Adding Cc to stable@kernel.org
v3: set bssid to NULL in cfg80211_mgd_wext_siwessid, otherwise after
    iwconfig wlanx ap <mac> the iwconfig wlanx essid won't work.
---
 net/wireless/sme.c      |    9 +++++++--
 net/wireless/wext-sme.c |    4 +++-
 2 files changed, 10 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..5a67dd5 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) {
@@ -194,6 +194,7 @@ int cfg80211_mgd_wext_siwessid(struct net_device *dev,
 	wdev->wext.connect.ssid = wdev->wext.ssid;
 	memcpy(wdev->wext.ssid, ssid, len);
 	wdev->wext.connect.ssid_len = len;
+	wdev->wext.connect.bssid = NULL;
 
 	wdev->wext.connect.crypto.control_port = false;
 
@@ -280,6 +281,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


^ permalink raw reply related	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2010-02-01 20:15 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-01-29 21:47 [PATCH 1/1 v3] cfg80211: wext: fix cfg80211's SIOCSIWAP function shanyu.zhao
2010-01-29 22:04 ` John W. Linville
2010-01-30  8:35 ` Johannes Berg
2010-01-30  8:43   ` Johannes Berg
2010-01-31  5:24     ` Zhao, Shanyu
2010-01-31 10:31       ` Johannes Berg
2010-02-01 20:12   ` John W. Linville

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).