diff --git a/src/devices/nm-device.c b/src/devices/nm-device.c index 02c4357499..e3e64787f8 100644 --- a/src/devices/nm-device.c +++ b/src/devices/nm-device.c @@ -283,6 +283,7 @@ typedef struct { NMIP6Config * wwan_ip6_config; NMIP6Config * ext_ip6_config; /* Stuff added outside NM */ gboolean nm_ipv6ll; /* TRUE if NM handles the device's IPv6LL address */ + guint32 ip6_mtu; NMRDisc * rdisc; gulong rdisc_changed_id; @@ -4078,6 +4079,18 @@ print_support_extended_ifa_flags (NMSettingIP6ConfigPrivacy use_tempaddr) warn = 2; } +static void +nm_device_ipv6_set_mtu (NMDevice *self, guint32 mtu) +{ + NMDevicePrivate *priv = NM_DEVICE_GET_PRIVATE (self); + char val[16]; + + if (mtu) { + g_snprintf (val, sizeof (val), "%d", mtu); + nm_device_ipv6_sysctl_set (self, "mtu", val); + } +} + static void rdisc_config_changed (NMRDisc *rdisc, NMRDiscConfigMap changed, NMDevice *self) { @@ -4224,12 +4237,8 @@ rdisc_config_changed (NMRDisc *rdisc, NMRDiscConfigMap changed, NMDevice *self) nm_device_ipv6_sysctl_set (self, "hop_limit", val); } - if (changed & NM_RDISC_CONFIG_MTU) { - char val[16]; - - g_snprintf (val, sizeof (val), "%d", rdisc->mtu); - nm_device_ipv6_sysctl_set (self, "mtu", val); - } + if (changed & NM_RDISC_CONFIG_MTU) + priv->ip6_mtu = rdisc->mtu; nm_device_activate_schedule_ip6_config_result (self); } @@ -6053,6 +6062,7 @@ nm_device_set_ip6_config (NMDevice *self, /* Always commit to nm-platform to update lifetimes */ if (commit && new_config) { + nm_device_ipv6_set_mtu (self, priv->ip6_mtu); success = nm_ip6_config_commit (new_config, ip_ifindex); if (!success) reason_local = NM_DEVICE_STATE_REASON_CONFIG_FAILED;