Merge ~awe/network-manager/+git/ubuntu:touch-sync into network-manager:master

Proposed by Tony Espy
Status: Needs review
Proposed branch: ~awe/network-manager/+git/ubuntu:touch-sync
Merge into: network-manager:master
Diff against target: 1213 lines (+698/-126)
16 files modified
debian/changelog (+11/-0)
debian/patches/Add-modem-reconnect-delay-to-policy.patch (+115/-0)
debian/patches/Add-new-NMSettingsConnection-reset_retries-get-set-m.patch (+1/-1)
debian/patches/Clear-WiFi-requested_scan-if-suppl-exits.patch (+38/-0)
debian/patches/Clear-WiFi-requested_scan-if-suppl-goes-INACTIVE.patch (+37/-0)
debian/patches/Filter-DNS-servers-to-add-to-dnsmasq-based-on-availa.patch (+1/-0)
debian/patches/Ignore-p2p-wifi-devices-from-android.patch (+34/-0)
debian/patches/Ignore-rild-modem-devices.patch (+27/-0)
debian/patches/Modify-NMDeviceModem-s-available-logic.patch (+4/-4)
debian/patches/Order-IPv6-nameservers-before-IPv4-for-dns-plugins-d.patch (+2/-0)
debian/patches/Track-killswitch-change-signals-from-urfkill.patch (+4/-4)
debian/patches/Update-dnsmasq-parameters.patch (+1/-1)
debian/patches/series (+6/-2)
debian/patches/wwan-add-support-for-using-oFono-as-a-modem-manager.patch (+74/-89)
debian/patches/wwan-fix-ofono-connection-problems.patch (+343/-0)
dev/null (+0/-25)
Reviewer Review Type Date Requested Status
System Enablement Bot continuous-integration Needs Fixing
Mathieu Trudel-Lapierre Pending
Review via email: mp+296807@code.launchpad.net

Description of the change

These changes update the Touch-specific patches to NM including:

 - updating the manager device patches ( rild & p2p )
 - updating the core wwan ofono plugin changes
 - restored the modem re-connect delay patch
 - added two wpa_supplicant related scan patches
 - added ofono mobile data connection patch ( see changelog for bug #s )

To post a comment you must log in.
Revision history for this message
System Enablement Bot (system-enablement-ci-bot) wrote :
review: Needs Fixing (continuous-integration)

Unmerged commits

f4daef8... by Tony Espy

Add d/p/wwan-fix-ofono-connection-problems (LP: #1565717, #1579098).

5a80502... by Tony Espy

Re-stored missing patches from Touch

 - Add-modem-reconnect-delay* (LP: #1461593)
 - wpa_suppl scan fixes

763d6e6... by Tony Espy

Resync base wwan ofono patch from Touch

The Touch NMManager device patches were updated after the
1.1.93 landed in xenial.

b04b54c... by Tony Espy

Resync nm-manager device patches from Touch

The Touch NMManager device patches were updated after the
1.1.93 landed in xenial.

b484744... by Tony Espy

Restore d/p/*.patch 'Bug-Ubuntu' headers

4a813ea... by Aron Xu

Cherry pick patch for WPA* Enterprise private key file (LP: #1575614)

9f40397... by Mathieu Trudel-Lapierre

Merge branch 'powersave'

86247f2... by Aron Xu

Use VCS-Git to make git the authoritative repo

63147ed... by Mathieu Trudel-Lapierre

debian/patches/libnm-Check-self-still-NMManager-or-not.patch: updated and refreshed to make gbp pq happy.

087c60b... by Mathieu Trudel-Lapierre

releasing package network-manager version 1.2.2-0ubuntu3

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1diff --git a/debian/changelog b/debian/changelog
2index 23fbc78..1c1e9d4 100644
3--- a/debian/changelog
4+++ b/debian/changelog
5@@ -1,8 +1,19 @@
6 network-manager (1.2.2-0ubuntu4) UNRELEASED; urgency=medium
7
8+ [ Mathieu Trudel-Lapierre ]
9 * debian/patches/libnm-Check-self-still-NMManager-or-not.patch: updated and
10 refreshed to make gbp pq happy.
11
12+ [ Tony Espy ]
13+ * debian/patches/Ignore*: re-sync nm-manager device patches from Touch.
14+ * debian/patches/wwan-add-support*, Modify-NMDeviceModem-s-available*: re-sync
15+ base ofono wwan patches from Touch.
16+ * debian/patches/Add-modem-reconnect-delay*: re-store missing Touch patch.
17+ * debian/patches/Clear-WiFi-requested_scan*: include wpa_supplicant scan patches
18+ from Touch.
19+ * debian/patches/wwan-fix-ofono-connection*: new patch to address ofono data
20+ re-connect problems (LP: #1565717, #1579098).
21+
22 -- Mathieu Trudel-Lapierre <cyphermox@ubuntu.com> Tue, 31 May 2016 13:37:01 -0400
23
24 network-manager (1.2.2-0ubuntu3) yakkety; urgency=medium
25diff --git a/debian/patches/Add-modem-reconnect-delay-to-policy.patch b/debian/patches/Add-modem-reconnect-delay-to-policy.patch
26new file mode 100644
27index 0000000..5bdb503
28--- /dev/null
29+++ b/debian/patches/Add-modem-reconnect-delay-to-policy.patch
30@@ -0,0 +1,115 @@
31+From: Tony Espy <espy@canonical.com>
32+Date: Tue, 24 May 2016 20:59:42 -0400
33+Subject: Add modem reconnect delay to policy
34+
35+This patch introduces a 5s delay between retry activations
36+for modem devices. Otherwise, the activation attempts can
37+flood the modem all at once, and then trigger the reset_retries
38+timeout ( which defaults to 300s ).
39+
40+Bug-Ubuntu: https://bugs.launchpad.net/bugs/1461593
41+---
42+ src/nm-policy.c | 34 +++++++++++++++++++++++++++-------
43+ 1 file changed, 27 insertions(+), 7 deletions(-)
44+
45+diff --git a/src/nm-policy.c b/src/nm-policy.c
46+index 07bcce8..5c59604 100644
47+--- a/src/nm-policy.c
48++++ b/src/nm-policy.c
49+@@ -931,7 +931,7 @@ sleeping_changed (NMManager *manager, GParamSpec *pspec, gpointer user_data)
50+ }
51+
52+ static void
53+-schedule_activate_check (NMPolicy *self, NMDevice *device)
54++schedule_activate_check (NMPolicy *self, NMDevice *device, guint delay)
55+ {
56+ NMPolicyPrivate *priv = NM_POLICY_GET_PRIVATE (self);
57+ ActivateData *data;
58+@@ -960,7 +960,12 @@ schedule_activate_check (NMPolicy *self, NMDevice *device)
59+ data = g_slice_new0 (ActivateData);
60+ data->policy = self;
61+ data->device = g_object_ref (device);
62+- data->autoactivate_id = g_idle_add (auto_activate_device, data);
63++
64++ if (delay)
65++ data->autoactivate_id = g_timeout_add_seconds (delay, auto_activate_device, data);
66++ else
67++ data->autoactivate_id = g_idle_add (auto_activate_device, data);
68++
69+ priv->pending_activation_checks = g_slist_append (priv->pending_activation_checks, data);
70+ }
71+
72+@@ -1155,6 +1160,7 @@ device_state_changed (NMDevice *device,
73+ NMIP4Config *ip4_config;
74+ NMIP6Config *ip6_config;
75+ NMSettingConnection *s_con = NULL;
76++ guint delay = 0;
77+
78+ switch (new_state) {
79+ case NM_DEVICE_STATE_FAILED:
80+@@ -1172,7 +1178,7 @@ device_state_changed (NMDevice *device,
81+
82+ nm_settings_connection_set_autoconnect_blocked_reason (connection, NM_DEVICE_STATE_REASON_NO_SECRETS);
83+ } else if (tries > 0) {
84+- _LOGD (LOGD_DEVICE, "connection '%s' failed to autoconnect; %d tries left",
85++ _LOGI (LOGD_DEVICE, "connection '%s' failed to autoconnect; %d tries left",
86+ nm_settings_connection_get_id (connection), tries);
87+ nm_settings_connection_set_autoconnect_retries (connection, tries - 1);
88+ }
89+@@ -1183,6 +1189,10 @@ device_state_changed (NMDevice *device,
90+ /* Schedule a handler to reset retries count */
91+ if (!priv->reset_retries_id) {
92+ gint32 retry_time = nm_settings_connection_get_autoconnect_retry_time (connection);
93++ gint32 actual_time = MAX (0, retry_time - nm_utils_get_monotonic_timestamp_s ());
94++
95++ _LOGI (LOGD_DEVICE, "Disabling autoconnect for connection '%s'; setting retry of %d.",
96++ nm_connection_get_id (NM_CONNECTION (connection)), actual_time);
97+
98+ g_warn_if_fail (retry_time != 0);
99+ priv->reset_retries_id = g_timeout_add_seconds (MAX (0, retry_time - nm_utils_get_monotonic_timestamp_s ()), reset_connections_retries, self);
100+@@ -1250,7 +1260,17 @@ device_state_changed (NMDevice *device,
101+ update_routing_and_dns (self, FALSE);
102+
103+ /* Device is now available for auto-activation */
104+- schedule_activate_check (self, device);
105++ if (nm_device_get_device_type (device) == NM_DEVICE_TYPE_MODEM)
106++ delay = 5;
107++
108++ if (connection)
109++ _LOGI (LOGD_DEVICE, "Connection '%s' disconnected, scheduling activate_check in %u seconds.",
110++ nm_connection_get_id (NM_CONNECTION (connection)), delay);
111++ else
112++ _LOGI (LOGD_DEVICE, "Device '%s' has no connection; scheduling activate_check in %u seconds.",
113++ nm_device_get_iface (device), delay);
114++
115++ schedule_activate_check (self, device, delay);
116+ break;
117+
118+ case NM_DEVICE_STATE_PREPARE:
119+@@ -1363,7 +1383,7 @@ device_autoconnect_changed (NMDevice *device,
120+ NMPolicy *self = priv->self;
121+
122+ if (nm_device_autoconnect_allowed (device))
123+- schedule_activate_check (self, device);
124++ schedule_activate_check (self, device, 0);
125+ }
126+
127+ static void
128+@@ -1372,7 +1392,7 @@ device_recheck_auto_activate (NMDevice *device, gpointer user_data)
129+ NMPolicyPrivate *priv = user_data;
130+ NMPolicy *self = priv->self;
131+
132+- schedule_activate_check (self, device);
133++ schedule_activate_check (self, device, 0);
134+ }
135+
136+ static void
137+@@ -1586,7 +1606,7 @@ schedule_activate_all (NMPolicy *self)
138+ const GSList *iter;
139+
140+ for (iter = nm_manager_get_devices (priv->manager); iter; iter = g_slist_next (iter))
141+- schedule_activate_check (self, NM_DEVICE (iter->data));
142++ schedule_activate_check (self, NM_DEVICE (iter->data), 0);
143+ }
144+
145+ static void
146diff --git a/debian/patches/Add-new-NMSettingsConnection-reset_retries-get-set-m.patch b/debian/patches/Add-new-NMSettingsConnection-reset_retries-get-set-m.patch
147index 3fc4826..a10ac51 100644
148--- a/debian/patches/Add-new-NMSettingsConnection-reset_retries-get-set-m.patch
149+++ b/debian/patches/Add-new-NMSettingsConnection-reset_retries-get-set-m.patch
150@@ -6,7 +6,7 @@ This patch adds get/set methods to NMSettingsConnection for the
151 reset_retries_timeout. This allows sub-classes to override the
152 default setting ( 300s ).
153
154-Bug: https://bugs.launchpad.net/ubuntu/+source/network-manager/+bug/1461593
155+Bug-Ubuntu: https://bugs.launchpad.net/bugs/1461593
156 ---
157 src/settings/nm-settings-connection.c | 18 +++++++++++++++++-
158 src/settings/nm-settings-connection.h | 3 +++
159diff --git a/debian/patches/Clear-WiFi-requested_scan-if-suppl-exits.patch b/debian/patches/Clear-WiFi-requested_scan-if-suppl-exits.patch
160new file mode 100644
161index 0000000..88f9891
162--- /dev/null
163+++ b/debian/patches/Clear-WiFi-requested_scan-if-suppl-exits.patch
164@@ -0,0 +1,38 @@
165+From: Tony Espy <espy@canonical.com>
166+Date: Tue, 24 May 2016 21:36:20 -0400
167+Subject: Clear WiFi requested_scan if suppl exits
168+
169+It's possible for wpa_supplicant to exit with an
170+outstanding requested_scan pending. This can lead
171+to a stall condition where scanning no longer occurs.
172+---
173+ src/devices/wifi/nm-device-wifi.c | 9 ++++++++-
174+ 1 file changed, 8 insertions(+), 1 deletion(-)
175+
176+diff --git a/src/devices/wifi/nm-device-wifi.c b/src/devices/wifi/nm-device-wifi.c
177+index f6325a6..b147409 100644
178+--- a/src/devices/wifi/nm-device-wifi.c
179++++ b/src/devices/wifi/nm-device-wifi.c
180+@@ -246,6 +246,13 @@ supplicant_interface_release (NMDeviceWifi *self)
181+
182+ priv = NM_DEVICE_WIFI_GET_PRIVATE (self);
183+
184++ if (priv->requested_scan) {
185++ nm_log_dbg (LOGD_WIFI_SCAN, "(%s): reset requested_scan flag to FALSE",
186++ nm_device_get_iface (NM_DEVICE (self)));
187++ priv->requested_scan = FALSE;
188++ nm_device_remove_pending_action (NM_DEVICE (self), "scan", TRUE);
189++ }
190++
191+ nm_clear_g_source (&priv->pending_scan_id);
192+
193+ /* Reset the scan interval to be pretty frequent when disconnected */
194+@@ -1915,7 +1922,7 @@ supplicant_iface_state_cb (NMSupplicantInterface *iface,
195+ priv->requested_scan = FALSE;
196+ }
197+
198+- cancel_pending_scan (self);
199++ nm_clear_g_source (&priv->pending_scan_id);
200+ request_wireless_scan (self, NULL);
201+ }
202+ default:
203diff --git a/debian/patches/Clear-WiFi-requested_scan-if-suppl-goes-INACTIVE.patch b/debian/patches/Clear-WiFi-requested_scan-if-suppl-goes-INACTIVE.patch
204new file mode 100644
205index 0000000..d81b534
206--- /dev/null
207+++ b/debian/patches/Clear-WiFi-requested_scan-if-suppl-goes-INACTIVE.patch
208@@ -0,0 +1,37 @@
209+From: Tony Espy <espy@canonical.com>
210+Date: Tue, 24 May 2016 21:22:48 -0400
211+Subject: Clear WiFi requested_scan if suppl goes INACTIVE
212+
213+It's possible for wpa_supplicant to transition to INACTIVE
214+state with an outstanding requested_scan pending. This can
215+lead to a stall condition where scanning no longer occurs.
216+---
217+ src/devices/wifi/nm-device-wifi.c | 15 +++++++++++++++
218+ 1 file changed, 15 insertions(+)
219+
220+diff --git a/src/devices/wifi/nm-device-wifi.c b/src/devices/wifi/nm-device-wifi.c
221+index bacd5e6..f6325a6 100644
222+--- a/src/devices/wifi/nm-device-wifi.c
223++++ b/src/devices/wifi/nm-device-wifi.c
224+@@ -1903,6 +1903,21 @@ supplicant_iface_state_cb (NMSupplicantInterface *iface,
225+ else
226+ _LOGI (LOGD_DEVICE | LOGD_WIFI, "supplicant interface keeps failing, giving up");
227+ break;
228++ case NM_SUPPLICANT_INTERFACE_STATE_INACTIVE:
229++ if (old_state == NM_SUPPLICANT_INTERFACE_STATE_SCANNING) {
230++ nm_log_warn (LOGD_HW | LOGD_WIFI, "(%s): supplicant state: SCANNING -> INACTIVE",
231++ nm_device_get_iface (NM_DEVICE (self)));
232++
233++ if (priv->requested_scan) {
234++ nm_log_dbg (LOGD_WIFI_SCAN, "(%s): clearing requested_scan",
235++ nm_device_get_iface (NM_DEVICE (self)));
236++
237++ priv->requested_scan = FALSE;
238++ }
239++
240++ cancel_pending_scan (self);
241++ request_wireless_scan (self, NULL);
242++ }
243+ default:
244+ break;
245+ }
246diff --git a/debian/patches/Filter-DNS-servers-to-add-to-dnsmasq-based-on-availa.patch b/debian/patches/Filter-DNS-servers-to-add-to-dnsmasq-based-on-availa.patch
247index fae01f9..648dd6f 100644
248--- a/debian/patches/Filter-DNS-servers-to-add-to-dnsmasq-based-on-availa.patch
249+++ b/debian/patches/Filter-DNS-servers-to-add-to-dnsmasq-based-on-availa.patch
250@@ -3,6 +3,7 @@ Date: Fri, 13 May 2016 11:00:11 +0800
251 Subject: Filter DNS servers to add to dnsmasq based on availability and VPN
252 status
253
254+Bug-Ubuntu: https://bugs.launchpad.net/bugs/898224
255 ---
256 src/dns-manager/nm-dns-dnsmasq.c | 47 +++++++++++++++++++++++++++++++++-------
257 1 file changed, 39 insertions(+), 8 deletions(-)
258diff --git a/debian/patches/Ignore-p2p-wifi-devices-from-android.patch b/debian/patches/Ignore-p2p-wifi-devices-from-android.patch
259new file mode 100644
260index 0000000..c09e7d3
261--- /dev/null
262+++ b/debian/patches/Ignore-p2p-wifi-devices-from-android.patch
263@@ -0,0 +1,34 @@
264+From: Tony Espy <espy@canonical.com>
265+Date: Fri, 3 Jun 2016 15:50:53 -0400
266+Subject: Ignore p2p wifi devices from android
267+
268+This patch causes NMManager to ignore any p2p WiFi
269+devices exposed by Android WiFi drivers.
270+
271+Bug-Ubuntu: https://bugs.launchpad.net/bugs/1099983
272+---
273+ src/nm-manager.c | 11 +++++++++++
274+ 1 file changed, 11 insertions(+)
275+
276+diff --git a/src/nm-manager.c b/src/nm-manager.c
277+index c2ed1da..8cf70c7 100644
278+--- a/src/nm-manager.c
279++++ b/src/nm-manager.c
280+@@ -2097,6 +2097,17 @@ platform_link_added (NMManager *self,
281+ return;
282+ }
283+
284++ /*
285++ * Ubuntu: Explicitly unmanage all p2p Wi-Fi devices which are
286++ * managed externally in the case of Wi-Fi Direct.
287++ */
288++ NMDeviceType devtype = nm_device_get_device_type (device);
289++ if ((plink->type == NM_LINK_TYPE_WIFI)
290++ && g_strstr_len (plink->name, NM_STRLEN ("p2p"), "p2p")) {
291++ nm_log_info (LOGD_HW, "(%s): ignoring P2P wireless iface", plink->name);
292++ return;
293++ }
294++
295+ device = nm_device_factory_create_device (factory, plink->name, plink, NULL, &ignore, &error);
296+ if (!device) {
297+ if (!ignore) {
298diff --git a/debian/patches/Ignore-p2p0-wifi-devices-from-android.patch b/debian/patches/Ignore-p2p0-wifi-devices-from-android.patch
299deleted file mode 100644
300index c567c96..0000000
301--- a/debian/patches/Ignore-p2p0-wifi-devices-from-android.patch
302+++ /dev/null
303@@ -1,29 +0,0 @@
304-From: Mathieu Trudel-Lapierre <mathieu.trudel-lapierre@canonical.com>
305-Date: Fri, 13 May 2016 11:08:30 +0800
306-Subject: Ignore p2p0 wifi devices from android.
307-
308----
309- src/nm-manager.c | 10 ++++++++++
310- 1 file changed, 10 insertions(+)
311-
312-diff --git a/src/nm-manager.c b/src/nm-manager.c
313-index 769662c..b770139 100644
314---- a/src/nm-manager.c
315-+++ b/src/nm-manager.c
316-@@ -2105,6 +2105,16 @@ platform_link_added (NMManager *self,
317- !strncmp (plink->name, "ccmni", NM_STRLEN ("ccmni")))
318- return;
319-
320-+ /*
321-+ * Ubuntu: Explicitly unmanage p2p Wi-Fi devices exposed by Android JB Wi-Fi drivers.
322-+ */
323-+ NMDeviceType devtype = nm_device_get_device_type (device);
324-+ if ((plink->type == NM_LINK_TYPE_WIFI)
325-+ && !strncmp (plink->name, "p2p0", NM_STRLEN ("p2p0"))) {
326-+ nm_log_info (LOGD_HW, "(%s): ignoring P2P wireless iface", plink->name);
327-+ return;
328-+ }
329-+
330- if (device == NULL) {
331- switch (plink->type) {
332- case NM_LINK_TYPE_WWAN_ETHERNET:
333diff --git a/debian/patches/Ignore-rild-modem-devices.patch b/debian/patches/Ignore-rild-modem-devices.patch
334new file mode 100644
335index 0000000..c0cc6ae
336--- /dev/null
337+++ b/debian/patches/Ignore-rild-modem-devices.patch
338@@ -0,0 +1,27 @@
339+From: Mathieu Trudel-Lapierre <mathieu.trudel-lapierre@canonical.com>
340+Date: Fri, 13 May 2016 11:08:17 +0800
341+Subject: Ignore rild modem devices.
342+
343+---
344+ src/nm-manager.c | 8 ++++++++
345+ 1 file changed, 8 insertions(+)
346+
347+diff --git a/src/nm-manager.c b/src/nm-manager.c
348+index 10aa3d7..c2ed1da 100644
349+--- a/src/nm-manager.c
350++++ b/src/nm-manager.c
351+@@ -2089,6 +2089,14 @@ platform_link_added (NMManager *self,
352+ gboolean ignore = FALSE;
353+ gs_free_error GError *error = NULL;
354+
355++ /* Ignore rild modem devices, which will be handled by their modem parent */
356++ if (g_strstr_len (plink->name, NM_STRLEN ("rmnet"), "rmnet") ||
357++ g_strstr_len (plink->name, NM_STRLEN ("rev_rmnet"), "rev_rmnet") ||
358++ g_strstr_len (plink->name, NM_STRLEN ("ccmni"), "ccmni")) {
359++ _LOGW (LOGD_HW, "Ignoring rild modem device: %s", plink->name);
360++ return;
361++ }
362++
363+ device = nm_device_factory_create_device (factory, plink->name, plink, NULL, &ignore, &error);
364+ if (!device) {
365+ if (!ignore) {
366diff --git a/debian/patches/Ignore-rmnet_usbX-devices.patch b/debian/patches/Ignore-rmnet_usbX-devices.patch
367deleted file mode 100644
368index f973a5f..0000000
369--- a/debian/patches/Ignore-rmnet_usbX-devices.patch
370+++ /dev/null
371@@ -1,25 +0,0 @@
372-From: Mathieu Trudel-Lapierre <mathieu.trudel-lapierre@canonical.com>
373-Date: Fri, 13 May 2016 11:08:17 +0800
374-Subject: Ignore rmnet_usbX devices.
375-
376----
377- src/nm-manager.c | 6 ++++++
378- 1 file changed, 6 insertions(+)
379-
380-diff --git a/src/nm-manager.c b/src/nm-manager.c
381-index 10aa3d7..769662c 100644
382---- a/src/nm-manager.c
383-+++ b/src/nm-manager.c
384-@@ -2099,6 +2099,12 @@ platform_link_added (NMManager *self,
385- }
386- }
387-
388-+ /* Ignore rmnet_usb devices, which will be handled by their modem parent
389-+ */
390-+ if (!strncmp (plink->name, "rmnet_usb", NM_STRLEN ("rmnet_usb")) ||
391-+ !strncmp (plink->name, "ccmni", NM_STRLEN ("ccmni")))
392-+ return;
393-+
394- if (device == NULL) {
395- switch (plink->type) {
396- case NM_LINK_TYPE_WWAN_ETHERNET:
397diff --git a/debian/patches/Modify-NMDeviceModem-s-available-logic.patch b/debian/patches/Modify-NMDeviceModem-s-available-logic.patch
398index 1630362..6f5a018 100644
399--- a/debian/patches/Modify-NMDeviceModem-s-available-logic.patch
400+++ b/debian/patches/Modify-NMDeviceModem-s-available-logic.patch
401@@ -9,16 +9,16 @@ meaning the device is in such a state that it can be activated.
402 This change prevents NM from trying to activate a modem which
403 is not yet ready to be activated.
404
405-Bug: https://bugs.launchpad.net/ubuntu/+source/network-manager/+bug/1445080
406+Bug-Ubuntu: https://bugs.launchpad.net/bugs/1445080
407 ---
408 src/devices/wwan/nm-device-modem.c | 7 ++++---
409 1 file changed, 4 insertions(+), 3 deletions(-)
410
411 diff --git a/src/devices/wwan/nm-device-modem.c b/src/devices/wwan/nm-device-modem.c
412-index a7523f5..774fd24 100644
413+index 39a34db..3bbd170 100644
414 --- a/src/devices/wwan/nm-device-modem.c
415 +++ b/src/devices/wwan/nm-device-modem.c
416-@@ -428,14 +428,15 @@ check_connection_available (NMDevice *device,
417+@@ -410,14 +410,15 @@ check_connection_available (NMDevice *device,
418 return FALSE;
419
420 state = nm_modem_get_state (priv->modem);
421@@ -36,7 +36,7 @@ index a7523f5..774fd24 100644
422 return TRUE;
423 }
424
425-@@ -616,7 +617,7 @@ is_available (NMDevice *device, NMDeviceCheckDevAvailableFlags flags)
426+@@ -598,7 +599,7 @@ is_available (NMDevice *device, NMDeviceCheckDevAvailableFlags flags)
427
428 g_assert (priv->modem);
429 modem_state = nm_modem_get_state (priv->modem);
430diff --git a/debian/patches/Order-IPv6-nameservers-before-IPv4-for-dns-plugins-d.patch b/debian/patches/Order-IPv6-nameservers-before-IPv4-for-dns-plugins-d.patch
431index 83d8940..0d67e33 100644
432--- a/debian/patches/Order-IPv6-nameservers-before-IPv4-for-dns-plugins-d.patch
433+++ b/debian/patches/Order-IPv6-nameservers-before-IPv4-for-dns-plugins-d.patch
434@@ -13,6 +13,8 @@ This is a very simple implementation of such re-ordering, just add the IPv6
435 nameservers first when building the list of IP configurations (which will
436 include nameservers, search domains, etc.), the IPv4 data will be appended
437 right after.
438+
439+Bug-Ubuntu: https://bugs.launchpad.net/bugs/936712
440 ---
441 src/dns-manager/nm-dns-manager.c | 8 ++++----
442 1 file changed, 4 insertions(+), 4 deletions(-)
443diff --git a/debian/patches/Track-killswitch-change-signals-from-urfkill.patch b/debian/patches/Track-killswitch-change-signals-from-urfkill.patch
444index 45b668e..f96673b 100644
445--- a/debian/patches/Track-killswitch-change-signals-from-urfkill.patch
446+++ b/debian/patches/Track-killswitch-change-signals-from-urfkill.patch
447@@ -79,7 +79,7 @@ index 2495bbc..49028f1 100644
448 if SUSPEND_RESUME_UPOWER
449 libNetworkManager_la_SOURCES += nm-sleep-monitor-upower.c
450 diff --git a/src/nm-manager.c b/src/nm-manager.c
451-index b770139..04b0a43 100644
452+index 8cf70c7..8f45b0f 100644
453 --- a/src/nm-manager.c
454 +++ b/src/nm-manager.c
455 @@ -34,6 +34,7 @@
456@@ -108,7 +108,7 @@ index b770139..04b0a43 100644
457
458 gboolean startup;
459 gboolean devices_inited;
460-@@ -5210,6 +5215,49 @@ dbus_connection_changed_cb (NMBusManager *dbus_mgr,
461+@@ -5213,6 +5218,49 @@ dbus_connection_changed_cb (NMBusManager *dbus_mgr,
462
463 /**********************************************************************/
464
465@@ -158,7 +158,7 @@ index b770139..04b0a43 100644
466 NM_DEFINE_SINGLETON_REGISTER (NMManager);
467
468 NMManager *
469-@@ -5231,6 +5279,44 @@ nm_connection_provider_get (void)
470+@@ -5234,6 +5282,44 @@ nm_connection_provider_get (void)
471 return p;
472 }
473
474@@ -203,7 +203,7 @@ index b770139..04b0a43 100644
475 NMManager *
476 nm_manager_setup (const char *state_file,
477 gboolean initial_net_enabled,
478-@@ -5311,16 +5397,38 @@ constructed (GObject *object)
479+@@ -5314,16 +5400,38 @@ constructed (GObject *object)
480 "rfkill-changed",
481 G_CALLBACK (rfkill_manager_rfkill_changed_cb),
482 self);
483diff --git a/debian/patches/Update-dnsmasq-parameters.patch b/debian/patches/Update-dnsmasq-parameters.patch
484index 20d8f91..3b83b82 100644
485--- a/debian/patches/Update-dnsmasq-parameters.patch
486+++ b/debian/patches/Update-dnsmasq-parameters.patch
487@@ -6,7 +6,7 @@ Disable caching since it's a potential security issue (local dns cache poisoning
488
489 See also: https://blueprints.launchpad.net/ubuntu/+spec/foundations-p-dns-resolving
490
491-=== modified file 'src/dns-manager/nm-dns-dnsmasq.c'
492+Bug-Ubuntu: https://bugs.launchpad.net/bugs/903854
493 ---
494 src/dns-manager/nm-dns-dnsmasq.c | 4 ++--
495 src/dns-manager/nm-dns-manager.c | 6 +++---
496diff --git a/debian/patches/series b/debian/patches/series
497index 3e1150b..4657321 100644
498--- a/debian/patches/series
499+++ b/debian/patches/series
500@@ -12,14 +12,18 @@ Order-IPv6-nameservers-before-IPv4-for-dns-plugins-d.patch
501 Revert-wifi-disable-Ad-Hoc-WPA-connections-lp-905748.patch
502 Replace-Ad-Hoc-WPA-None-support-with-IBSS-RSN-PSK.patch
503 wifi-Signal-on-the-wifi-device-when-its-supplicant-i.patch
504-Ignore-rmnet_usbX-devices.patch
505-Ignore-p2p0-wifi-devices-from-android.patch
506+Ignore-rild-modem-devices.patch
507+Ignore-p2p-wifi-devices-from-android.patch
508 wwan-add-support-for-using-oFono-as-a-modem-manager.patch
509 Add-new-NMSettingsConnection-reset_retries-get-set-m.patch
510 Let-NetworkManager-read-oFono-settings-file-and-crea.patch
511+Add-modem-reconnect-delay-to-policy.patch
512 Modify-NMDeviceModem-s-available-logic.patch
513 Track-killswitch-change-signals-from-urfkill.patch
514 Only-test-team-devices-if-we-built-support-for-them.patch
515 Disable-general-with-expect-which-tends-to-fail-on-p.patch
516 libnm-Check-self-still-NMManager-or-not.patch
517 libnm-don-t-require-initialized-out_encrypted-argume.patch
518+Clear-WiFi-requested_scan-if-suppl-goes-INACTIVE.patch
519+Clear-WiFi-requested_scan-if-suppl-exits.patch
520+wwan-fix-ofono-connection-problems.patch
521diff --git a/debian/patches/wwan-add-support-for-using-oFono-as-a-modem-manager.patch b/debian/patches/wwan-add-support-for-using-oFono-as-a-modem-manager.patch
522index cd18c65..377ec85 100644
523--- a/debian/patches/wwan-add-support-for-using-oFono-as-a-modem-manager.patch
524+++ b/debian/patches/wwan-add-support-for-using-oFono-as-a-modem-manager.patch
525@@ -8,13 +8,13 @@ Signed-off-by: Mathieu Trudel-Lapierre <mathieu.trudel-lapierre@canonical.com>
526 ---
527 configure.ac | 9 +
528 src/devices/wwan/Makefile.am | 7 +
529- src/devices/wwan/nm-device-modem.c | 20 +
530- src/devices/wwan/nm-modem-manager.c | 220 +++++-
531- src/devices/wwan/nm-modem-ofono.c | 1449 +++++++++++++++++++++++++++++++++++
532+ src/devices/wwan/nm-device-modem.c | 2 +
533+ src/devices/wwan/nm-modem-manager.c | 241 +++++-
534+ src/devices/wwan/nm-modem-ofono.c | 1436 +++++++++++++++++++++++++++++++++++
535 src/devices/wwan/nm-modem-ofono.h | 64 ++
536 src/devices/wwan/nm-modem.c | 8 +-
537 src/nm-core-utils.c | 20 +-
538- 8 files changed, 1787 insertions(+), 10 deletions(-)
539+ 8 files changed, 1766 insertions(+), 21 deletions(-)
540 create mode 100644 src/devices/wwan/nm-modem-ofono.c
541 create mode 100644 src/devices/wwan/nm-modem-ofono.h
542
543@@ -57,7 +57,7 @@ index 1777eb3..65d9952 100644
544
545 libnm_wwan_la_LDFLAGS = \
546 diff --git a/src/devices/wwan/nm-device-modem.c b/src/devices/wwan/nm-device-modem.c
547-index a8361c4..a7523f5 100644
548+index a8361c4..39a34db 100644
549 --- a/src/devices/wwan/nm-device-modem.c
550 +++ b/src/devices/wwan/nm-device-modem.c
551 @@ -100,6 +100,7 @@ modem_prepare_result (NMModem *modem,
552@@ -68,39 +68,7 @@ index a8361c4..a7523f5 100644
553 if (reason == NM_DEVICE_STATE_REASON_SIM_PIN_INCORRECT) {
554 /* If the connect failed because the SIM PIN was wrong don't allow
555 * the device to be auto-activated anymore, which would risk locking
556-@@ -282,6 +283,16 @@ modem_state_cb (NMModem *modem,
557- }
558- }
559-
560-+ if (dev_state >= NM_DEVICE_STATE_DISCONNECTED &&
561-+ new_state == NM_MODEM_STATE_REGISTERED && old_state < NM_MODEM_STATE_REGISTERED) {
562-+
563-+ nm_log_info (LOGD_MB, "(%s): modem re-registered; re-checking autoconnect",
564-+ nm_device_get_iface (device));
565-+
566-+ g_object_set (G_OBJECT (device), NM_DEVICE_AUTOCONNECT, TRUE, NULL);
567-+ nm_device_emit_recheck_auto_activate (device);
568-+ }
569-+
570- if (new_state < NM_MODEM_STATE_CONNECTING &&
571- old_state >= NM_MODEM_STATE_CONNECTING &&
572- dev_state >= NM_DEVICE_STATE_NEED_AUTH &&
573-@@ -345,6 +356,14 @@ device_state_changed (NMDevice *device,
574- nm_modem_state_to_string (nm_modem_get_state (priv->modem)));
575- }
576-
577-+ /* Block autoconnect until the modem is registered again */
578-+ if (new_state == NM_DEVICE_STATE_FAILED && nm_modem_get_state (priv->modem) == NM_MODEM_STATE_SEARCHING) {
579-+ nm_log_info (LOGD_MB, "(%s): modem searching; disabling autoconnect",
580-+ nm_device_get_iface (device));
581-+
582-+ g_object_set (G_OBJECT (device), NM_DEVICE_AUTOCONNECT, FALSE, NULL);
583-+ }
584-+
585- nm_modem_device_state_changed (priv->modem, new_state, old_state, reason);
586-
587- switch (reason) {
588-@@ -545,6 +564,7 @@ get_ip_iface_identifier (NMDevice *device, NMUtilsIPv6IfaceId *out_iid)
589+@@ -545,6 +546,7 @@ get_ip_iface_identifier (NMDevice *device, NMUtilsIPv6IfaceId *out_iid)
590
591 g_return_val_if_fail (priv->modem, FALSE);
592 success = nm_modem_get_iid (priv->modem, out_iid);
593@@ -109,7 +77,7 @@ index a8361c4..a7523f5 100644
594 success = NM_DEVICE_CLASS (nm_device_modem_parent_class)->get_ip_iface_identifier (device, out_iid);
595 return success;
596 diff --git a/src/devices/wwan/nm-modem-manager.c b/src/devices/wwan/nm-modem-manager.c
597-index 9e9bc13..0d1ec78 100644
598+index 9e9bc13..cd97b87 100644
599 --- a/src/devices/wwan/nm-modem-manager.c
600 +++ b/src/devices/wwan/nm-modem-manager.c
601 @@ -17,7 +17,7 @@
602@@ -251,7 +219,7 @@ index 9e9bc13..0d1ec78 100644
603 +{
604 + gchar *name_owner;
605 +
606-+ name_owner = g_dbus_object_manager_client_get_name_owner (G_DBUS_OBJECT_MANAGER_CLIENT (self->priv->ofono_proxy));
607++ name_owner = g_dbus_proxy_get_name_owner (G_DBUS_PROXY (self->priv->ofono_proxy));
608 + if (name_owner) {
609 + /* Available! */
610 + ofono_appeared (self);
611@@ -324,7 +292,37 @@ index 9e9bc13..0d1ec78 100644
612
613 static void
614 modem_manager_poke_cb (GDBusConnection *connection,
615-@@ -336,22 +518,44 @@ manager_new_ready (GObject *source,
616+@@ -233,19 +415,18 @@ modem_manager_poke_cb (GDBusConnection *connection,
617+
618+ result = g_dbus_connection_call_finish (connection, res, &error);
619+ if (error) {
620+- /* Ignore common errors when MM is not installed and such */
621+- if ( !g_error_matches (error, G_DBUS_ERROR, G_DBUS_ERROR_SERVICE_UNKNOWN)
622+- && !g_error_matches (error, G_DBUS_ERROR, G_DBUS_ERROR_SPAWN_EXEC_FAILED)
623+- && !g_error_matches (error, G_DBUS_ERROR, G_DBUS_ERROR_SPAWN_FORK_FAILED)
624+- && !g_error_matches (error, G_DBUS_ERROR, G_DBUS_ERROR_SPAWN_FAILED)
625+- && !g_error_matches (error, G_DBUS_ERROR, G_DBUS_ERROR_TIMEOUT)
626+- && !g_error_matches (error, G_DBUS_ERROR, G_DBUS_ERROR_SPAWN_SERVICE_NOT_FOUND)) {
627+- nm_log_dbg (LOGD_MB, "error poking ModemManager: %s", error->message);
628++ nm_log_warn (LOGD_MB, "error poking ModemManager: %s",
629++ error ? error->message : "");
630++
631++ /* Don't reschedule poke is MM service doesn't exist. */
632++ if (!g_error_matches (error, G_DBUS_ERROR, G_DBUS_ERROR_SERVICE_UNKNOWN)
633++ && !g_error_matches (error, G_DBUS_ERROR, G_DBUS_ERROR_SPAWN_SERVICE_NOT_FOUND)) {
634++
635++ /* Setup timeout to relaunch */
636++ schedule_modem_manager_relaunch (self, MODEM_POKE_INTERVAL);
637+ }
638+- g_error_free (error);
639+
640+- /* Setup timeout to relaunch */
641+- schedule_modem_manager_relaunch (self, MODEM_POKE_INTERVAL);
642++ g_error_free (error);
643+ } else
644+ g_variant_unref (result);
645+
646+@@ -336,22 +517,44 @@ manager_new_ready (GObject *source,
647 static void
648 ensure_client (NMModemManager *self)
649 {
650@@ -373,7 +371,7 @@ index 9e9bc13..0d1ec78 100644
651 }
652
653 static void
654-@@ -430,6 +634,12 @@ dispose (GObject *object)
655+@@ -430,6 +633,12 @@ dispose (GObject *object)
656
657 modem_manager_clear_signals (self);
658 g_clear_object (&self->priv->modem_manager);
659@@ -388,10 +386,10 @@ index 9e9bc13..0d1ec78 100644
660 if (self->priv->modems) {
661 diff --git a/src/devices/wwan/nm-modem-ofono.c b/src/devices/wwan/nm-modem-ofono.c
662 new file mode 100644
663-index 0000000..162b88d
664+index 0000000..4566be0
665 --- /dev/null
666 +++ b/src/devices/wwan/nm-modem-ofono.c
667-@@ -0,0 +1,1449 @@
668+@@ -0,0 +1,1436 @@
669 +/* -*- Mode: C; tab-width: 4; indent-tabs-mode: t; c-basic-offset: 4 -*- */
670 +/* NetworkManager -- Network link manager
671 + *
672@@ -604,12 +602,7 @@ index 0000000..162b88d
673 + nm_log_dbg (LOGD_MB, "(%s): modem disconnected",
674 + nm_modem_get_uid (NM_MODEM (self)));
675 +
676-+ /* NOTES(1.2): This doesn't accomplish anything as none of the attributes that
677-+ * are checked by update_modem_state are changed by this function!
678-+ *
679-+ * update_modem_state (self);
680-+ */
681-+
682++ update_modem_state (self);
683 + disconnect_context_complete (ctx);
684 +}
685 +
686@@ -784,7 +777,7 @@ index 0000000..162b88d
687 + &error);
688 + if (!v_properties) {
689 + g_dbus_error_strip_remote_error (error);
690-+ nm_log_warn (LOGD_BT, "(%s) error getting sim properties: %s",
691++ nm_log_warn (LOGD_MB, "(%s) error getting sim properties: %s",
692 + nm_modem_get_uid (NM_MODEM (self)),
693 + error->message);
694 + g_error_free (error);
695@@ -795,7 +788,7 @@ index 0000000..162b88d
696 +
697 + v_dict = g_variant_get_child_value (v_properties, 0);
698 + if (!v_dict) {
699-+ nm_log_warn (LOGD_BT, "(%s) error getting sim properties: no v_dict",
700++ nm_log_warn (LOGD_MB, "(%s) error getting sim properties: no v_dict",
701 + nm_modem_get_uid (NM_MODEM (self)));
702 + return;
703 + }
704@@ -897,7 +890,7 @@ index 0000000..162b88d
705 + gboolean attached = g_variant_get_boolean (v);
706 +
707 + nm_log_dbg (LOGD_MB, "(%s): Attached: %s",
708-+ nm_modem_get_uid (NM_MODEM (self)), property ? "True" : "False");
709++ nm_modem_get_uid (NM_MODEM (self)), attached ? "True" : "False");
710 +
711 + if (priv->gprs_attached != attached) {
712 + priv->gprs_attached = attached;
713@@ -941,7 +934,7 @@ index 0000000..162b88d
714 + &error);
715 + if (!v_properties) {
716 + g_dbus_error_strip_remote_error (error);
717-+ nm_log_warn (LOGD_BT, "(%s) error getting connman properties: %s",
718++ nm_log_warn (LOGD_MB, "(%s) error getting connman properties: %s",
719 + nm_modem_get_uid (NM_MODEM (self)),
720 + error->message);
721 + g_error_free (error);
722@@ -1121,7 +1114,7 @@ index 0000000..162b88d
723 + &error);
724 + if (!v_properties) {
725 + g_dbus_error_strip_remote_error (error);
726-+ nm_log_warn (LOGD_BT, "(%s) error getting modem properties: %s",
727++ nm_log_warn (LOGD_MB, "(%s) error getting modem properties: %s",
728 + nm_modem_get_uid (NM_MODEM (self)),
729 + error->message);
730 + g_error_free (error);
731@@ -1130,7 +1123,7 @@ index 0000000..162b88d
732 +
733 + v_dict = g_variant_get_child_value (v_properties, 0);
734 + if (!v_dict) {
735-+ nm_log_warn (LOGD_BT, "(%s) error getting modem properties: no v_dict",
736++ nm_log_warn (LOGD_MB, "(%s) error getting modem properties: no v_dict",
737 + nm_modem_get_uid (NM_MODEM (self)));
738 + return;
739 + }
740@@ -1226,14 +1219,6 @@ index 0000000..162b88d
741 + nm_log_dbg (LOGD_MB, "PropertyChanged: %s", property);
742 +
743 + /*
744-+ * 0.9.10.x:
745-+ *
746-+ * The old code got PropertyChanged for Settings, and then immediately
747-+ * called 'GetProperties' to get the current values of 'Settings'.
748-+ *
749-+ * There's no need to do this, as the PropertyChanged has the value of
750-+ * 'Settings' as its payload!!!
751-+ *
752 + * TODO: might be a good idea and re-factor this to mimic bluez-device,
753 + * ie. have this function just check the key, and call a sub-func to
754 + * handle the action.
755@@ -1242,24 +1227,14 @@ index 0000000..162b88d
756 + if (g_strcmp0 (property, "Settings") != 0)
757 + return;
758 +
759-+ nm_log_dbg (LOGD_MB, "found 'Settings' DICTIONARY property");
760-+
761-+ if (nm_modem_get_state (NM_MODEM (self)) == NM_MODEM_STATE_CONNECTED && g_variant_n_children (v) <= 0) {
762-+ nm_log_warn (LOGD_MB, "ofono: (%s): Settings empty", nm_modem_get_uid (NM_MODEM (self)));
763-+
764-+ goto out;
765-+ }
766-+
767-+ nm_log_info (LOGD_MB, "ofono: (%s): IPv4 static configuration:", nm_modem_get_uid (NM_MODEM (self)));
768-+
769 + v_dict = g_variant_get_child_value (v, 0);
770 + if (!v_dict) {
771-+ nm_log_warn (LOGD_BT, "ofono: (%s): error getting IPv4 Settings: no v_dict",
772++ nm_log_warn (LOGD_MB, "ofono: (%s): error getting IPv4 Settings",
773 + nm_modem_get_uid (NM_MODEM (self)));
774-+ return;
775++ goto out;
776 + }
777 +
778-+ /* NOTE - 0.9.10x code didn't fail if 'Interface' missing */
779++ nm_log_info (LOGD_MB, "ofono: (%s): IPv4 static Settings:", nm_modem_get_uid (NM_MODEM (self)));
780 +
781 + if (g_variant_lookup (v_dict, "Interface", "&s", &s)) {
782 +
783@@ -1271,7 +1246,7 @@ index 0000000..162b88d
784 + NM_MODEM_IP4_METHOD, NM_MODEM_IP_METHOD_STATIC,
785 + NULL);
786 + } else {
787-+ nm_log_warn (LOGD_BT, "ofono: (%s): Settings 'Interface'; empty",
788++ nm_log_warn (LOGD_MB, "ofono: (%s): Settings 'Interface'; empty",
789 + nm_modem_get_uid (NM_MODEM (self)));
790 + goto out;
791 + }
792@@ -1323,6 +1298,7 @@ index 0000000..162b88d
793 + } else {
794 + nm_log_warn (LOGD_MB, "ofono: (%s): Settings 'Address' missing",
795 + nm_modem_get_uid (NM_MODEM (self)));
796++ goto out;
797 + }
798 +
799 + if (g_variant_lookup (v_dict, "Netmask", "&s", &s)) {
800@@ -1345,7 +1321,9 @@ index 0000000..162b88d
801 + goto out;
802 + }
803 +
804-+ nm_log_info (LOGD_MB, " address %s/%d", addr_s, prefix);
805++ nm_log_info (LOGD_MB, "ofono (%s) Address: %s/%d",
806++ nm_modem_get_uid (NM_MODEM (self)), addr_s, prefix);
807++
808 + nm_ip4_config_add_address (priv->ip4_config, &addr);
809 +
810 + if (g_variant_lookup (v_dict, "Gateway", "&s", &s)) {
811@@ -1372,7 +1350,7 @@ index 0000000..162b88d
812 +
813 + while (*iter) {
814 + if (ip_string_to_network_address (*iter, &address_network) && address_network > 0) {
815-+ nm_log_info (LOGD_MB, "ofono: (%s): DNS %s",
816++ nm_log_info (LOGD_MB, "ofono: (%s): DNS: %s",
817 + nm_modem_get_uid (NM_MODEM (self)), *iter);
818 +
819 + nm_ip4_config_add_nameserver (priv->ip4_config, address_network);
820@@ -1384,13 +1362,15 @@ index 0000000..162b88d
821 + *iter++;
822 + }
823 +
824-+ /* TOOD: check for minimum NameServers >= 1? */
825++ if (iter == array) {
826++ nm_log_warn (LOGD_MB, "ofono: (%s): Settings: 'DomainNameServers': none specified",
827++ nm_modem_get_uid (NM_MODEM (self)));
828++ g_free (array);
829++ goto out;
830++ }
831 +
832 + g_free (array);
833 + } else {
834-+
835-+ /* NOTE - 0.9.10.x would not throw an error in this case!!! */
836-+
837 + nm_log_warn (LOGD_MB, "ofono: (%s): Settings 'DomainNameServers' missing",
838 + nm_modem_get_uid (NM_MODEM (self)));
839 + goto out;
840@@ -1419,14 +1399,19 @@ index 0000000..162b88d
841 + ret = TRUE;
842 +
843 +out:
844-+ if (!ret)
845-+ reason = NM_DEVICE_STATE_REASON_IP_CONFIG_UNAVAILABLE;
846++ if (nm_modem_get_state (NM_MODEM (self)) != NM_MODEM_STATE_CONNECTED) {
847++ nm_log_info (LOGD_MB, "ofono: (%s): emitting PREPARE_RESULT: %s",
848++ nm_modem_get_uid (NM_MODEM (self)), ret ? "TRUE" : "FALSE");
849 +
850-+ nm_log_dbg (LOGD_MB, "(%s): DONE w/Settings; ret: %s",
851-+ nm_modem_get_uid (NM_MODEM (self)), ret ? "TRUE" : "FALSE");
852++ if (!ret)
853++ reason = NM_DEVICE_STATE_REASON_IP_CONFIG_UNAVAILABLE;
854 +
855-+ if (nm_modem_get_state (NM_MODEM (self)) != NM_MODEM_STATE_CONNECTED)
856 + g_signal_emit_by_name (self, NM_MODEM_PREPARE_RESULT, ret, reason);
857++ } else {
858++ nm_log_warn (LOGD_MB, "ofono: (%s): MODEM_PPP_FAILED", nm_modem_get_uid (NM_MODEM (self)));
859++
860++ g_signal_emit_by_name (self, NM_MODEM_PPP_FAILED, NM_DEVICE_STATE_REASON_PPP_FAILED);
861++ }
862 +}
863 +
864 +static NMActStageReturn
865diff --git a/debian/patches/wwan-fix-ofono-connection-problems.patch b/debian/patches/wwan-fix-ofono-connection-problems.patch
866new file mode 100644
867index 0000000..bff500d
868--- /dev/null
869+++ b/debian/patches/wwan-fix-ofono-connection-problems.patch
870@@ -0,0 +1,343 @@
871+From: Tony Espy <espy@canonical.com>
872+Date: Fri, 3 Jun 2016 18:03:32 -0400
873+Subject: Fix ofono connection problems
874+
875+This patch fixes three (re) connection problems with
876+the ofono plugin:
877+
878+1) If the modem is connected, and registrations drops,
879+and then is restored, the connection isn't re-activated.
880+The fix was simply to change modem_state_cb to not return
881+after setting the state to failed, which allows nm_device_
882+queue_recheck_available to be called, which queues a state
883+transition to UNAVAILABLE.
884+
885+2) If ofono returns InProgress, don't treat as a PREPARE_FAILURE.
886+
887+3) If the ofono conext is already active, use it's existing
888+'Settings' property to configure the device.
889+
890+Bug-Ubuntu: https://bugs.launchpad.net/bugs/1565717
891+Bug-Ubuntu: https://bugs.launchpad.net/bugs/1579098
892+---
893+ src/devices/wwan/nm-device-modem.c | 4 +-
894+ src/devices/wwan/nm-modem-ofono.c | 193 +++++++++++++++++++++++++++----------
895+ src/devices/wwan/nm-modem-ofono.h | 2 +
896+ 3 files changed, 145 insertions(+), 54 deletions(-)
897+
898+diff --git a/src/devices/wwan/nm-device-modem.c b/src/devices/wwan/nm-device-modem.c
899+index 3bbd170..22009f8 100644
900+--- a/src/devices/wwan/nm-device-modem.c
901++++ b/src/devices/wwan/nm-device-modem.c
902+@@ -286,12 +286,10 @@ modem_state_cb (NMModem *modem,
903+ if (new_state < NM_MODEM_STATE_CONNECTING &&
904+ old_state >= NM_MODEM_STATE_CONNECTING &&
905+ dev_state >= NM_DEVICE_STATE_NEED_AUTH &&
906+- dev_state <= NM_DEVICE_STATE_ACTIVATED) {
907++ dev_state <= NM_DEVICE_STATE_ACTIVATED)
908+ /* Fail the device if the modem disconnects unexpectedly while the
909+ * device is activating/activated. */
910+ nm_device_state_changed (device, NM_DEVICE_STATE_FAILED, NM_DEVICE_STATE_REASON_MODEM_NO_CARRIER);
911+- return;
912+- }
913+
914+ if (new_state > NM_MODEM_STATE_LOCKED && old_state == NM_MODEM_STATE_LOCKED) {
915+ /* If the modem is now unlocked, enable/disable it according to the
916+diff --git a/src/devices/wwan/nm-modem-ofono.c b/src/devices/wwan/nm-modem-ofono.c
917+index 4566be0..c09cfd5 100644
918+--- a/src/devices/wwan/nm-modem-ofono.c
919++++ b/src/devices/wwan/nm-modem-ofono.c
920+@@ -789,42 +789,35 @@ stage1_prepare_done (GDBusProxy *proxy, GAsyncResult *result, gpointer user_data
921+ g_dbus_proxy_call_finish (proxy, result, &error);
922+
923+ if (error) {
924+- nm_log_warn (LOGD_MB, "ofono: connection failed: (%d) %s",
925+- error ? error->code : -1,
926+- error && error->message ? error->message : "(unknown)");
927++ if (!g_strstr_len (error->message, NM_STRLEN (OFONO_ERROR_IN_PROGRESS), OFONO_ERROR_IN_PROGRESS)) {
928++ nm_log_warn (LOGD_MB, "ofono: connection failed: (%d) %s",
929++ error ? error->code : -1,
930++ error && error->message ? error->message : "(unknown)");
931+
932+- g_signal_emit_by_name (self, NM_MODEM_PREPARE_RESULT, FALSE,
933+- NM_DEVICE_STATE_REASON_MODEM_BUSY);
934+- /*
935+- * FIXME: add code to check for InProgress so that the
936+- * connection doesn't continue to try and activate,
937+- * leading to the connection being disabled, and a 5m
938+- * timeout...
939+- */
940++ g_signal_emit_by_name (self, NM_MODEM_PREPARE_RESULT, FALSE,
941++ NM_DEVICE_STATE_REASON_MODEM_BUSY);
942++ } else
943++ nm_log_warn (LOGD_MB, "ofono: connection activation returned Error.InProgress");
944+
945+ g_clear_error (&error);
946+ }
947+ }
948+
949+ static void
950+-context_property_changed (GDBusProxy *proxy,
951+- const char *property,
952+- GVariant *v,
953+- gpointer user_data)
954++handle_settings (GVariant *v_dict, gpointer user_data)
955+ {
956+ NMModemOfono *self = NM_MODEM_OFONO (user_data);
957+ NMModemOfonoPrivate *priv = NM_MODEM_OFONO_GET_PRIVATE (self);
958+ NMDeviceStateReason reason = NM_DEVICE_STATE_REASON_NONE;
959+ NMPlatformIP4Address addr;
960+ gboolean ret = FALSE;
961+- GVariant *v_dict;
962+ GVariantIter i;
963+ const gchar *s, *addr_s;
964+ const gchar **array, **iter;
965+ guint32 address_network, gateway_network;
966+ guint prefix = 0;
967+
968+- nm_log_dbg (LOGD_MB, "PropertyChanged: %s", property);
969++ nm_log_info (LOGD_MB, "ofono: (%s): IPv4 static Settings:", nm_modem_get_uid (NM_MODEM (self)));
970+
971+ /*
972+ * TODO: might be a good idea and re-factor this to mimic bluez-device,
973+@@ -832,18 +825,6 @@ context_property_changed (GDBusProxy *proxy,
974+ * handle the action.
975+ */
976+
977+- if (g_strcmp0 (property, "Settings") != 0)
978+- return;
979+-
980+- v_dict = g_variant_get_child_value (v, 0);
981+- if (!v_dict) {
982+- nm_log_warn (LOGD_MB, "ofono: (%s): error getting IPv4 Settings",
983+- nm_modem_get_uid (NM_MODEM (self)));
984+- goto out;
985+- }
986+-
987+- nm_log_info (LOGD_MB, "ofono: (%s): IPv4 static Settings:", nm_modem_get_uid (NM_MODEM (self)));
988+-
989+ if (g_variant_lookup (v_dict, "Interface", "&s", &s)) {
990+
991+ nm_log_dbg (LOGD_MB, "(%s): Interface: %s", nm_modem_get_uid (NM_MODEM (self)), s);
992+@@ -930,8 +911,7 @@ context_property_changed (GDBusProxy *proxy,
993+ }
994+
995+ nm_log_info (LOGD_MB, "ofono (%s) Address: %s/%d",
996+- nm_modem_get_uid (NM_MODEM (self)), addr_s, prefix);
997+-
998++ nm_modem_get_uid (NM_MODEM (self)), addr_s, prefix);
999+ nm_ip4_config_add_address (priv->ip4_config, &addr);
1000+
1001+ if (g_variant_lookup (v_dict, "Gateway", "&s", &s)) {
1002+@@ -972,7 +952,7 @@ context_property_changed (GDBusProxy *proxy,
1003+
1004+ if (iter == array) {
1005+ nm_log_warn (LOGD_MB, "ofono: (%s): Settings: 'DomainNameServers': none specified",
1006+- nm_modem_get_uid (NM_MODEM (self)));
1007++ nm_modem_get_uid (NM_MODEM (self)));
1008+ g_free (array);
1009+ goto out;
1010+ }
1011+@@ -1009,7 +989,7 @@ context_property_changed (GDBusProxy *proxy,
1012+ out:
1013+ if (nm_modem_get_state (NM_MODEM (self)) != NM_MODEM_STATE_CONNECTED) {
1014+ nm_log_info (LOGD_MB, "ofono: (%s): emitting PREPARE_RESULT: %s",
1015+- nm_modem_get_uid (NM_MODEM (self)), ret ? "TRUE" : "FALSE");
1016++ nm_modem_get_uid (NM_MODEM (self)), ret ? "TRUE" : "FALSE");
1017+
1018+ if (!ret)
1019+ reason = NM_DEVICE_STATE_REASON_IP_CONFIG_UNAVAILABLE;
1020+@@ -1022,6 +1002,33 @@ out:
1021+ }
1022+ }
1023+
1024++static void
1025++context_property_changed (GDBusProxy *proxy,
1026++ const char *property,
1027++ GVariant *v,
1028++ gpointer user_data)
1029++{
1030++ NMModemOfono *self = NM_MODEM_OFONO (user_data);
1031++ GVariant *v_dict;
1032++
1033++ nm_log_dbg (LOGD_MB, "PropertyChanged: %s", property);
1034++
1035++ if (g_strcmp0 (property, "Settings") != 0)
1036++ return;
1037++
1038++ v_dict = g_variant_get_child_value (v, 0);
1039++ if (!v_dict) {
1040++ nm_log_warn (LOGD_MB, "ofono: (%s): error getting IPv4 Settings",
1041++ nm_modem_get_uid (NM_MODEM (self)));
1042++ return;
1043++ }
1044++
1045++ g_assert (g_variant_is_of_type (v_dict, G_VARIANT_TYPE_VARDICT));
1046++
1047++ handle_settings (v_dict, user_data);
1048++ g_variant_unref (v_dict);
1049++}
1050++
1051+ static NMActStageReturn
1052+ static_stage3_ip4_config_start (NMModem *_self,
1053+ NMActRequest *req,
1054+@@ -1053,11 +1060,100 @@ static_stage3_ip4_config_start (NMModem *_self,
1055+ }
1056+
1057+ static void
1058++context_properties_cb (GDBusProxy *proxy, GAsyncResult *result, gpointer user_data)
1059++{
1060++ NMModemOfono *self = NM_MODEM_OFONO (user_data);
1061++ NMModemOfonoPrivate *priv = NM_MODEM_OFONO_GET_PRIVATE (self);
1062++ GError *error = NULL;
1063++ GVariant *properties, *settings;
1064++ GVariant *v_dict = NULL;
1065++ gboolean active;
1066++
1067++ nm_log_dbg (LOGD_MB, "in %s", __func__);
1068++
1069++ properties = g_dbus_proxy_call_finish (proxy, result, &error);
1070++
1071++ if (error) {
1072++ nm_log_warn (LOGD_MB, "ofono: connection failed; couldn't read context properties (%d) %s",
1073++ error ? error->code : -1,
1074++ error && error->message ? error->message : "(unknown)");
1075++
1076++ g_clear_error (&error);
1077++ goto error;
1078++ }
1079++
1080++ if (properties == NULL) {
1081++ nm_log_warn (LOGD_MB, "ofono: connection failed; no context properties returned");
1082++ goto error;
1083++ }
1084++
1085++ v_dict = g_variant_get_child_value (properties, 0);
1086++ g_assert (v_dict);
1087++ g_assert (g_variant_is_of_type (v_dict, G_VARIANT_TYPE_VARDICT));
1088++
1089++ g_variant_unref (properties);
1090++
1091++ if (!g_variant_lookup (v_dict, "Active", "b", &active)) {
1092++ nm_log_warn (LOGD_MB, "ofono: connection failed; can't read 'Active' property");
1093++ goto error;
1094++ }
1095++
1096++ /* Watch for custom ofono PropertyChanged signals */
1097++ _nm_dbus_signal_connect (priv->context_proxy,
1098++ "PropertyChanged",
1099++ G_VARIANT_TYPE ("(sv)"),
1100++ G_CALLBACK (context_property_changed),
1101++ self);
1102++
1103++ if (active) {
1104++ nm_log_dbg (LOGD_MB, "connection is already Active");
1105++
1106++ settings = g_variant_lookup_value (v_dict, "Settings", G_VARIANT_TYPE_VARDICT);
1107++ if (settings == NULL) {
1108++ nm_log_warn (LOGD_MB, "ofono: connection failed; can't read 'Settings' property");
1109++ goto error;
1110++ }
1111++
1112++ handle_settings (settings, user_data);
1113++ g_variant_unref (settings);
1114++
1115++ } else
1116++ g_dbus_proxy_call (priv->context_proxy,
1117++ "SetProperty",
1118++ g_variant_new ("(sv)",
1119++ "Active",
1120++ g_variant_new ("b", TRUE)),
1121++ G_DBUS_CALL_FLAGS_NONE,
1122++ 20000,
1123++ NULL,
1124++ (GAsyncReadyCallback) stage1_prepare_done,
1125++ g_object_ref (self));
1126++
1127++ g_variant_unref (v_dict);
1128++
1129++ return;
1130++
1131++error:
1132++ if (properties)
1133++ g_variant_unref (properties);
1134++
1135++ if (v_dict)
1136++ g_variant_unref (v_dict);
1137++
1138++ g_signal_emit_by_name (self, NM_MODEM_PREPARE_RESULT, FALSE,
1139++ NM_DEVICE_STATE_REASON_MODEM_BUSY);
1140++}
1141++
1142++static void
1143+ context_proxy_new_cb (GDBusProxy *proxy, GAsyncResult *result, gpointer user_data)
1144+ {
1145+ NMModemOfono *self = NM_MODEM_OFONO (user_data);
1146+ NMModemOfonoPrivate *priv = NM_MODEM_OFONO_GET_PRIVATE (self);
1147++ gboolean context_active;
1148+ GError *error = NULL;
1149++ GVariant *v_dict;
1150++ GVariant *active_property;
1151++ GVariant *settings_property;
1152+
1153+ nm_log_dbg (LOGD_MB, "%s:", __func__);
1154+
1155+@@ -1087,23 +1183,18 @@ context_proxy_new_cb (GDBusProxy *proxy, GAsyncResult *result, gpointer user_dat
1156+ if (priv->ip4_config)
1157+ g_clear_object (&priv->ip4_config);
1158+
1159+- /* Watch for custom ofono PropertyChanged signals */
1160+- _nm_dbus_signal_connect (priv->context_proxy,
1161+- "PropertyChanged",
1162+- G_VARIANT_TYPE ("(sv)"),
1163+- G_CALLBACK (context_property_changed),
1164+- self);
1165+-
1166++ /* As ofono doesn't properly implement DBus.Properties, we need to
1167++ * query the ConnectionContextinteface directly to get the current
1168++ * property values vs. using g_dbus_proxy_get_cached_property.
1169++ */
1170+ g_dbus_proxy_call (priv->context_proxy,
1171+- "SetProperty",
1172+- g_variant_new ("(sv)",
1173+- "Active",
1174+- g_variant_new ("b", TRUE)),
1175+- G_DBUS_CALL_FLAGS_NONE,
1176+- 20000,
1177+- NULL,
1178+- (GAsyncReadyCallback) stage1_prepare_done,
1179+- g_object_ref (self));
1180++ "GetProperties",
1181++ NULL,
1182++ G_DBUS_CALL_FLAGS_NONE,
1183++ 20000,
1184++ NULL,
1185++ (GAsyncReadyCallback) context_properties_cb,
1186++ g_object_ref (self));
1187+ }
1188+
1189+ static void
1190+@@ -1112,8 +1203,8 @@ do_context_activate (NMModemOfono *self)
1191+ NMModemOfonoPrivate *priv = NM_MODEM_OFONO_GET_PRIVATE (self);
1192+ GValue value = G_VALUE_INIT;
1193+
1194+- g_return_val_if_fail (self != NULL, FALSE);
1195+- g_return_val_if_fail (NM_IS_MODEM_OFONO (self), FALSE);
1196++ g_assert (self != NULL);
1197++ g_assert (NM_IS_MODEM_OFONO (self));
1198+
1199+ nm_log_dbg (LOGD_MB, "in %s", __func__);
1200+
1201+diff --git a/src/devices/wwan/nm-modem-ofono.h b/src/devices/wwan/nm-modem-ofono.h
1202+index fa79e15..02eca11 100644
1203+--- a/src/devices/wwan/nm-modem-ofono.h
1204++++ b/src/devices/wwan/nm-modem-ofono.h
1205+@@ -41,6 +41,8 @@ G_BEGIN_DECLS
1206+ #define OFONO_DBUS_INTERFACE_CONNECTION_CONTEXT "org.ofono.ConnectionContext"
1207+ #define OFONO_DBUS_INTERFACE_SIM_MANAGER "org.ofono.SimManager"
1208+
1209++#define OFONO_ERROR_IN_PROGRESS "org.ofono.Error.InProgress"
1210++
1211+ typedef enum {
1212+ NM_OFONO_ERROR_CONNECTION_NOT_OFONO = 0, /*< nick=ConnectionNotOfono >*/
1213+ NM_OFONO_ERROR_CONNECTION_INVALID, /*< nick=ConnectionInvalid >*/

Subscribers

People subscribed via source and target branches

to all changes: