1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198 | diff -Nru network-manager-0.9.10.0/debian/changelog network-manager-0.9.10.0/debian/changelog
--- network-manager-0.9.10.0/debian/changelog 2016-03-16 09:31:46.000000000 +0100
+++ network-manager-0.9.10.0/debian/changelog 2016-03-23 11:21:24.000000000 +0100
@@ -1,3 +1,14 @@
+network-manager (0.9.10.0-4ubuntu15.1.11) vivid; urgency=medium
+
+ [ Vicamo Yang ]
+ * d/p/clear-requested-scan-when-supplicant-goes-down.patch: Clear
+ flag which indicates if a new scan is requested or not when a
+ WiFi interface is removed from supplicant to prevent us from not
+ issueing a scan again when we the interface becomes available
+ again (LP: #1560793)
+
+ -- Simon Fels <simon.fels@canonical.com> Wed, 23 Mar 2016 11:12:25 +0100
+
network-manager (0.9.10.0-4ubuntu15.1.10) vivid; urgency=medium
[ Vicamo Yang ]
diff -Nru network-manager-0.9.10.0/debian/patches/clear-requested-scan-when-supplicant-goes-down.patch network-manager-0.9.10.0/debian/patches/clear-requested-scan-when-supplicant-goes-down.patch
--- network-manager-0.9.10.0/debian/patches/clear-requested-scan-when-supplicant-goes-down.patch 1970-01-01 01:00:00.000000000 +0100
+++ network-manager-0.9.10.0/debian/patches/clear-requested-scan-when-supplicant-goes-down.patch 2016-03-23 11:20:42.000000000 +0100
@@ -0,0 +1,72 @@
+From 22aaf463499c025bdf08132453092e9d34bc4bdc Mon Sep 17 00:00:00 2001
+From: You-Sheng Yang <vicamo@gmail.com>
+Date: Wed, 23 Mar 2016 16:31:20 +0800
+Subject: [PATCH] wifi: clear requested_scan flag at release
+
+When wifi supplicant interface switches its state from unavailable to
+ready, NM is supposed to request for a initial scan. However, that's
+only made when there is no pending scan request, or specifically, when
+`priv->requested_scan` is FALSE.
+
+Under stressing tests, switching WiFi on and immediately off and
+immediately on ..., it's possible that `priv->requested_scan` remains
+TRUE when the underlying supplicant interface has been released. As a
+result, when it's enabled again, switching state from unavailable to
+ready, the scan request will not be made forever until NM restarts or
+system reboots.
+
+This patch clears that requested_scan when supplicant interface is to be
+released.
+
+diff --git a/src/devices/wifi/nm-device-wifi.c b/src/devices/wifi/nm-device-wifi.c
+index 4723ead..0ae31fd 100644
+--- a/src/devices/wifi/nm-device-wifi.c
++++ b/src/devices/wifi/nm-device-wifi.c
+@@ -291,16 +291,23 @@ static void
+ supplicant_interface_release (NMDeviceWifi *self)
+ {
+ NMDeviceWifiPrivate *priv;
+
+ g_return_if_fail (self != NULL);
+
+ priv = NM_DEVICE_WIFI_GET_PRIVATE (self);
+
++ if (priv->requested_scan) {
++ nm_log_dbg (LOGD_WIFI_SCAN, "(%s): reset requested_scan flag to FALSE",
++ nm_device_get_iface (NM_DEVICE (self)));
++ priv->requested_scan = FALSE;
++ nm_device_remove_pending_action (NM_DEVICE (self), "scan", TRUE);
++ }
++
+ cancel_pending_scan (self);
+
+ /* Reset the scan interval to be pretty frequent when disconnected */
+ priv->scan_interval = SCAN_INTERVAL_MIN + SCAN_INTERVAL_STEP;
+ nm_log_dbg (LOGD_WIFI_SCAN, "(%s): reset scanning interval to %d seconds",
+ nm_device_get_iface (NM_DEVICE (self)),
+ priv->scan_interval);
+
+@@ -2184,16 +2191,20 @@ supplicant_iface_state_cb (NMSupplicantInterface *iface,
+
+ /* Request a scan to get latest results */
+ if (!priv->requested_scan) {
+ /* Scan request should have been issued in nm_device_state_changed if
+ * the device was previously unavailable.
+ */
+ cancel_pending_scan (self);
+ request_wireless_scan (self);
++ } else {
++ nm_log_dbg (LOGD_WIFI_SCAN,
++ "(%s): scan already requested",
++ nm_device_get_iface (device));
+ }
+
+ if (old_state < NM_SUPPLICANT_INTERFACE_STATE_READY)
+ nm_device_remove_pending_action (device, "waiting for supplicant", TRUE);
+ break;
+ case NM_SUPPLICANT_INTERFACE_STATE_COMPLETED:
+ remove_supplicant_interface_error_handler (self);
+ remove_supplicant_timeouts (self);
+--
+2.8.0.rc3
+
diff -Nru network-manager-0.9.10.0/debian/patches/series network-manager-0.9.10.0/debian/patches/series
--- network-manager-0.9.10.0/debian/patches/series 2016-03-15 17:30:58.000000000 +0100
+++ network-manager-0.9.10.0/debian/patches/series 2016-03-23 11:20:42.000000000 +0100
@@ -77,3 +77,4 @@
fix-ofono-plugin-leaks.patch
rm-scofono-plugin-dbus.patch
wifi-fix-cancel-scan.patch
+clear-requested-scan-when-supplicant-goes-down.patch
diff -Nru network-manager-0.9.10.0/debian/patches/wifi-fix-cancel-scan.patch network-manager-0.9.10.0/debian/patches/wifi-fix-cancel-scan.patch
--- network-manager-0.9.10.0/debian/patches/wifi-fix-cancel-scan.patch 2016-03-15 17:30:58.000000000 +0100
+++ network-manager-0.9.10.0/debian/patches/wifi-fix-cancel-scan.patch 2016-03-23 11:20:42.000000000 +0100
@@ -8,9 +8,9 @@
effectively preventing the device from re-connecting to WiFi.
---
- src/devices/wifi/nm-device-wifi.c | 83 ++++++++++++++++++++++++++++++++++----
- src/nm-policy.c | 4 +
- 2 files changed, 78 insertions(+), 9 deletions(-)
+ src/devices/wifi/nm-device-wifi.c | 44 +++++++++++++++++++++++++++++++-------
+ src/nm-policy.c | 4 ++-
+ 2 files changed, 39 insertions(+), 9 deletions(-)
Index: b/src/devices/wifi/nm-device-wifi.c
===================================================================
@@ -50,60 +50,7 @@
dbus_g_method_return (context);
}
-@@ -2091,6 +2096,39 @@ handle_8021x_or_psk_auth_fail (NMDeviceW
- return handled;
- }
-
-+static const char *
-+devstate_to_string (NMDeviceState state)
-+{
-+ if (state == NM_DEVICE_STATE_UNKNOWN)
-+ return "unknown";
-+ else if (state == NM_DEVICE_STATE_UNMANAGED)
-+ return "unmanaged";
-+ else if (state == NM_DEVICE_STATE_UNAVAILABLE)
-+ return "unavailable";
-+ else if (state == NM_DEVICE_STATE_DISCONNECTED)
-+ return "disconnected";
-+ else if (state == NM_DEVICE_STATE_PREPARE)
-+ return "prepare";
-+ else if (state == NM_DEVICE_STATE_CONFIG)
-+ return "config";
-+ else if (state == NM_DEVICE_STATE_NEED_AUTH)
-+ return "need-auth";
-+ else if (state == NM_DEVICE_STATE_IP_CONFIG)
-+ return "ip-config";
-+ else if (state == NM_DEVICE_STATE_IP_CHECK)
-+ return "ip-check";
-+ else if (state == NM_DEVICE_STATE_SECONDARIES)
-+ return "secondaries";
-+ else if (state == NM_DEVICE_STATE_ACTIVATED)
-+ return "activated";
-+ else if (state == NM_DEVICE_STATE_DEACTIVATING)
-+ return "deactivating";
-+ else if (state == NM_DEVICE_STATE_FAILED)
-+ return "failed";
-+ else
-+ return "invalid";
-+}
-+
- static void
- supplicant_iface_state_cb (NMSupplicantInterface *iface,
- guint32 new_state,
-@@ -2116,6 +2154,12 @@ supplicant_iface_state_cb (NMSupplicantI
- devstate = nm_device_get_state (device);
- scanning = nm_supplicant_interface_get_scanning (iface);
-
-+ nm_log_dbg (LOGD_DEVICE | LOGD_WIFI,
-+ "(%s): device state: %s; scanning: %s",
-+ nm_device_get_iface (device),
-+ devstate_to_string (devstate),
-+ scanning ? "True" : "False");
-+
- /* In these states we know the supplicant is actually talking to something */
- if ( new_state >= NM_SUPPLICANT_INTERFACE_STATE_ASSOCIATING
- && new_state <= NM_SUPPLICANT_INTERFACE_STATE_COMPLETED)
-@@ -2139,8 +2183,13 @@ supplicant_iface_state_cb (NMSupplicantI
+@@ -2139,8 +2144,13 @@ supplicant_iface_state_cb (NMSupplicantI
nm_device_get_iface (device));
/* Request a scan to get latest results */
@@ -119,7 +66,7 @@
if (old_state < NM_SUPPLICANT_INTERFACE_STATE_READY)
nm_device_remove_pending_action (device, "waiting for supplicant", TRUE);
-@@ -2219,6 +2268,22 @@ supplicant_iface_state_cb (NMSupplicantI
+@@ -2219,6 +2229,22 @@ supplicant_iface_state_cb (NMSupplicantI
NM_DEVICE_STATE_UNAVAILABLE,
NM_DEVICE_STATE_REASON_SUPPLICANT_FAILED);
break;
@@ -142,7 +89,7 @@
default:
break;
}
-@@ -3109,8 +3174,10 @@ device_state_changed (NMDevice *device,
+@@ -3109,8 +3135,10 @@ device_state_changed (NMDevice *device,
case NM_DEVICE_STATE_DISCONNECTED:
/* Kick off a scan to get latest results */
priv->scan_interval = SCAN_INTERVAL_MIN;
|