diff options
Diffstat (limited to 'src/devices/wwan')
| -rw-r--r-- | src/devices/wwan/nm-device-modem.c | 4 | ||||
| -rw-r--r-- | src/devices/wwan/nm-modem.c | 34 |
2 files changed, 33 insertions, 5 deletions
diff --git a/src/devices/wwan/nm-device-modem.c b/src/devices/wwan/nm-device-modem.c index 0f96dafb..b277b15b 100644 --- a/src/devices/wwan/nm-device-modem.c +++ b/src/devices/wwan/nm-device-modem.c @@ -351,7 +351,7 @@ device_state_changed (NMDevice *device, { NMDeviceModem *self = NM_DEVICE_MODEM (device); NMDeviceModemPrivate *priv = NM_DEVICE_MODEM_GET_PRIVATE (device); - NMConnection *connection = nm_device_get_applied_connection (device); + NMSettingsConnection *connection = nm_device_get_settings_connection (device); g_assert (priv->modem); @@ -378,7 +378,7 @@ device_state_changed (NMDevice *device, * where a retry attempt would just fail again. */ if (connection) - nm_settings_connection_set_autoconnect_blocked_reason (NM_SETTINGS_CONNECTION (connection), reason); + nm_settings_connection_set_autoconnect_blocked_reason (connection, reason); break; default: break; diff --git a/src/devices/wwan/nm-modem.c b/src/devices/wwan/nm-modem.c index 2e3d63bb..459d212a 100644 --- a/src/devices/wwan/nm-modem.c +++ b/src/devices/wwan/nm-modem.c @@ -23,7 +23,9 @@ #include "nm-modem.h" +#include <fcntl.h> #include <string.h> +#include <termios.h> #include "nm-core-internal.h" #include "nm-platform.h" @@ -491,6 +493,23 @@ ppp_stats (NMPPPManager *ppp_manager, } } +static gboolean +port_speed_is_zero (const char *port) +{ + struct termios options; + nm_auto_close int fd = -1; + + fd = open (port, O_RDWR | O_NONBLOCK | O_NOCTTY | O_CLOEXEC); + if (fd < 0) + return FALSE; + + memset (&options, 0, sizeof (struct termios)); + if (tcgetattr (fd, &options) != 0) + return FALSE; + + return cfgetospeed (&options) == B0; +} + static NMActStageReturn ppp_stage3_ip_config_start (NMModem *self, NMActRequest *req, @@ -501,6 +520,7 @@ ppp_stage3_ip_config_start (NMModem *self, GError *error = NULL; NMActStageReturn ret; guint ip_timeout = 30; + guint baud_override = 0; g_return_val_if_fail (NM_IS_MODEM (self), NM_ACT_STAGE_RETURN_FAILURE); g_return_val_if_fail (NM_IS_ACT_REQUEST (req), NM_ACT_STAGE_RETURN_FAILURE); @@ -530,8 +550,16 @@ ppp_stage3_ip_config_start (NMModem *self, ip_timeout = priv->mm_ip_timeout; } + /* Some tty drivers and modems ignore port speed, but pppd requires the + * port speed to be > 0 or it exits. If the port speed is 0 pass an + * explicit speed to pppd to prevent the exit. + * https://bugzilla.redhat.com/show_bug.cgi?id=1281731 + */ + if (port_speed_is_zero (priv->data_port)) + baud_override = 57600; + priv->ppp_manager = nm_ppp_manager_new (priv->data_port); - if (nm_ppp_manager_start (priv->ppp_manager, req, ppp_name, ip_timeout, &error)) { + if (nm_ppp_manager_start (priv->ppp_manager, req, ppp_name, ip_timeout, baud_override, &error)) { g_signal_connect (priv->ppp_manager, NM_PPP_MANAGER_STATE_CHANGED, G_CALLBACK (ppp_state_changed), self); @@ -1327,12 +1355,12 @@ constructor (GType type, priv = NM_MODEM_GET_PRIVATE (object); if (!priv->data_port && !priv->control_port) { - nm_log_err (LOGD_HW, "neither modem command nor data interface provided"); + nm_log_err (LOGD_PLATFORM, "neither modem command nor data interface provided"); goto err; } if (!priv->path) { - nm_log_err (LOGD_HW, "D-Bus path not provided"); + nm_log_err (LOGD_PLATFORM, "D-Bus path not provided"); goto err; } |