summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDan Williams <dcbw@redhat.com>2012-05-02 17:16:35 -0500
committerDan Williams <dcbw@redhat.com>2012-05-04 13:48:54 -0500
commit0e262e04e1800f312d4c40c07b6394ffacb2d34d (patch)
treea7ab739fbe8a760944cb3bec9881ed4f09616591
parent565d1e25578bdfc3cec284e3483c89657ae8671d (diff)
wifi: work around some scan failures at startup
mac80211 drivers don't like being asked to scan when they are already scanning, and it's pretty impossible to not race with internal supplicant scanning. NM requests a scan immediately after the supplicant interface gets created, and that scan request usually succeeds. But since the supplicant's scan request method returns when the kernel *starts* the scan, not when the scan is finished, a second scan that NM would immediately request in request_wireless_scan() would often fail as the card was already scanning. The second scan was requested immediately becuase the SCAN_INTERVAL_MIN was zero, which was set to zero to intentionally request two scans to work around drivers that would fail the first scan because they are stupid. Well, let's just penalize stupid drivers by *possibly* making the initial connection take a few more seconds due to the change of SCAN_INTERVAL_MIN. But what we're really doing here is not asking for the second scan right after the first one is requested, since that will almost always fail for most drivers, but request the second one after the supplicant says the scan is done. Second, if for some reason the supplicant reports that the scan failed, don't make the next scan take longer; just queue it up without backing off so we can retry the scan sooner.
-rw-r--r--src/nm-device-wifi.c5
1 files changed, 2 insertions, 3 deletions
diff --git a/src/nm-device-wifi.c b/src/nm-device-wifi.c
index f44eb3becc..ad1cfe396f 100644
--- a/src/nm-device-wifi.c
+++ b/src/nm-device-wifi.c
@@ -68,7 +68,7 @@ static gboolean impl_device_get_access_points (NMDeviceWifi *device,
/* All of these are in seconds */
-#define SCAN_INTERVAL_MIN 0
+#define SCAN_INTERVAL_MIN 3
#define SCAN_INTERVAL_STEP 20
#define SCAN_INTERVAL_MAX 120
@@ -1724,8 +1724,7 @@ supplicant_iface_scan_done_cb (NMSupplicantInterface *iface,
nm_device_get_iface (NM_DEVICE (self)),
success ? "successful" : "failed");
- if (check_scanning_allowed (self))
- schedule_scan (self, TRUE);
+ schedule_scan (self, success);
/* Ensure that old APs get removed, which otherwise only
* happens when there are new BSSes.