summaryrefslogtreecommitdiff
path: root/src/network/networkd-sysctl.c
diff options
context:
space:
mode:
authorYu Watanabe <watanabe.yu+github@gmail.com>2021-06-06 15:18:43 +0900
committerYu Watanabe <watanabe.yu+github@gmail.com>2021-06-09 04:59:23 +0900
commite56e1a15b50e55789347d420facb004baaa9b4b6 (patch)
treebe68bfec1a72771eccc748e81af60d0a69ed6186 /src/network/networkd-sysctl.c
parent717ba5fc90159a09d27d2893f12984ee647e11ab (diff)
downloadsystemd-e56e1a15b50e55789347d420facb004baaa9b4b6.tar.gz
network: also adjust IPv6 MTU by the maximum MTU of the interface
Diffstat (limited to 'src/network/networkd-sysctl.c')
-rw-r--r--src/network/networkd-sysctl.c11
1 files changed, 10 insertions, 1 deletions
diff --git a/src/network/networkd-sysctl.c b/src/network/networkd-sysctl.c
index ee5fe5f93d..a67e10e812 100644
--- a/src/network/networkd-sysctl.c
+++ b/src/network/networkd-sysctl.c
@@ -184,6 +184,8 @@ static int link_set_ipv6_proxy_ndp(Link *link) {
}
int link_set_ipv6_mtu(Link *link) {
+ uint32_t mtu;
+
assert(link);
/* Make this a NOP if IPv6 is not available */
@@ -199,7 +201,14 @@ int link_set_ipv6_mtu(Link *link) {
if (link->network->ipv6_mtu == 0)
return 0;
- return sysctl_write_ip_property_uint32(AF_INET6, link->ifname, "mtu", link->network->ipv6_mtu);
+ mtu = link->network->ipv6_mtu;
+ if (mtu > link->max_mtu) {
+ log_link_warning(link, "Reducing requested IPv6 MTU %"PRIu32" to the interface's maximum MTU %"PRIu32".",
+ mtu, link->max_mtu);
+ mtu = link->max_mtu;
+ }
+
+ return sysctl_write_ip_property_uint32(AF_INET6, link->ifname, "mtu", mtu);
}
static int link_set_ipv4_accept_local(Link *link) {