diff options
Diffstat (limited to 'src/devices/wwan')
| -rw-r--r-- | src/devices/wwan/meson.build | 4 | ||||
| -rw-r--r-- | src/devices/wwan/nm-modem-broadband.c | 4 | ||||
| -rw-r--r-- | src/devices/wwan/nm-modem-ofono.c | 1 | ||||
| -rw-r--r-- | src/devices/wwan/nm-modem.c | 62 | ||||
| -rw-r--r-- | src/devices/wwan/nm-wwan-factory.c | 1 |
5 files changed, 48 insertions, 24 deletions
diff --git a/src/devices/wwan/meson.build b/src/devices/wwan/meson.build index 032b3585..abf58594 100644 --- a/src/devices/wwan/meson.build +++ b/src/devices/wwan/meson.build @@ -25,7 +25,7 @@ libnm_wwan = shared_module( ], link_depends: linker_script, install: true, - install_dir: nm_pkglibdir + install_dir: nm_plugindir ) libnm_wwan_dep = declare_dependency( @@ -54,7 +54,7 @@ libnm_device_plugin_wwan = shared_module( link_args: ldflags_linker_script_devices, link_depends: linker_script_devices, install: true, - install_dir: nm_pkglibdir + install_dir: nm_plugindir ) core_plugins += libnm_device_plugin_wwan diff --git a/src/devices/wwan/nm-modem-broadband.c b/src/devices/wwan/nm-modem-broadband.c index 9a3744db..e5678b96 100644 --- a/src/devices/wwan/nm-modem-broadband.c +++ b/src/devices/wwan/nm-modem-broadband.c @@ -286,7 +286,7 @@ create_gsm_connect_properties (NMConnection *connection) /* Blank APN ("") means the default subscription APN */ str = nm_setting_gsm_get_apn (setting); - mm_simple_connect_properties_set_apn (properties, str ? str : ""); + mm_simple_connect_properties_set_apn (properties, str ?: ""); str = nm_setting_gsm_get_network_id (setting); if (str) @@ -924,7 +924,6 @@ static_stage3_ip4_done (NMModemBroadband *self) _LOGI (" address %s/%d", address_string, address.plen); - nm_modem_get_route_parameters (NM_MODEM (self), &ip4_route_table, &ip4_route_metric, @@ -1283,7 +1282,6 @@ get_sim_ready (MMModem *modem, GError *error = NULL; MMSim *new_sim; - new_sim = mm_modem_get_sim_finish (modem, res, &error); if (new_sim != self->_priv.sim_iface) { g_clear_object (&self->_priv.sim_iface); diff --git a/src/devices/wwan/nm-modem-ofono.c b/src/devices/wwan/nm-modem-ofono.c index a1c6aef2..8b81ac41 100644 --- a/src/devices/wwan/nm-modem-ofono.c +++ b/src/devices/wwan/nm-modem-ofono.c @@ -278,7 +278,6 @@ deactivate_cleanup (NMModem *modem, NMDevice *device) NM_MODEM_CLASS (nm_modem_ofono_parent_class)->deactivate_cleanup (modem, device); } - static gboolean check_connection_compatible (NMModem *modem, NMConnection *connection) diff --git a/src/devices/wwan/nm-modem.c b/src/devices/wwan/nm-modem.c index 61b7247e..fbe99cc3 100644 --- a/src/devices/wwan/nm-modem.c +++ b/src/devices/wwan/nm-modem.c @@ -205,7 +205,7 @@ nm_modem_set_state (NMModem *self, _LOGI ("modem state changed, '%s' --> '%s' (reason: %s)", nm_modem_state_to_string (old_state), nm_modem_state_to_string (new_state), - reason ? reason : "none"); + reason ?: "none"); priv->state = new_state; _notify (self, PROP_STATE); @@ -1131,6 +1131,7 @@ deactivate_cleanup (NMModem *self, NMDevice *device) if (priv->ppp_manager) { g_signal_handlers_disconnect_by_data (priv->ppp_manager, self); + nm_ppp_manager_stop (priv->ppp_manager, NULL, NULL); g_clear_object (&priv->ppp_manager); } @@ -1176,11 +1177,19 @@ typedef struct { GSimpleAsyncResult *result; DeactivateContextStep step; NMPPPManager *ppp_manager; + NMPPPManagerStopHandle *ppp_stop_handle; + gulong ppp_stop_cancellable_id; } DeactivateContext; static void deactivate_context_complete (DeactivateContext *ctx) { + if (ctx->ppp_stop_handle) + nm_ppp_manager_stop_cancel (ctx->ppp_stop_handle); + + nm_assert (!ctx->ppp_stop_handle); + nm_assert (ctx->ppp_stop_cancellable_id == 0); + if (ctx->ppp_manager) g_object_unref (ctx->ppp_manager); if (ctx->cancellable) @@ -1222,26 +1231,37 @@ disconnect_ready (NMModem *self, static void ppp_manager_stop_ready (NMPPPManager *ppp_manager, - GAsyncResult *res, - DeactivateContext *ctx) + NMPPPManagerStopHandle *handle, + gboolean was_cancelled, + gpointer user_data) { - NMModem *self = ctx->self; - GError *error = NULL; + DeactivateContext *ctx = user_data; - if (!nm_ppp_manager_stop_finish (ppp_manager, res, &error)) { - _LOGW ("cannot stop PPP manager: %s", - error->message); - g_simple_async_result_take_error (ctx->result, error); - deactivate_context_complete (ctx); - return; + nm_assert (ctx->ppp_stop_handle == handle); + ctx->ppp_stop_handle = NULL; + + if (ctx->ppp_stop_cancellable_id) { + g_cancellable_disconnect (ctx->cancellable, + nm_steal_int (&ctx->ppp_stop_cancellable_id)); } - /* Go on */ + if (was_cancelled) + return; + ctx->step++; deactivate_step (ctx); } static void +ppp_manager_stop_cancelled (GCancellable *cancellable, + gpointer user_data) +{ + DeactivateContext *ctx = user_data; + + nm_ppp_manager_stop_cancel (ctx->ppp_stop_handle); +} + +static void deactivate_step (DeactivateContext *ctx) { NMModem *self = ctx->self; @@ -1270,10 +1290,16 @@ deactivate_step (DeactivateContext *ctx) case DEACTIVATE_CONTEXT_STEP_PPP_MANAGER_STOP: /* If we have a PPP manager, stop it */ if (ctx->ppp_manager) { - nm_ppp_manager_stop_async (ctx->ppp_manager, - ctx->cancellable, - (GAsyncReadyCallback) ppp_manager_stop_ready, - ctx); + nm_assert (!ctx->ppp_stop_handle); + if (ctx->cancellable) { + ctx->ppp_stop_cancellable_id = g_cancellable_connect (ctx->cancellable, + G_CALLBACK (ppp_manager_stop_cancelled), + ctx, + NULL); + } + ctx->ppp_stop_handle = nm_ppp_manager_stop (ctx->ppp_manager, + ppp_manager_stop_ready, + ctx); return; } ctx->step++; @@ -1312,7 +1338,9 @@ nm_modem_deactivate_async (NMModem *self, callback, user_data, nm_modem_deactivate_async); - ctx->cancellable = cancellable ? g_object_ref (cancellable) : NULL; + /* FIXME(shutdown): we always require a cancellable, otherwise we cannot + * do a coordinated shutdown. */ + ctx->cancellable = nm_g_object_ref (cancellable); /* Start */ ctx->step = DEACTIVATE_CONTEXT_STEP_FIRST; diff --git a/src/devices/wwan/nm-wwan-factory.c b/src/devices/wwan/nm-wwan-factory.c index f0aae040..a561b58a 100644 --- a/src/devices/wwan/nm-wwan-factory.c +++ b/src/devices/wwan/nm-wwan-factory.c @@ -105,7 +105,6 @@ modem_added_cb (NMModemManager *manager, g_object_unref (device); } - static NMDevice * create_device (NMDeviceFactory *factory, const char *iface, |