summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-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