summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThomas Haller <thaller@redhat.com>2017-02-14 15:10:36 +0100
committerThomas Haller <thaller@redhat.com>2017-02-17 14:41:27 +0100
commit2ab2254dd7336b9b7baa03ea1eb1f1c72f7ab6a8 (patch)
tree1ebe9dd420c9d1da137be09d852305a3b2713ee6
parent6eaded9071fbf868476255adb8ee5f416e7ad134 (diff)
downloadNetworkManager-th/device-wifi-wait-for-scan-bgo770938.tar.gz
device/wifi: block autoconnect while scanning is in progressth/device-wifi-wait-for-scan-bgo770938
We should only start autoconnecting after the scan is complete. Otherwise, we might activate a shared connection or pick a connection based on an incomplete scan list. https://bugzilla.gnome.org/show_bug.cgi?id=770938
-rw-r--r--src/devices/wifi/nm-device-wifi.c17
1 files changed, 16 insertions, 1 deletions
diff --git a/src/devices/wifi/nm-device-wifi.c b/src/devices/wifi/nm-device-wifi.c
index 1d1eb47d7e..01621e8bfa 100644
--- a/src/devices/wifi/nm-device-wifi.c
+++ b/src/devices/wifi/nm-device-wifi.c
@@ -295,8 +295,10 @@ _requested_scan_set (NMDeviceWifi *self, gboolean value)
priv->requested_scan = value;
if (value)
nm_device_add_pending_action ((NMDevice *) self, NM_PENDING_ACTION_WIFI_SCAN, TRUE);
- else
+ else {
+ nm_device_emit_recheck_auto_activate (NM_DEVICE (self));
nm_device_remove_pending_action ((NMDevice *) self, NM_PENDING_ACTION_WIFI_SCAN, TRUE);
+ }
}
static void
@@ -964,6 +966,18 @@ is_available (NMDevice *device, NMDeviceCheckDevAvailableFlags flags)
}
static gboolean
+get_autoconnect_allowed (NMDevice *device)
+{
+ NMDeviceWifiPrivate *priv;
+
+ if (!NM_DEVICE_CLASS (nm_device_wifi_parent_class)->get_autoconnect_allowed (device))
+ return FALSE;
+
+ priv = NM_DEVICE_WIFI_GET_PRIVATE (NM_DEVICE_WIFI (device));
+ return !priv->requested_scan;
+}
+
+static gboolean
can_auto_connect (NMDevice *device,
NMConnection *connection,
char **specific_object)
@@ -3189,6 +3203,7 @@ nm_device_wifi_class_init (NMDeviceWifiClass *klass)
object_class->finalize = finalize;
parent_class->can_auto_connect = can_auto_connect;
+ parent_class->get_autoconnect_allowed = get_autoconnect_allowed;
parent_class->is_available = is_available;
parent_class->check_connection_compatible = check_connection_compatible;
parent_class->check_connection_available = check_connection_available;