Merge lp:~phablet-team/network-manager/lp1418077 into lp:~network-manager/network-manager/ubuntu

Proposed by Tony Espy
Status: Merged
Approved by: Ricardo Salveti
Approved revision: no longer in the source branch.
Merged at revision: 955
Proposed branch: lp:~phablet-team/network-manager/lp1418077
Merge into: lp:~network-manager/network-manager/ubuntu
Diff against target: 223 lines (+78/-25)
1 file modified
debian/patches/0001-wwan-add-support-for-using-oFono-as-a-modem-manager.patch (+78/-25)
To merge this branch: bzr merge lp:~phablet-team/network-manager/lp1418077
Reviewer Review Type Date Requested Status
Mathieu Trudel-Lapierre Approve
Ubuntu Phablet Team Pending
Review via email: mp+255285@code.launchpad.net

Description of the change

This merge a fix for lp: #1418077 - NM takes ~5m to reconnect after GPRS detaches.

To post a comment you must log in.
Revision history for this message
Mathieu Trudel-Lapierre (cyphermox) wrote :

I'd much rather we semantically split any cleanup from actual bugfix, both in the interest of readability of the diff as well as to reduce the scope of changes and risk of regression.

review: Needs Fixing
Revision history for this message
Mathieu Trudel-Lapierre (cyphermox) wrote :

These changes might also need to be applied to the RTM branches.

Revision history for this message
Tony Espy (awe) wrote :

AFAIK, we're not doing any more updates to the RTM branch. Also, pretty sure these diffs wouldn't apply as is...

Revision history for this message
Ricardo Salveti (rsalveti) wrote :

Change looks good, need to test it still.

Revision history for this message
Mathieu Trudel-Lapierre (cyphermox) wrote :

Very wise handling of autoconnect there. Has it been discussed with upstream NM developers?

Changes look fine to me, modulo inline comments.

review: Needs Information
Revision history for this message
Tony Espy (awe) wrote :

Yes, Dan and I discussed, and we iterated over this approach till it worked.

That said, my only concern is whether or not this approach has any negative impact on the modem-manager behavior.

I've responded to the comments inline.

Revision history for this message
Mathieu Trudel-Lapierre (cyphermox) wrote :

I don't know about the impact to MM. It will need to be tested as part of the silo testing.

review: Approve
955. By Tony Espy

Fix ofono mobile-data 5m reconnect bug (LP: #1418077)

This change fixes a bug that occurs when the modem detaches
from GPRS due to signal loss, or a settings change (eg. radio
tech). Now when this happens, the connection's autoconnect
flag is set to FALSE. When re-attachment occurs, the flag
is set to TRUE, and autoconnect is re-triggered. A bug in
the ofono disconnect_done function was also fixed to ensure
the state is updated correctly.

956. By Tony Espy

Increase ofono activation timeout to 40s

Increase the ofono activation timeout to 40
to match the value used by connman.

Revision history for this message
Tony Espy (awe) wrote :

1. Tested on mako ( vivid-proposed #166 ):

 - device boots & mobile data connection established

 - tested bug scenario ( switch radio tech, no 5m delay )

 - tested flight-mode

 - tested switching from wifi to mobile via wifi toggle

2. Tested on krillin ( vivid-proposed #183 ):

 - device boots with SIM in slot1, mobile data connection (2g) established (2)

 - can't test device scenario ( no 3g )

 - tested flight mode (2)

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'debian/patches/0001-wwan-add-support-for-using-oFono-as-a-modem-manager.patch'
2--- debian/patches/0001-wwan-add-support-for-using-oFono-as-a-modem-manager.patch 2015-03-19 20:47:38 +0000
3+++ debian/patches/0001-wwan-add-support-for-using-oFono-as-a-modem-manager.patch 2015-04-10 20:41:03 +0000
4@@ -15,10 +15,10 @@
5 create mode 100644 src/devices/wwan/nm-modem-ofono.c
6 create mode 100644 src/devices/wwan/nm-modem-ofono.h
7
8-Index: b/configure.ac
9+Index: network-manager-0.9.10.0/configure.ac
10 ===================================================================
11---- a/configure.ac
12-+++ b/configure.ac
13+--- network-manager-0.9.10.0.orig/configure.ac
14++++ network-manager-0.9.10.0/configure.ac
15 @@ -593,6 +593,15 @@ else
16 fi
17 AM_CONDITIONAL(WITH_MODEM_MANAGER_1, test "${with_modem_manager_1}" = "yes")
18@@ -35,10 +35,10 @@
19 # DHCP client support
20 AC_ARG_WITH([dhclient], AS_HELP_STRING([--with-dhclient=yes|no|path], [Enable dhclient 4.x support]))
21 AC_ARG_WITH([dhcpcd], AS_HELP_STRING([--with-dhcpcd=yes|no|path], [Enable dhcpcd 4.x support]))
22-Index: b/src/devices/wwan/Makefile.am
23+Index: network-manager-0.9.10.0/src/devices/wwan/Makefile.am
24 ===================================================================
25---- a/src/devices/wwan/Makefile.am
26-+++ b/src/devices/wwan/Makefile.am
27+--- network-manager-0.9.10.0.orig/src/devices/wwan/Makefile.am
28++++ network-manager-0.9.10.0/src/devices/wwan/Makefile.am
29 @@ -49,6 +49,13 @@ libnm_wwan_la_SOURCES += \
30 nm-modem-broadband.h
31 endif
32@@ -53,10 +53,10 @@
33 WWAN_SYMBOL_VIS_FILE=$(srcdir)/wwan-exports.ver
34
35 libnm_wwan_la_LDFLAGS = \
36-Index: b/src/devices/wwan/nm-modem-manager.c
37+Index: network-manager-0.9.10.0/src/devices/wwan/nm-modem-manager.c
38 ===================================================================
39---- a/src/devices/wwan/nm-modem-manager.c
40-+++ b/src/devices/wwan/nm-modem-manager.c
41+--- network-manager-0.9.10.0.orig/src/devices/wwan/nm-modem-manager.c
42++++ network-manager-0.9.10.0/src/devices/wwan/nm-modem-manager.c
43 @@ -17,7 +17,7 @@
44 *
45 * Copyright (C) 2009 - 2014 Red Hat, Inc.
46@@ -300,11 +300,11 @@
47 #if WITH_MODEM_MANAGER_1
48 /* ModemManager >= 0.7 */
49 clear_modem_manager_1_support (self);
50-Index: b/src/devices/wwan/nm-modem-ofono.c
51+Index: network-manager-0.9.10.0/src/devices/wwan/nm-modem-ofono.c
52 ===================================================================
53 --- /dev/null
54-+++ b/src/devices/wwan/nm-modem-ofono.c
55-@@ -0,0 +1,1378 @@
56++++ network-manager-0.9.10.0/src/devices/wwan/nm-modem-ofono.c
57+@@ -0,0 +1,1395 @@
58 +/* -*- Mode: C; tab-width: 4; indent-tabs-mode: t; c-basic-offset: 4 -*- */
59 +/* NetworkManager -- Network link manager
60 + *
61@@ -414,7 +414,7 @@
62 +
63 + NMIP4Config *ip4_config;
64 +
65-+ gboolean state;
66++ gboolean enabled;
67 +} NMModemOfonoPrivate;
68 +
69 +#define NM_OFONO_ERROR (nm_ofono_error_quark ())
70@@ -460,6 +460,7 @@
71 +{
72 + SimpleDisconnectContext *ctx = (SimpleDisconnectContext*) user_data;
73 + NMModemOfono *self = ctx->self;
74++ NMModemState state = nm_modem_get_state (NM_MODEM (self));
75 + GError *error = NULL;
76 +
77 + nm_log_dbg (LOGD_MB, "in %s", __func__);
78@@ -474,9 +475,10 @@
79 +
80 + simple_disconnect_context_free (ctx);
81 +
82-+ nm_modem_set_state (NM_MODEM (self),
83-+ NM_MODEM_STATE_CONNECTED,
84-+ nm_modem_state_to_string (NM_MODEM_STATE_CONNECTED));
85++ if (state != NM_MODEM_STATE_SEARCHING)
86++ nm_modem_set_state (NM_MODEM (self),
87++ NM_MODEM_STATE_REGISTERED,
88++ nm_modem_state_to_string (NM_MODEM_STATE_REGISTERED));
89 +}
90 +
91 +static void
92@@ -539,7 +541,7 @@
93 + NMModemState new_state;
94 + NMDeviceStateReason reason;
95 +
96-+ if (new_enabled == priv->state)
97++ if (new_enabled == priv->enabled)
98 + return;
99 +
100 + if (new_enabled) {
101@@ -559,7 +561,7 @@
102 + new_state,
103 + nm_modem_state_to_string (new_state));
104 +
105-+ priv->state = new_enabled;
106++ priv->enabled = new_enabled;
107 +
108 + nm_log_info (LOGD_MB, "(%s) now in state: %s",
109 + nm_modem_get_path (NM_MODEM (self)),
110@@ -633,7 +635,9 @@
111 + }
112 + else if (g_strcmp0 (key, "Attached") == 0 && G_VALUE_HOLDS_BOOLEAN (value)) {
113 + priv->gprs_attached = g_value_get_boolean (value);
114-+ }
115++ } else
116++ /* No need to update enabled for other property changes */
117++ return;
118 +
119 + update_ofono_enabled (self, priv->modem_online
120 + && priv->gprs_powered
121@@ -875,6 +879,13 @@
122 + g_signal_emit_by_name (self, NM_MODEM_PREPARE_RESULT, FALSE,
123 + NM_DEVICE_STATE_REASON_MODEM_BUSY);
124 +
125++ /*
126++ * FIXME: add code to check for InProgress so that the
127++ * connection doesn't continue to try and activate,
128++ * leading to the connection being disabled, and a 5m
129++ * timeout...
130++ */
131++
132 + g_error_free (error);
133 + }
134 +}
135@@ -1080,7 +1091,7 @@
136 +
137 + dbus_g_proxy_begin_call_with_timeout (priv->context_proxy,
138 + "SetProperty", stage1_prepare_done,
139-+ self, NULL, 20000,
140++ self, NULL, 40000,
141 + G_TYPE_STRING, "Active",
142 + G_TYPE_VALUE, &value,
143 + G_TYPE_INVALID);
144@@ -1550,6 +1561,12 @@
145 + nm_modem_get_path (self),
146 + enabled ? "enabled" : "disabled");
147 +
148++ /*
149++ * FIXME: this is code is a no-op; we should either make
150++ * work, or get rid of this function, or at least remove
151++ * the call to update_ofono_enabled.
152++ */
153++
154 + update_ofono_enabled (NM_MODEM_OFONO (self),
155 + priv->modem_online
156 + && priv->gprs_powered
157@@ -1683,10 +1700,10 @@
158 + //dbus_g_error_domain_register (NM_OFONO_ERROR, NULL, NM_TYPE_OFONO_ERROR);
159 +}
160 +
161-Index: b/src/devices/wwan/nm-modem-ofono.h
162+Index: network-manager-0.9.10.0/src/devices/wwan/nm-modem-ofono.h
163 ===================================================================
164 --- /dev/null
165-+++ b/src/devices/wwan/nm-modem-ofono.h
166++++ network-manager-0.9.10.0/src/devices/wwan/nm-modem-ofono.h
167 @@ -0,0 +1,64 @@
168 +/* -*- Mode: C; tab-width: 4; indent-tabs-mode: t; c-basic-offset: 4 -*- */
169 +/* NetworkManager -- Network link manager
170@@ -1752,10 +1769,10 @@
171 +G_END_DECLS
172 +
173 +#endif /* NM_MODEM_OFONO_H */
174-Index: b/src/NetworkManagerUtils.c
175+Index: network-manager-0.9.10.0/src/NetworkManagerUtils.c
176 ===================================================================
177---- a/src/NetworkManagerUtils.c
178-+++ b/src/NetworkManagerUtils.c
179+--- network-manager-0.9.10.0.orig/src/NetworkManagerUtils.c
180++++ network-manager-0.9.10.0/src/NetworkManagerUtils.c
181 @@ -1221,7 +1221,13 @@ nm_utils_ip6_property_path (const char *
182
183 len = g_snprintf (path, sizeof (path), IPV6_PROPERTY_DIR "%s/%s",
184@@ -1787,3 +1804,39 @@
185 + return name;
186 }
187
188+Index: network-manager-0.9.10.0/src/devices/wwan/nm-device-modem.c
189+===================================================================
190+--- network-manager-0.9.10.0.orig/src/devices/wwan/nm-device-modem.c
191++++ network-manager-0.9.10.0/src/devices/wwan/nm-device-modem.c
192+@@ -201,6 +201,16 @@ modem_state_cb (NMModem *modem,
193+ }
194+ }
195+
196++ if (dev_state >= NM_DEVICE_STATE_DISCONNECTED &&
197++ new_state == NM_MODEM_STATE_REGISTERED && old_state < NM_MODEM_STATE_REGISTERED) {
198++
199++ nm_log_info (LOGD_MB, "(%s): modem re-registered; re-checking autoconnect",
200++ nm_device_get_iface (device));
201++
202++ g_object_set (G_OBJECT (device), NM_DEVICE_AUTOCONNECT, TRUE, NULL);
203++ nm_device_emit_recheck_auto_activate (device);
204++ }
205++
206+ if (new_state < NM_MODEM_STATE_CONNECTING &&
207+ old_state >= NM_MODEM_STATE_CONNECTING &&
208+ dev_state >= NM_DEVICE_STATE_NEED_AUTH &&
209+@@ -271,6 +281,14 @@ device_state_changed (NMDevice *device,
210+ nm_modem_state_to_string (nm_modem_get_state (priv->modem)));
211+ }
212+
213++ /* Block autoconnect until the modem is registered again */
214++ if (new_state == NM_DEVICE_STATE_FAILED && nm_modem_get_state (priv->modem) == NM_MODEM_STATE_SEARCHING) {
215++ nm_log_info (LOGD_MB, "(%s): modem searching; disabling autoconnect",
216++ nm_device_get_iface (device));
217++
218++ g_object_set (G_OBJECT (device), NM_DEVICE_AUTOCONNECT, FALSE, NULL);
219++ }
220++
221+ nm_modem_device_state_changed (priv->modem, new_state, old_state, reason);
222+
223+ switch (reason) {

Subscribers

People subscribed via source and target branches