diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/devices/nm-device.c | 7 | ||||
-rw-r--r-- | src/rdisc/nm-lndp-rdisc.c | 15 | ||||
-rw-r--r-- | src/rdisc/nm-rdisc.h | 2 |
3 files changed, 24 insertions, 0 deletions
diff --git a/src/devices/nm-device.c b/src/devices/nm-device.c index d8d670d3ff..1c01c8dc26 100644 --- a/src/devices/nm-device.c +++ b/src/devices/nm-device.c @@ -3663,6 +3663,13 @@ 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); + } + nm_device_activate_schedule_ip6_config_result (self); } diff --git a/src/rdisc/nm-lndp-rdisc.c b/src/rdisc/nm-lndp-rdisc.c index 1ec8921ee9..bd599ca18a 100644 --- a/src/rdisc/nm-lndp-rdisc.c +++ b/src/rdisc/nm-lndp-rdisc.c @@ -621,6 +621,21 @@ receive_ra (struct ndp *ndp, struct ndp_msg *msg, gpointer user_data) changed |= NM_RDISC_CONFIG_HOP_LIMIT; } + /* MTU */ + ndp_msg_opt_for_each_offset(offset, msg, NDP_MSG_OPT_MTU) { + guint32 mtu = ndp_msg_opt_mtu(msg, offset); + if (mtu >= 1280) { + rdisc->mtu = mtu; + changed |= NM_RDISC_CONFIG_MTU; + } else { + /* All sorts of bad things would happen if we accepted this. + * Kernel would set it, but would flush out all IPv6 addresses away + * from the link, even the link-local, and we wouldn't be able to + * listen for further RAs that could fix the MTU. */ + warning ("(%s): MTU too small for IPv6 ignored: %d", rdisc->ifname, mtu); + } + } + check_timestamps (rdisc, now, changed); return 0; diff --git a/src/rdisc/nm-rdisc.h b/src/rdisc/nm-rdisc.h index f4ebc228a9..2d83f0f020 100644 --- a/src/rdisc/nm-rdisc.h +++ b/src/rdisc/nm-rdisc.h @@ -95,6 +95,7 @@ typedef enum { NM_RDISC_CONFIG_DNS_SERVERS = 1 << 4, NM_RDISC_CONFIG_DNS_DOMAINS = 1 << 5, NM_RDISC_CONFIG_HOP_LIMIT = 1 << 6, + NM_RDISC_CONFIG_MTU = 1 << 7, } NMRDiscConfigMap; #define NM_RDISC_MAX_ADDRESSES_DEFAULT 16 @@ -125,6 +126,7 @@ typedef struct { GArray *dns_servers; GArray *dns_domains; int hop_limit; + guint32 mtu; } NMRDisc; typedef struct { |