diff -Nru network-manager-1.2.4/debian/changelog network-manager-1.2.4/debian/changelog --- network-manager-1.2.4/debian/changelog 2016-12-04 18:09:41.000000000 +0800 +++ network-manager-1.2.4/debian/changelog 2017-02-21 17:38:09.000000000 +0800 @@ -1,3 +1,13 @@ +network-manager (1.2.4-0ubuntu0.16.04.2) xenial-proposed; urgency=medium + + * Block autoconnect while scanning is in progress. (LP: #1585863) + - wifi-clear-WiFi-requested_scan-if-suppl-exits.patch + - wifi-clear-WiFi-requested_scan-if-suppl-goes-INACTIV.patch + - wifi-fix-missing-pending-action-remove-for-scan.patch + - device-wifi-block-autoconnect-while-scanning-is-in-p.patch + + -- Shih-Yuan Lee (FourDollars) Thu, 09 Feb 2017 17:15:02 +0800 + network-manager (1.2.4-0ubuntu0.16.04.1) xenial; urgency=medium * Rebase to upstream 1.2.4 release (LP: #1645698) diff -Nru network-manager-1.2.4/debian/patches/device-wifi-block-autoconnect-while-scanning-is-in-p.patch network-manager-1.2.4/debian/patches/device-wifi-block-autoconnect-while-scanning-is-in-p.patch --- network-manager-1.2.4/debian/patches/device-wifi-block-autoconnect-while-scanning-is-in-p.patch 1970-01-01 08:00:00.000000000 +0800 +++ network-manager-1.2.4/debian/patches/device-wifi-block-autoconnect-while-scanning-is-in-p.patch 2017-02-21 17:40:28.000000000 +0800 @@ -0,0 +1,58 @@ +From f270bc34b4e503d5ba79d6aad1129fb4f49fee05 Mon Sep 17 00:00:00 2001 +From: Thomas Haller +Date: Tue, 14 Feb 2017 15:10:36 +0100 +Subject: [PATCH] device/wifi: block autoconnect while scanning is in progress + +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 +(cherry picked from commit 2ab2254dd7336b9b7baa03ea1eb1f1c72f7ab6a8) +--- + src/devices/wifi/nm-device-wifi.c | 17 ++++++++++++++++- + 1 file changed, 16 insertions(+), 1 deletion(-) + +Index: network-manager-1.2.4/src/devices/wifi/nm-device-wifi.c +=================================================================== +--- network-manager-1.2.4.orig/src/devices/wifi/nm-device-wifi.c 2017-02-21 17:40:08.041555349 +0800 ++++ network-manager-1.2.4/src/devices/wifi/nm-device-wifi.c 2017-02-21 17:40:08.041555349 +0800 +@@ -252,8 +252,10 @@ + priv->requested_scan = value; + if (value) + nm_device_add_pending_action ((NMDevice *) self, "scan", TRUE); +- else ++ else { ++ nm_device_emit_recheck_auto_activate (NM_DEVICE (self)); + nm_device_remove_pending_action ((NMDevice *) self, "scan", TRUE); ++ } + } + + static void +@@ -888,6 +890,18 @@ + } + + 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) +@@ -3008,6 +3022,7 @@ + parent_class->realize_start_notify = realize_start_notify; + parent_class->bring_up = bring_up; + 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; diff -Nru network-manager-1.2.4/debian/patches/manager-fix-state-transition-on-resuming-from-sleep.patch network-manager-1.2.4/debian/patches/manager-fix-state-transition-on-resuming-from-sleep.patch --- network-manager-1.2.4/debian/patches/manager-fix-state-transition-on-resuming-from-sleep.patch 2016-12-04 18:09:41.000000000 +0800 +++ network-manager-1.2.4/debian/patches/manager-fix-state-transition-on-resuming-from-sleep.patch 2017-02-21 17:39:31.000000000 +0800 @@ -18,11 +18,11 @@ src/nm-manager.c | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) -diff --git a/src/nm-manager.c b/src/nm-manager.c -index 4d222b6..186411e 100644 ---- a/src/nm-manager.c -+++ b/src/nm-manager.c -@@ -4092,16 +4092,26 @@ do_sleep_wake (NMManager *self, gboolean sleeping_changed) +Index: network-manager-1.2.4/src/nm-manager.c +=================================================================== +--- network-manager-1.2.4.orig/src/nm-manager.c 2017-02-21 17:39:28.429796069 +0800 ++++ network-manager-1.2.4/src/nm-manager.c 2017-02-21 17:39:28.425796093 +0800 +@@ -4155,16 +4155,26 @@ if (waking_from_suspend) { sleep_devices_clear (self); diff -Nru network-manager-1.2.4/debian/patches/series network-manager-1.2.4/debian/patches/series --- network-manager-1.2.4/debian/patches/series 2016-12-04 18:09:41.000000000 +0800 +++ network-manager-1.2.4/debian/patches/series 2017-02-21 17:34:57.000000000 +0800 @@ -25,6 +25,10 @@ adhoc_use_wpa_rsn_part1.patch adhoc_use_wpa_rsn_part2.patch wifi-Signal-on-the-wifi-device-when-its-supplicant-i.patch +wifi-clear-WiFi-requested_scan-if-suppl-exits.patch +wifi-clear-WiFi-requested_scan-if-suppl-goes-INACTIV.patch +wifi-fix-missing-pending-action-remove-for-scan.patch +device-wifi-block-autoconnect-while-scanning-is-in-p.patch # touch-specific ignore_rild_modem_devices.patch diff -Nru network-manager-1.2.4/debian/patches/wifi-clear-WiFi-requested_scan-if-suppl-exits.patch network-manager-1.2.4/debian/patches/wifi-clear-WiFi-requested_scan-if-suppl-exits.patch --- network-manager-1.2.4/debian/patches/wifi-clear-WiFi-requested_scan-if-suppl-exits.patch 1970-01-01 08:00:00.000000000 +0800 +++ network-manager-1.2.4/debian/patches/wifi-clear-WiFi-requested_scan-if-suppl-exits.patch 2017-02-21 17:18:38.000000000 +0800 @@ -0,0 +1,34 @@ +From 1b925c0028cdaaf14d4ebd1f07848ba5640915c6 Mon Sep 17 00:00:00 2001 +From: Tony Espy +Date: Thu, 16 Jun 2016 15:07:33 -0400 +Subject: [PATCH] wifi: clear WiFi requested_scan if suppl exits + +It's possible for wpa_supplicant to exit with an +outstanding requested_scan pending. This can lead +to a stall condition where scanning no longer occurs. + +https://mail.gnome.org/archives/networkmanager-list/2016-June/msg00117.html +(cherry picked from commit 899d7e5cb1eb3bddaf92de3644c49c9f634b675e) +--- + src/devices/wifi/nm-device-wifi.c | 5 +++++ + 1 file changed, 5 insertions(+) + +diff --git a/src/devices/wifi/nm-device-wifi.c b/src/devices/wifi/nm-device-wifi.c +index 712be49..17f5b14 100644 +--- a/src/devices/wifi/nm-device-wifi.c ++++ b/src/devices/wifi/nm-device-wifi.c +@@ -246,6 +246,11 @@ supplicant_interface_release (NMDeviceWifi *self) + + priv = NM_DEVICE_WIFI_GET_PRIVATE (self); + ++ if (priv->requested_scan) { ++ priv->requested_scan = FALSE; ++ nm_device_remove_pending_action (NM_DEVICE (self), "scan", TRUE); ++ } ++ + nm_clear_g_source (&priv->pending_scan_id); + + /* Reset the scan interval to be pretty frequent when disconnected */ +-- +2.7.4 + diff -Nru network-manager-1.2.4/debian/patches/wifi-clear-WiFi-requested_scan-if-suppl-goes-INACTIV.patch network-manager-1.2.4/debian/patches/wifi-clear-WiFi-requested_scan-if-suppl-goes-INACTIV.patch --- network-manager-1.2.4/debian/patches/wifi-clear-WiFi-requested_scan-if-suppl-goes-INACTIV.patch 1970-01-01 08:00:00.000000000 +0800 +++ network-manager-1.2.4/debian/patches/wifi-clear-WiFi-requested_scan-if-suppl-goes-INACTIV.patch 2017-02-21 17:18:38.000000000 +0800 @@ -0,0 +1,35 @@ +From eed8fd2e43d244caa856d9993e750ff19ba62fd7 Mon Sep 17 00:00:00 2001 +From: Tony Espy +Date: Thu, 16 Jun 2016 15:07:32 -0400 +Subject: [PATCH] wifi: clear WiFi requested_scan if suppl goes INACTIVE + +It's possible for wpa_supplicant to transition to INACTIVE +state with an outstanding requested_scan pending. This can +lead to a stall condition where scanning no longer occurs. + +[thaller@redhat.com: added break statement to avoid fall-through] + +https://mail.gnome.org/archives/networkmanager-list/2016-June/msg00116.html +--- + src/devices/wifi/nm-device-wifi.c | 5 +++++ + 1 file changed, 5 insertions(+) + +diff --git a/src/devices/wifi/nm-device-wifi.c b/src/devices/wifi/nm-device-wifi.c +index a88d6eb..4f04693 100644 +--- a/src/devices/wifi/nm-device-wifi.c ++++ b/src/devices/wifi/nm-device-wifi.c +@@ -1954,6 +1954,11 @@ supplicant_iface_state_cb (NMSupplicantInterface *iface, + else + _LOGI (LOGD_DEVICE | LOGD_WIFI, "supplicant interface keeps failing, giving up"); + break; ++ case NM_SUPPLICANT_INTERFACE_STATE_INACTIVE: ++ priv->requested_scan = FALSE; ++ nm_clear_g_source (&priv->pending_scan_id); ++ request_wireless_scan (self, NULL); ++ break; + default: + break; + } +-- +2.7.4 + diff -Nru network-manager-1.2.4/debian/patches/wifi-fix-missing-pending-action-remove-for-scan.patch network-manager-1.2.4/debian/patches/wifi-fix-missing-pending-action-remove-for-scan.patch --- network-manager-1.2.4/debian/patches/wifi-fix-missing-pending-action-remove-for-scan.patch 1970-01-01 08:00:00.000000000 +0800 +++ network-manager-1.2.4/debian/patches/wifi-fix-missing-pending-action-remove-for-scan.patch 2017-02-21 17:18:38.000000000 +0800 @@ -0,0 +1,88 @@ +From 788583d9fd35f9a83c932c5fa6ca059e19fcd7c6 Mon Sep 17 00:00:00 2001 +From: Thomas Haller +Date: Wed, 6 Jul 2016 09:30:46 +0200 +Subject: [PATCH] wifi: fix missing pending-action-remove for "scan" + + [1467730406.7343] device (wlp3s0): add_pending_action (2): scan already pending + file devices/nm-device.c: line 10443 (nm_device_add_pending_action): should not be reached + +Fixes: eed8fd2e43d244caa856d9993e750ff19ba62fd7 +--- + src/devices/wifi/nm-device-wifi.c | 33 ++++++++++++++++++++++----------- + 1 file changed, 22 insertions(+), 11 deletions(-) + +diff --git a/src/devices/wifi/nm-device-wifi.c b/src/devices/wifi/nm-device-wifi.c +index 37ec4a6..3c512b1 100644 +--- a/src/devices/wifi/nm-device-wifi.c ++++ b/src/devices/wifi/nm-device-wifi.c +@@ -257,6 +257,24 @@ supplicant_interface_acquire (NMDeviceWifi *self) + } + + static void ++_requested_scan_set (NMDeviceWifi *self, gboolean value) ++{ ++ NMDeviceWifiPrivate *priv; ++ ++ value = !!value; ++ ++ priv = NM_DEVICE_WIFI_GET_PRIVATE (self); ++ if (priv->requested_scan == value) ++ return; ++ ++ priv->requested_scan = value; ++ if (value) ++ nm_device_add_pending_action ((NMDevice *) self, "scan", TRUE); ++ else ++ nm_device_remove_pending_action ((NMDevice *) self, "scan", TRUE); ++} ++ ++static void + supplicant_interface_release (NMDeviceWifi *self) + { + NMDeviceWifiPrivate *priv; +@@ -265,10 +283,7 @@ supplicant_interface_release (NMDeviceWifi *self) + + priv = NM_DEVICE_WIFI_GET_PRIVATE (self); + +- if (priv->requested_scan) { +- priv->requested_scan = FALSE; +- nm_device_remove_pending_action (NM_DEVICE (self), "scan", TRUE); +- } ++ _requested_scan_set (self, FALSE); + + nm_clear_g_source (&priv->pending_scan_id); + +@@ -1403,8 +1418,7 @@ request_wireless_scan (NMDeviceWifi *self, GVariant *scan_options) + if (nm_supplicant_interface_request_scan (priv->sup_iface, ssids)) { + /* success */ + backoff = TRUE; +- priv->requested_scan = TRUE; +- nm_device_add_pending_action (NM_DEVICE (self), "scan", TRUE); ++ _requested_scan_set (self, TRUE); + } + + if (ssids) +@@ -1486,10 +1500,7 @@ supplicant_iface_scan_done_cb (NMSupplicantInterface *iface, + priv->last_scan = nm_utils_get_monotonic_timestamp_s (); + schedule_scan (self, success); + +- if (priv->requested_scan) { +- priv->requested_scan = FALSE; +- nm_device_remove_pending_action (NM_DEVICE (self), "scan", TRUE); +- } ++ _requested_scan_set (self, FALSE); + } + + /**************************************************************************** +@@ -2024,7 +2035,7 @@ supplicant_iface_state_cb (NMSupplicantInterface *iface, + _LOGI (LOGD_DEVICE | LOGD_WIFI, "supplicant interface keeps failing, giving up"); + break; + case NM_SUPPLICANT_INTERFACE_STATE_INACTIVE: +- priv->requested_scan = FALSE; ++ _requested_scan_set (self, FALSE); + nm_clear_g_source (&priv->pending_scan_id); + request_wireless_scan (self, NULL); + break; +-- +2.7.4 +