network: wait for IPv6 MTU being synced to link MTU

The kernel resets the IPv6 MTU of an interface when its link MTU is changed.
But it seems the operation is asynchronous, and even when we detect that
the link MTU is changed, the IPv6 MTU may not be reset yet.
====
[ 2257.067613] systemd-networkd[447122]: veth99: MTU is changed: 1500 →1600 (min: 68, max: 65535)
[ 2257.067641] systemd-networkd[447122]: Setting '/proc/sys/net/ipv6/conf/veth99/mtu' to '1410'
[ 2257.067711] systemd-networkd[447122]: No change in value '1410', suppressing write
====
As you can see, even if the link MTU is changed to 1600, the IPv6 MTU is
unchanged (in this case, still 1410).
This commit is contained in:
Yu Watanabe
2024-10-15 06:56:06 +09:00
parent 7edfbf4130
commit 39283a1f27
4 changed files with 92 additions and 1 deletions
+2 -1
View File
@@ -288,6 +288,7 @@ static Link *link_free(Link *link) {
network_unref(link->network);
sd_event_source_disable_unref(link->carrier_lost_timer);
sd_event_source_disable_unref(link->ipv6_mtu_wait_synced_event_source);
return mfree(link);
}
@@ -2437,7 +2438,7 @@ static int link_update_mtu(Link *link, sd_netlink_message *message) {
if (IN_SET(link->state, LINK_STATE_CONFIGURING, LINK_STATE_CONFIGURED))
/* The kernel resets IPv6 MTU after changing device MTU. So, we need to re-set IPv6 MTU again. */
(void) link_set_ipv6_mtu(link, LOG_INFO);
(void) link_set_ipv6_mtu_async(link);
if (link->dhcp_client) {
r = sd_dhcp_client_set_mtu(link->dhcp_client, link->mtu);