From e86ea0240fc31a9884cebf88667cd79896996f42 Mon Sep 17 00:00:00 2001 From: Beniamino Galvani Date: Fri, 1 Jun 2018 15:03:27 +0200 Subject: [PATCH] device: don't try to change MTU on a disconnected device ip_config_merge_and_apply() can be called without an applied connection, but then it calls nm_device_set_ip_config() and tries to retrieve the configured MTU, throwing an assertion if the applied connection is NULL. src/devices/nm-device.c: line 8080 (nm_device_get_configured_mtu_for_wired): should not be reached Since it doesn't make sense apply a MTU from the connection when there is no connection, add a check against this. --- src/devices/nm-device.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/devices/nm-device.c b/src/devices/nm-device.c index 9a40a0dd5e..cf6baf47a1 100644 --- a/src/devices/nm-device.c +++ b/src/devices/nm-device.c @@ -8139,8 +8139,10 @@ _commit_mtu (NMDevice *self, const NMIP4Config *config) if (ifindex <= 0) return; - if (nm_device_sys_iface_state_is_external_or_assume (self)) { - /* for assumed connections we don't tamper with the MTU. */ + if ( !nm_device_get_applied_connection (self) + || nm_device_sys_iface_state_is_external_or_assume (self)) { + /* we don't tamper with the MTU of disconnected and + * external/assumed devices. */ return; }