]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
network: also adjust IPv6 MTU by the maximum MTU of the interface
authorYu Watanabe <watanabe.yu+github@gmail.com>
Sun, 6 Jun 2021 06:18:43 +0000 (15:18 +0900)
committerYu Watanabe <watanabe.yu+github@gmail.com>
Tue, 8 Jun 2021 19:59:23 +0000 (04:59 +0900)
src/network/networkd-sysctl.c

index ee5fe5f93dbae642cf18a2291162882630852a4d..a67e10e8125159f81f77b0a291de7ba066aa0bce 100644 (file)
@@ -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) {