summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLubomir Rintel <lkundrak@v3.sk>2014-10-09 12:06:53 +0200
committerThomas Haller <thaller@redhat.com>2014-10-20 14:32:38 +0200
commit7d5779300450bc2602ba4f7f472ebfa58bea3571 (patch)
treef4b76711c6257df4ccc3f25281947ccba6d47016
parent810dc260ef5697560e49fd92a2f6cb166d7babf4 (diff)
downloadNetworkManager-7d5779300450bc2602ba4f7f472ebfa58bea3571.tar.gz
rdisc,device: set MTU if an appropriate option is present in a RA
https://bugzilla.gnome.org/show_bug.cgi?id=738104 Reported-by: Charles R. Anderson <cra@wpi.edu>
-rw-r--r--src/devices/nm-device.c7
-rw-r--r--src/rdisc/nm-lndp-rdisc.c15
-rw-r--r--src/rdisc/nm-rdisc.h2
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 {