summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLubomir Rintel <lkundrak@v3.sk>2015-02-25 14:49:34 +0100
committerLubomir Rintel <lkundrak@v3.sk>2015-05-05 16:37:06 +0200
commit777482aa820f4391bf90f04f1336dc550f7bd786 (patch)
treebc2c7b9110cc36fd68f48f70719c57274badd41d
parent4e6481cb733611543d22e06831db63b0e23af3f9 (diff)
nm-device: set ipv6 mtu at config commit time1.0.3-dev
Just a refactoring, doesn't make any actual difference. It is consistent with IPv4 and will make it easier to implement a policy to recover from incorrect MTUs settings. (cherry picked from commit f77784b0fdf8abb1e3c796ffc4c2b6c624f17b18)
-rw-r--r--src/devices/nm-device.c22
1 files changed, 16 insertions, 6 deletions
diff --git a/src/devices/nm-device.c b/src/devices/nm-device.c
index 47526281d5..ad02e27a0e 100644
--- a/src/devices/nm-device.c
+++ b/src/devices/nm-device.c
@@ -284,6 +284,7 @@ typedef struct {
NMIP6Config * ext_ip6_config; /* Stuff added outside NM */
gboolean ext_ip6_config_had_any_addresses;
gboolean nm_ipv6ll; /* TRUE if NM handles the device's IPv6LL address */
+ guint32 ip6_mtu;
NMRDisc * rdisc;
gulong rdisc_changed_id;
@@ -4032,6 +4033,18 @@ print_support_extended_ifa_flags (NMSettingIP6ConfigPrivacy use_tempaddr)
}
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)
{
NMDevicePrivate *priv = NM_DEVICE_GET_PRIVATE (self);
@@ -4171,12 +4184,8 @@ rdisc_config_changed (NMRDisc *rdisc, NMRDiscConfigMap changed, NMDevice *self)
if (changed & NM_RDISC_CONFIG_HOP_LIMIT)
nm_platform_sysctl_set_ip6_hop_limit_safe (nm_device_get_ip_iface (self), rdisc->hop_limit);
- 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);
}
@@ -6014,6 +6023,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;