Re: [PATCH] wifi: don't remove AP upon link lost event



On Thu, 2013-05-09 at 17:46 -0400, Daniel Drake wrote:
When the link is lost, it doesn't mean that the AP has gone away.
It might just be overloaded or have rejected an association attempt
for an temporary reason.

The behaviour described in the comment removed here was not true
in such circumstances. As the supplicant never "loses sight" of the AP,
further scans will not generate "new BSS" signals for this AP, which is
what would be needed for the the AP to be found again in the next scan.

Instead, just leave the AP in the list and trust wpa_supplicant to handle
this case.

So the code in link_timeout_cb() only gets run when the wifi device is
already connected and then somehow gets disconnected.  Were you hitting
this issue while connected to the AP, getting disconnected, and then the
AP rejected the reconnect?

This patch will break the AP-out-of-range or AP-turned-off cases; so
instead of your patch, does this one fix your issue?  We're already
tracking whether or not the supplicant can talk to the AP, and the AP
shouldn't be rejecting you during the AUTH phase, just the ASSOC phase.
So with this patch, if when the supplicant reconnects it's able to get
to the ASSOC phase, the AP shouldn't get removed from the list on link
timeout.

Dan

diff --git a/src/devices/nm-device-wifi.c b/src/devices/nm-device-wifi.c
index 2b8ddd1..e9c319a 100644
--- a/src/devices/nm-device-wifi.c
+++ b/src/devices/nm-device-wifi.c
@@ -2171,7 +2172,7 @@ link_timeout_cb (gpointer user_data)
 
        nm_log_warn (LOGD_WIFI, "(%s): link timed out.", nm_device_get_iface (dev));
 
-       NM_DEVICE_WIFI_GET_PRIVATE (dev)->link_timeout_id = 0;
+       priv->link_timeout_id = 0;
 
        /* Disconnect event while activated; the supplicant hasn't been able
         * to reassociate within the timeout period, so the connection must
@@ -2180,18 +2181,21 @@ link_timeout_cb (gpointer user_data)
        if (nm_device_get_state (dev) != NM_DEVICE_STATE_ACTIVATED)
                return FALSE;
 
-       /* Remove whatever access point we used to be connected to from the list
-        * since it failed and might no longer be visible.  If it's actually still
-        * there, we'll find it in the next scan.
+       /* If the access point failed, and wasn't found by the supplicant when it
+        * attempted to reconnect, then it's probably out of range or turned off.
+        * Remove it from the list and if it's actually still present, it'll be
+        * found in the next scan.
         */
-       if (priv->current_ap) {
-               ap = priv->current_ap;
-               priv->current_ap = NULL;
-       } else
-               ap = nm_device_wifi_get_activation_ap (self);
+       if (priv->ssid_found == FALSE) {
+               if (priv->current_ap) {
+                       ap = priv->current_ap;
+                       priv->current_ap = NULL;
+               } else
+                       ap = nm_device_wifi_get_activation_ap (self);
 
-       if (ap)
-               remove_access_point (self, ap, TRUE);
+               if (ap)
+                       remove_access_point (self, ap, TRUE);
+       }
 
        nm_device_state_changed (dev,
                                 NM_DEVICE_STATE_FAILED,



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]