diff --git a/SOURCES/0001-base-bearer-fix-check-for-cancellation.patch b/SOURCES/0001-base-bearer-fix-check-for-cancellation.patch new file mode 100644 index 0000000..09d3cf1 --- /dev/null +++ b/SOURCES/0001-base-bearer-fix-check-for-cancellation.patch @@ -0,0 +1,32 @@ +From 811e7a71fe574884e454807fb59393acc182555c Mon Sep 17 00:00:00 2001 +From: Lubomir Rintel +Date: Fri, 3 May 2019 18:45:22 +0200 +Subject: [PATCH 1/4] base-bearer: fix check for cancellation + +If we cancel connect_cancellable, the connect task will return a +G_IO_ERROR_CANCELLED. We may need to do some cleanup (like, disconnect +if the connection went far enough to actually start the network +connection), thus it's important we check for cancellation correctly. +--- + src/mm-base-bearer.c | 5 ++--- + 1 file changed, 2 insertions(+), 3 deletions(-) + +diff --git a/src/mm-base-bearer.c b/src/mm-base-bearer.c +index 854fbc2..e1dd989 100644 +--- a/src/mm-base-bearer.c ++++ b/src/mm-base-bearer.c +@@ -576,9 +576,8 @@ connect_ready (MMBaseBearer *self, + mm_dbg ("Couldn't connect bearer '%s': '%s'", + self->priv->path, + error->message); +- if (g_error_matches (error, +- MM_CORE_ERROR, +- MM_CORE_ERROR_CANCELLED)) { ++ if ( g_error_matches (error, MM_CORE_ERROR, MM_CORE_ERROR_CANCELLED) ++ || g_error_matches (error, G_IO_ERROR, G_IO_ERROR_CANCELLED)) { + /* Will launch disconnection */ + launch_disconnect = TRUE; + } else +-- +1.8.3.1 + diff --git a/SOURCES/0001-port-qmi-increase-qmi_device_open-retries.patch b/SOURCES/0001-port-qmi-increase-qmi_device_open-retries.patch new file mode 100644 index 0000000..7f3580f --- /dev/null +++ b/SOURCES/0001-port-qmi-increase-qmi_device_open-retries.patch @@ -0,0 +1,29 @@ +From 6258223522b5352e1f2226ed60bfe88156fb011c Mon Sep 17 00:00:00 2001 +From: Daniele Palmas +Date: Fri, 22 Feb 2019 13:44:29 +0100 +Subject: [PATCH] port-qmi: increase qmi_device_open retries + +Telit modems LM940/960 need more time for becoming responsive +to qmi requests after device appearance. + +(cherry picked from commit 301bdcfef7e3407a675b37b99d2c57ddb249baa8) +--- + src/mm-port-qmi.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/src/mm-port-qmi.c b/src/mm-port-qmi.c +index 58925c28..ac785b17 100644 +--- a/src/mm-port-qmi.c ++++ b/src/mm-port-qmi.c +@@ -391,7 +391,7 @@ port_open_context_step (PortOpenContext *ctx) + qmi_device_open (ctx->device, + (QMI_DEVICE_OPEN_FLAGS_VERSION_INFO | + QMI_DEVICE_OPEN_FLAGS_PROXY), +- 10, ++ 20, + ctx->cancellable, + (GAsyncReadyCallback) qmi_device_open_first_ready, + ctx); +-- +2.21.0 + diff --git a/SOURCES/0001-sierra-do-not-grab-cdc_ether-devices.patch b/SOURCES/0001-sierra-do-not-grab-cdc_ether-devices.patch new file mode 100644 index 0000000..256661f --- /dev/null +++ b/SOURCES/0001-sierra-do-not-grab-cdc_ether-devices.patch @@ -0,0 +1,71 @@ +From 40043de96524c61d1f8b4cc25c171924c4f312a6 Mon Sep 17 00:00:00 2001 +From: Lubomir Rintel +Date: Fri, 17 May 2019 16:42:47 +0200 +Subject: [PATCH] sierra: do not grab cdc_ether devices + +The Sierra modems may have more network interfaces than just the modem data +one, such as the SoC management interface or an application specific ones +created via one of the network USB gadget drivers. + +We grab them even they're not DEVTYPE=wwan. Let's not do that. Also, to stay on +the safe side, keep grabbing qmi_wwan. +--- + plugins/sierra/mm-plugin-sierra.c | 37 +++++++++++++++++++++++++++++++ + 1 file changed, 37 insertions(+) + +diff --git a/plugins/sierra/mm-plugin-sierra.c b/plugins/sierra/mm-plugin-sierra.c +index 03a06bd8..01e753fa 100644 +--- a/plugins/sierra/mm-plugin-sierra.c ++++ b/plugins/sierra/mm-plugin-sierra.c +@@ -80,6 +80,42 @@ create_modem (MMPlugin *self, + product)); + } + ++gboolean ++grab_port (MMPlugin *self, ++ MMBaseModem *modem, ++ MMPortProbe *probe, ++ GError **error) ++{ ++ MMPortSerialAtFlag pflags = MM_PORT_SERIAL_AT_FLAG_NONE; ++ GUdevDevice *port; ++ const gchar *subsys; ++ const gchar *name; ++ ++ port = mm_port_probe_peek_port (probe); ++ subsys = mm_port_probe_get_port_subsys (probe); ++ name = mm_port_probe_get_port_name (probe); ++ ++ if (g_strcmp0 (g_udev_device_get_subsystem (port), "net") == 0 && ++ g_strcmp0 (g_udev_device_get_property (port, "DEVTYPE"), "wwan") != 0 && ++ g_strcmp0 (mm_device_utils_get_port_driver (port), "qmi_wwan") != 0) { ++ g_set_error (error, ++ MM_CORE_ERROR, ++ MM_CORE_ERROR_UNSUPPORTED, ++ "Cannot add port '%s/%s', not the QMI data interface", ++ subsys, ++ name); ++ return FALSE; ++ } ++ ++ return mm_base_modem_grab_port (modem, ++ subsys, ++ name, ++ mm_port_probe_get_parent_path (probe), ++ mm_port_probe_get_port_type (probe), ++ pflags, ++ error); ++} ++ + /*****************************************************************************/ + + G_MODULE_EXPORT MMPlugin * +@@ -113,4 +149,5 @@ mm_plugin_sierra_class_init (MMPluginSierraClass *klass) + MMPluginClass *plugin_class = MM_PLUGIN_CLASS (klass); + + plugin_class->create_modem = create_modem; ++ plugin_class->grab_port = grab_port; + } +-- +2.18.1 + diff --git a/SOURCES/0002-bearer-qmi-unsolicited-events-might-not-be-enabled-o.patch b/SOURCES/0002-bearer-qmi-unsolicited-events-might-not-be-enabled-o.patch new file mode 100644 index 0000000..15d2425 --- /dev/null +++ b/SOURCES/0002-bearer-qmi-unsolicited-events-might-not-be-enabled-o.patch @@ -0,0 +1,54 @@ +From 31f108aee1f328c8889b00547b212c4e3cb27fa2 Mon Sep 17 00:00:00 2001 +From: Lubomir Rintel +Date: Fri, 3 May 2019 18:07:33 +0200 +Subject: [PATCH 2/4] bearer-qmi: unsolicited events might not be enabled on + disconnect + +If a disconnection fails (because stop_network() failed), base-bearer +flips the state back to CONNECTED. Oops. At that point something is +clearly messed up, but it seems correct to assume the bearer is +connected. + +Nevertheless, we will have already have unhooked the unsolicited eventsx +reporting. A subsequent attempt to disconnect the bearer will trip the +assertion: + + #0 0x00007ffff75f2eb5 in __GI_raise (sig=sig@entry=6) at ../sysdeps/unix/sysv/linux/raise.c:50 + #1 0x00007ffff75dd895 in __GI_abort () at abort.c:79 + #2 0x00007ffff77beb53 in g_assertion_message + (domain=, file=, line=, func=0x5088e0 <__FUNCTION__.56253> "cleanup_event_report_unsolicited_events", message=) at ../glib/gtestutils.c:2878 + #3 0x00007ffff781a96f in g_assertion_message_expr + (domain=domain@entry=0x0, file=file@entry=0x507aad "mm-bearer-qmi.c", line=line@entry=1138, func=func@entry=0x5088e0 <__FUNCTION__.56253> "cleanup_event_report_unsolicited_events", expr=expr@entry=0x507ae5 "*indication_id != 0") at ../glib/gtestutils.c:2904 + #4 0x00000000004a0c49 in cleanup_event_report_unsolicited_events (client=, indication_id=0x5bb30c, self=) + at mm-bearer-qmi.c:1138 + #5 0x00000000004a0c49 in cleanup_event_report_unsolicited_events + (client=, indication_id=indication_id@entry=0x5bb30c, self=0x5bb420 [MMBearerQmi]) at mm-bearer-qmi.c:1132 + #6 0x00000000004a0ee3 in disconnect_context_step (task=0x7fffe8012100 [GTask]) at mm-bearer-qmi.c:1854 + #7 0x000000000046e889 in disconnect_auth_ready (self=, res=, ctx=ctx@entry=0x654630) + at mm-iface-modem-simple.c:865 + #8 0x00007ffff79cfa9a in g_task_return_now (task=0x7fffe8012640 [GTask]) at ../gio/gtask.c:1209 + ... +--- + src/mm-bearer-qmi.c | 6 +++++- + 1 file changed, 5 insertions(+), 1 deletion(-) + +diff --git a/src/mm-bearer-qmi.c b/src/mm-bearer-qmi.c +index c75d5e4..f8c6544 100644 +--- a/src/mm-bearer-qmi.c ++++ b/src/mm-bearer-qmi.c +@@ -970,7 +970,11 @@ cleanup_event_report_unsolicited_events (MMBearerQmi *self, + { + QmiMessageWdsSetEventReportInput *input; + +- g_assert (*indication_id != 0); ++ if (*indication_id == 0) { ++ mm_warn ("Reporting of unsolicited events already cleared"); ++ return; ++ } ++ + g_signal_handler_disconnect (client, *indication_id); + *indication_id = 0; + +-- +1.8.3.1 + diff --git a/SOURCES/0003-bearer-qmi-do-not-pass-a-cancellable-to-start_networ.patch b/SOURCES/0003-bearer-qmi-do-not-pass-a-cancellable-to-start_networ.patch new file mode 100644 index 0000000..b249c94 --- /dev/null +++ b/SOURCES/0003-bearer-qmi-do-not-pass-a-cancellable-to-start_networ.patch @@ -0,0 +1,37 @@ +From 9eac385cf0c0cdcdf6a8764133e3569a68e665d2 Mon Sep 17 00:00:00 2001 +From: Lubomir Rintel +Date: Fri, 3 May 2019 19:40:16 +0200 +Subject: [PATCH 3/4] bearer-qmi: do not pass a cancellable to start_network() + +If we cancel start_network(), we'll lose the network handle. That means +we won't ever be able to stop the network again, and reconnect the modem +again. +--- + src/mm-bearer-qmi.c | 4 ++-- + 1 file changed, 2 insertions(+), 2 deletions(-) + +diff --git a/src/mm-bearer-qmi.c b/src/mm-bearer-qmi.c +index f8c6544..10664a8 100644 +--- a/src/mm-bearer-qmi.c ++++ b/src/mm-bearer-qmi.c +@@ -1171,7 +1171,7 @@ connect_context_step (ConnectContext *ctx) + qmi_client_wds_start_network (ctx->client_ipv4, + input, + 45, +- ctx->cancellable, ++ NULL, /* Disallow cancellation */ + (GAsyncReadyCallback)start_network_ready, + ctx); + qmi_message_wds_start_network_input_unref (input); +@@ -1274,7 +1274,7 @@ connect_context_step (ConnectContext *ctx) + qmi_client_wds_start_network (ctx->client_ipv6, + input, + 45, +- ctx->cancellable, ++ NULL, /* Disallow cancellation */ + (GAsyncReadyCallback)start_network_ready, + ctx); + qmi_message_wds_start_network_input_unref (input); +-- +1.8.3.1 + diff --git a/SOURCES/0004-bearer-qmi-don-t-throw-away-packet-data-handles-on-c.patch b/SOURCES/0004-bearer-qmi-don-t-throw-away-packet-data-handles-on-c.patch new file mode 100644 index 0000000..efe5f18 --- /dev/null +++ b/SOURCES/0004-bearer-qmi-don-t-throw-away-packet-data-handles-on-c.patch @@ -0,0 +1,41 @@ +From a32f0e0e4457d561b1aebaf5e8b3390e7868ef90 Mon Sep 17 00:00:00 2001 +From: Lubomir Rintel +Date: Fri, 3 May 2019 19:36:37 +0200 +Subject: [PATCH 4/4] bearer-qmi: don't throw away packet data handles on + cancellation + +If the connection attempt is cancelled, the base bearer will attempt a +disconnection because it could reach the point after it connected the +network. However, for that to work we must not forget the packet data +handles, and the ip client instances. +--- + src/mm-bearer-qmi.c | 13 +++++++++++++ + 1 file changed, 13 insertions(+) + +diff --git a/src/mm-bearer-qmi.c b/src/mm-bearer-qmi.c +index 10664a8..a5d6d29 100644 +--- a/src/mm-bearer-qmi.c ++++ b/src/mm-bearer-qmi.c +@@ -1047,6 +1047,19 @@ connect_context_step (ConnectContext *ctx) + MM_CORE_ERROR, + MM_CORE_ERROR_CANCELLED, + "Connection setup operation has been cancelled"); ++ if (ctx->data) { ++ ctx->self->priv->data = g_object_ref (ctx->data); ++ /* If we managed to succeed at connecting, we need to preserve the client ++ * and the handle, so that subsequent disconnection can destroy them. */ ++ if (ctx->client_ipv4) { ++ ctx->self->priv->client_ipv4 = g_object_ref (ctx->client_ipv4); ++ ctx->self->priv->packet_data_handle_ipv4 = ctx->packet_data_handle_ipv4; ++ } ++ if (ctx->client_ipv6) { ++ ctx->self->priv->client_ipv6 = g_object_ref (ctx->client_ipv6); ++ ctx->self->priv->packet_data_handle_ipv6 = ctx->packet_data_handle_ipv6; ++ } ++ } + connect_context_complete_and_free (ctx); + return; + } +-- +1.8.3.1 + diff --git a/SPECS/ModemManager.spec b/SPECS/ModemManager.spec index 88580f3..1c471d2 100644 --- a/SPECS/ModemManager.spec +++ b/SPECS/ModemManager.spec @@ -5,9 +5,15 @@ Summary: Mobile broadband modem management service Name: ModemManager Version: 1.6.10 -Release: 1%{?dist} +Release: 3%{?dist} Source: https://www.freedesktop.org/software/ModemManager/%{name}-%{version}.tar.xz Patch0: 0001-Revert-build-bump-required-gettext-version-to-0.19.3.patch +Patch1: 0001-port-qmi-increase-qmi_device_open-retries.patch +Patch2: 0001-base-bearer-fix-check-for-cancellation.patch +Patch3: 0002-bearer-qmi-unsolicited-events-might-not-be-enabled-o.patch +Patch4: 0003-bearer-qmi-do-not-pass-a-cancellable-to-start_networ.patch +Patch5: 0004-bearer-qmi-don-t-throw-away-packet-data-handles-on-c.patch +Patch6: 0001-sierra-do-not-grab-cdc_ether-devices.patch License: GPLv2+ Group: System Environment/Base @@ -85,6 +91,12 @@ Vala bindings for ModemManager %prep %setup -q %patch0 -p1 +%patch1 -p1 +%patch2 -p1 +%patch3 -p1 +%patch4 -p1 +%patch5 -p1 +%patch6 -p1 %build intltoolize --force @@ -173,6 +185,13 @@ gtk-update-icon-cache %{_datadir}/icons/hicolor &>/dev/null || : %{_datadir}/vala/vapi/libmm-glib.* %changelog +* Tue May 21 2019 Lubomir Rintel - 1.6.10-3 +- Don't grab cdc_ether devices on Sierra QMI modems (rh #1712031) + +* Mon May 13 2019 Lubomir Rintel - 1.6.10-2 +- Increase QMI open timeout +- Fix a race on WDS Start Network cancellation (rh #1676808) + * Tue Oct 24 2017 Lubomir Rintel - 1.6.10-1 - Update to 1.6.10 release (rh #1483051)