summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBernd Edlinger <bernd.edlinger@hotmail.de>2014-07-15 12:25:25 -0500
committerDan Williams <dcbw@redhat.com>2014-07-15 15:32:52 -0500
commit6f3a4842ddc989f47ae606c256790cb41d4ba148 (patch)
tree969a24d37e0fe3ffa1f10440219b475414176f30
parent49463a9e7b740af76071826e066e76f088d2e116 (diff)
downloadNetworkManager-6f3a4842ddc989f47ae606c256790cb41d4ba148.tar.gz
wifi: fix restarted AP not being found again (bgo #733105)dcbw/remove-ap
If the supplicant removes an AP, WPAS_REMOVED_TAG is set for the AP and it becomes available for NM to delete when it reaches the max age. But if the AP is found again before being deleted, the tag is not reset and the AP could be deleted prematurely. https://bugzilla.gnome.org/show_bug.cgi?id=733105
-rw-r--r--src/devices/wifi/nm-device-wifi.c25
1 files changed, 19 insertions, 6 deletions
diff --git a/src/devices/wifi/nm-device-wifi.c b/src/devices/wifi/nm-device-wifi.c
index 38fc7ca55e..537d94306b 100644
--- a/src/devices/wifi/nm-device-wifi.c
+++ b/src/devices/wifi/nm-device-wifi.c
@@ -1702,6 +1702,8 @@ try_fill_ssid_for_hidden_ap (NMAccessPoint *ap)
#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
*
@@ -1777,10 +1779,9 @@ merge_scanned_ap (NMDeviceWifi *self,
nm_ap_set_freq (found_ap, nm_ap_get_freq (merge_ap));
nm_ap_set_max_bitrate (found_ap, nm_ap_get_max_bitrate (merge_ap));
- /* If the AP is noticed in a scan, it's automatically no longer
- * fake, since it clearly exists somewhere.
- */
+ /* A scanned AP is obviously not fake and known to the supplicant. */
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)",
@@ -1796,8 +1797,6 @@ merge_scanned_ap (NMDeviceWifi *self,
}
}
-#define WPAS_REMOVED_TAG "supplicant-removed"
-
static gboolean
cull_scan_list (NMDeviceWifi *self)
{
@@ -1960,8 +1959,22 @@ supplicant_iface_bss_removed_cb (NMSupplicantInterface *iface,
g_return_if_fail (object_path != NULL);
ap = get_ap_by_supplicant_path (self, object_path);
- if (ap)
+ if (ap) {
+ gint32 now = nm_utils_get_monotonic_timestamp_s ();
+ gint32 last_seen = nm_ap_get_last_seen (ap);
+
+ /* We don't know when the supplicant last saw the AP's beacons,
+ * it could be two minutes or it could be 2 seconds. Because the
+ * supplicant doesn't send property change notifications if the
+ * AP's other properties don't change, our last-seen time may be
+ * much older the supplicant's, and the AP would be immediately
+ * removed from the list on the next cleanup. So update the
+ * last-seen time to ensure the AP sticks around for at least
+ * one more periodic scan.
+ */
+ nm_ap_set_last_seen (ap, MAX (last_seen, now - SCAN_INTERVAL_MAX));
g_object_set_data (G_OBJECT (ap), WPAS_REMOVED_TAG, GUINT_TO_POINTER (TRUE));
+ }
}
static void