]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
network: fix max MTU check for IPv6 MTU adjustments
authorIvan Shapovalov <ivan.shapovalov@diabolocom.com>
Fri, 30 Jan 2026 12:11:04 +0000 (13:11 +0100)
committerYu Watanabe <watanabe.yu+github@gmail.com>
Fri, 30 Jan 2026 13:34:20 +0000 (22:34 +0900)
When link MTU is being adjusted in an IPv6 context (e.g., according to
the MTU received in an RA), the new MTU is clamped against link's
current MTU than link's max MTU. This means that the link MTU can never
be increased via an RA:

    systemd-networkd[10068]: eth1: Reducing requested IPv6 MTU 8900 to the interface's maximum MTU 1500.
    systemd-networkd[10068]: Setting '/proc/sys/net/ipv6/conf/eth1/mtu' to '1500'
    systemd-networkd[10068]: No change in value '1500', suppressing write

Fix this check to make logical sense, and also to match a similar check
in src/network/networkd-setlink.c:link_adjust_mtu().

src/network/networkd-sysctl.c

index 92be8dfc8d6611849ce3c4eecfda9a94f13bd40d..914fbccd09bf9840f7d4ead748e9e0ced377eb76 100644 (file)
@@ -545,11 +545,11 @@ int link_set_ipv6_mtu(Link *link, int log_level) {
         if (mtu == 0)
                 return 0;
 
-        if (mtu > link->mtu) {
+        if (mtu > link->max_mtu) {
                 log_link_full(link, log_level,
                               "Reducing requested IPv6 MTU %"PRIu32" to the interface's maximum MTU %"PRIu32".",
-                              mtu, link->mtu);
-                mtu = link->mtu;
+                              mtu, link->max_mtu);
+                mtu = link->max_mtu;
         }
 
         r = sysctl_write_ip_property_uint32(AF_INET6, link->ifname, "mtu", mtu, manager_get_sysctl_shadow(link->manager));