network: always set IPv6 MTU when we detect the device MTU is changed
Then, we can keep the IPv6 MTU even if the device MTU is changed by an external tool, e.g. 'ip link set' command.
This commit is contained in:
@@ -2434,6 +2434,13 @@ static int link_update_mtu(Link *link, sd_netlink_message *message) {
|
||||
|
||||
link->mtu = mtu;
|
||||
|
||||
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. */
|
||||
r = link_set_ipv6_mtu(link);
|
||||
if (r < 0)
|
||||
log_link_warning_errno(link, r, "Failed to set IPv6 MTU, ignoring: %m");
|
||||
}
|
||||
|
||||
if (link->dhcp_client) {
|
||||
r = sd_dhcp_client_set_mtu(link->dhcp_client, link->mtu);
|
||||
if (r < 0)
|
||||
|
||||
@@ -173,19 +173,7 @@ static int link_unset_master_handler(sd_netlink *rtnl, sd_netlink_message *m, Re
|
||||
}
|
||||
|
||||
static int link_set_mtu_handler(sd_netlink *rtnl, sd_netlink_message *m, Request *req, Link *link, void *userdata) {
|
||||
int r;
|
||||
|
||||
r = set_link_handler_internal(rtnl, m, req, link, /* ignore = */ true, get_link_default_handler);
|
||||
if (r <= 0)
|
||||
return r;
|
||||
|
||||
/* The kernel resets ipv6 mtu after changing device mtu;
|
||||
* we must set this here, after we've set device mtu */
|
||||
r = link_set_ipv6_mtu(link);
|
||||
if (r < 0)
|
||||
log_link_warning_errno(link, r, "Failed to set IPv6 MTU, ignoring: %m");
|
||||
|
||||
return 0;
|
||||
return set_link_handler_internal(rtnl, m, req, link, /* ignore = */ true, get_link_default_handler);
|
||||
}
|
||||
|
||||
static int link_configure_fill_message(
|
||||
|
||||
Reference in New Issue
Block a user