2014-07-12  Bernd Edlinger  <bernd.edlinger@hotmail.de>

	Fix WiFi connectivity problems.
	* nm-device-wifi.c (WPAS_REMOVED_TAG): Moved upwards.
	(merge_scanned_ap): Clear removed tag.
	(supplicant_iface_bss_removed_cb): Update time stamp.

--- network-manager-0.9.4.0.orig/src/nm-device-wifi.c	2013-06-21 01:41:52.000000000 +0200
+++ network-manager-0.9.4.0/src/nm-device-wifi.c	2013-06-21 02:39:53.000000000 +0200
@@ -1661,6 +1661,7 @@
 
 #define MAC_FMT "%02x:%02x:%02x:%02x:%02x:%02x"
 #define MAC_ARG(x) ((guint8*)(x))[0],((guint8*)(x))[1],((guint8*)(x))[2],((guint8*)(x))[3],((guint8*)(x))[4],((guint8*)(x))[5]
+#define WPAS_REMOVED_TAG "supplicant-removed"
 
 /*
  * merge_scanned_ap
@@ -1743,6 +1744,7 @@ merge_scanned_ap (NMDeviceWifi *self,
 		 * fake, since it clearly exists somewhere.
 		 */
 		nm_ap_set_fake (found_ap, FALSE);
+		g_object_set_data (G_OBJECT (found_ap), WPAS_REMOVED_TAG, NULL);
 	} else {
 		/* New entry in the list */
 		nm_log_dbg (LOGD_WIFI_SCAN, "(%s): adding new AP '%s' " MAC_FMT " (%p)",
@@ -1758,8 +1760,6 @@
 	}
 }
 
-#define WPAS_REMOVED_TAG "supplicant-removed"
-
 static gboolean
 cull_scan_list (NMDeviceWifi *self)
 {
@@ -1915,13 +1915,17 @@ supplicant_iface_bss_removed_cb (NMSupplicantInterface
                                  NMDeviceWifi *self)
 {
 	NMAccessPoint *ap;
+	GTimeVal now;
 
 	g_return_if_fail (self != NULL);
 	g_return_if_fail (object_path != NULL);
 
 	ap = get_ap_by_supplicant_path (self, object_path);
-	if (ap)
+	if (ap) {
+		g_get_current_time (&now);
+		nm_ap_set_last_seen (ap, now.tv_sec);
 		g_object_set_data (G_OBJECT (ap), WPAS_REMOVED_TAG, GUINT_TO_POINTER (TRUE));
+	}
 }
 
 
