Commit 25e83c49 authored by Johannes Berg's avatar Johannes Berg Committed by John W. Linville

cfg80211: don't optimise wext calls too much

In the wext code I tried to not reconnect all the time
when the user wasn't really sure what they were doing,
like setting the BSSID back to the same value it was.
However, this optimisation should only be done while
associated so that setting the BSSID back to the same
value that it was actually triggers a new association
if not currently associated. To achieve, that, put the
relevant code into the !IDLE case instead.
Signed-off-by: default avatarJohannes Berg <johannes@sipsolutions.net>
Tested-by: default avatarKalle Valo <kalle.valo@iki.fi>
Tested-by: default avatarMarcel Holtmann <marcel@holtmann.org>
Signed-off-by: default avatarJohn W. Linville <linville@tuxdriver.com>
parent d4b1a687
...@@ -72,13 +72,14 @@ int cfg80211_mgd_wext_siwfreq(struct net_device *dev, ...@@ -72,13 +72,14 @@ int cfg80211_mgd_wext_siwfreq(struct net_device *dev,
cfg80211_lock_rdev(rdev); cfg80211_lock_rdev(rdev);
wdev_lock(wdev); wdev_lock(wdev);
if (wdev->sme_state != CFG80211_SME_IDLE) {
bool event = true;
if (wdev->wext.connect.channel == chan) { if (wdev->wext.connect.channel == chan) {
err = 0; err = 0;
goto out; goto out;
} }
if (wdev->sme_state != CFG80211_SME_IDLE) {
bool event = true;
/* if SSID set, we'll try right again, avoid event */ /* if SSID set, we'll try right again, avoid event */
if (wdev->wext.connect.ssid_len) if (wdev->wext.connect.ssid_len)
event = false; event = false;
...@@ -164,13 +165,14 @@ int cfg80211_mgd_wext_siwessid(struct net_device *dev, ...@@ -164,13 +165,14 @@ int cfg80211_mgd_wext_siwessid(struct net_device *dev,
err = 0; err = 0;
if (wdev->sme_state != CFG80211_SME_IDLE) {
bool event = true;
if (wdev->wext.connect.ssid && len && if (wdev->wext.connect.ssid && len &&
len == wdev->wext.connect.ssid_len && len == wdev->wext.connect.ssid_len &&
memcmp(wdev->wext.connect.ssid, ssid, len) == 0) memcmp(wdev->wext.connect.ssid, ssid, len) == 0)
goto out; goto out;
if (wdev->sme_state != CFG80211_SME_IDLE) {
bool event = true;
/* if SSID set now, we'll try to connect, avoid event */ /* if SSID set now, we'll try to connect, avoid event */
if (len) if (len)
event = false; event = false;
...@@ -244,6 +246,7 @@ int cfg80211_mgd_wext_siwap(struct net_device *dev, ...@@ -244,6 +246,7 @@ int cfg80211_mgd_wext_siwap(struct net_device *dev,
cfg80211_lock_rdev(wiphy_to_dev(wdev->wiphy)); cfg80211_lock_rdev(wiphy_to_dev(wdev->wiphy));
wdev_lock(wdev); wdev_lock(wdev);
if (wdev->sme_state != CFG80211_SME_IDLE) {
err = 0; err = 0;
/* both automatic */ /* both automatic */
if (!bssid && !wdev->wext.connect.bssid) if (!bssid && !wdev->wext.connect.bssid)
...@@ -254,7 +257,6 @@ int cfg80211_mgd_wext_siwap(struct net_device *dev, ...@@ -254,7 +257,6 @@ int cfg80211_mgd_wext_siwap(struct net_device *dev,
compare_ether_addr(bssid, wdev->wext.connect.bssid) == 0) compare_ether_addr(bssid, wdev->wext.connect.bssid) == 0)
goto out; goto out;
if (wdev->sme_state != CFG80211_SME_IDLE) {
err = __cfg80211_disconnect(wiphy_to_dev(wdev->wiphy), err = __cfg80211_disconnect(wiphy_to_dev(wdev->wiphy),
dev, WLAN_REASON_DEAUTH_LEAVING, dev, WLAN_REASON_DEAUTH_LEAVING,
false); false);
......
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