summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBeniamino Galvani <bgalvani@redhat.com>2017-01-20 17:08:49 +0100
committerBeniamino Galvani <bgalvani@redhat.com>2017-02-20 09:18:25 +0100
commitf37e183442c971820d9f6c21cba59612e6f5ec81 (patch)
tree105451bed42354e8c406db9e9c26d12ca8b32a85
parent65837f5fff287a4aae9468cf30545c28907967d8 (diff)
downloadNetworkManager-f37e183442c971820d9f6c21cba59612e6f5ec81.tar.gz
device: apply the mtu property of gsm and cdma settings
-rw-r--r--src/devices/bluetooth/nm-device-bt.c1
-rw-r--r--src/devices/wwan/libnm-wwan.ver1
-rw-r--r--src/devices/wwan/nm-device-modem.c1
-rw-r--r--src/devices/wwan/nm-modem.c39
-rw-r--r--src/devices/wwan/nm-modem.h2
5 files changed, 44 insertions, 0 deletions
diff --git a/src/devices/bluetooth/nm-device-bt.c b/src/devices/bluetooth/nm-device-bt.c
index 12660701f5..5f67c55f7d 100644
--- a/src/devices/bluetooth/nm-device-bt.c
+++ b/src/devices/bluetooth/nm-device-bt.c
@@ -1174,6 +1174,7 @@ nm_device_bt_class_init (NMDeviceBtClass *klass)
device_class->complete_connection = complete_connection;
device_class->is_available = is_available;
device_class->component_added = component_added;
+ device_class->get_configured_mtu = nm_modem_get_configured_mtu;
device_class->state_changed = device_state_changed;
diff --git a/src/devices/wwan/libnm-wwan.ver b/src/devices/wwan/libnm-wwan.ver
index 23412de627..eb577aafb7 100644
--- a/src/devices/wwan/libnm-wwan.ver
+++ b/src/devices/wwan/libnm-wwan.ver
@@ -9,6 +9,7 @@ global:
nm_modem_deactivate_async_finish;
nm_modem_device_state_changed;
nm_modem_get_capabilities;
+ nm_modem_get_configured_mtu;
nm_modem_get_control_port;
nm_modem_get_data_port;
nm_modem_get_driver;
diff --git a/src/devices/wwan/nm-device-modem.c b/src/devices/wwan/nm-device-modem.c
index ee263d9ca4..05f474a4f2 100644
--- a/src/devices/wwan/nm-device-modem.c
+++ b/src/devices/wwan/nm-device-modem.c
@@ -800,6 +800,7 @@ nm_device_modem_class_init (NMDeviceModemClass *mclass)
device_class->owns_iface = owns_iface;
device_class->is_available = is_available;
device_class->get_ip_iface_identifier = get_ip_iface_identifier;
+ device_class->get_configured_mtu = nm_modem_get_configured_mtu;
device_class->state_changed = device_state_changed;
diff --git a/src/devices/wwan/nm-modem.c b/src/devices/wwan/nm-modem.c
index 1dec0dd12f..caf2bb340c 100644
--- a/src/devices/wwan/nm-modem.c
+++ b/src/devices/wwan/nm-modem.c
@@ -772,6 +772,45 @@ nm_modem_stage3_ip6_config_start (NMModem *self,
return ret;
}
+guint32
+nm_modem_get_configured_mtu (NMDevice *self, gboolean *out_is_user_config)
+{
+ NMConnection *connection;
+ NMSetting *setting;
+ gint64 mtu_default;
+ guint mtu = 0;
+ const char *property_name;
+
+ nm_assert (NM_IS_DEVICE (self));
+ nm_assert (out_is_user_config);
+
+ connection = nm_device_get_applied_connection (self);
+ if (!connection)
+ g_return_val_if_reached (0);
+
+ setting = (NMSetting *) nm_connection_get_setting_gsm (connection);
+ if (!setting)
+ setting = (NMSetting *) nm_connection_get_setting_cdma (connection);
+
+ if (setting) {
+ g_object_get (setting, "mtu", &mtu, NULL);
+ if (mtu) {
+ *out_is_user_config = TRUE;
+ return mtu;
+ }
+
+ property_name = NM_IS_SETTING_GSM (setting) ? "gsm.mtu" : "cdma.mtu";
+ mtu_default = nm_device_get_configured_mtu_from_connection_default (self, property_name);
+ if (mtu_default >= 0) {
+ *out_is_user_config = TRUE;
+ return (guint32) mtu_default;
+ }
+ }
+
+ *out_is_user_config = FALSE;
+ return 0;
+}
+
/*****************************************************************************/
static void
diff --git a/src/devices/wwan/nm-modem.h b/src/devices/wwan/nm-modem.h
index c590b9e440..b377736353 100644
--- a/src/devices/wwan/nm-modem.h
+++ b/src/devices/wwan/nm-modem.h
@@ -250,4 +250,6 @@ void nm_modem_emit_ip6_config_result (NMModem *self,
const gchar *nm_modem_ip_type_to_string (NMModemIPType ip_type);
+guint32 nm_modem_get_configured_mtu (NMDevice *self, gboolean *out_is_user_config);
+
#endif /* __NETWORKMANAGER_MODEM_H__ */