network: do not fail if UseMTU=yes on DHCP lease lost

This fixes a bug introduced by 6906794dd1.

Fixes #16768.
This commit is contained in:
Yu Watanabe 2020-08-18 19:21:25 +09:00 committed by Lennart Poettering
parent f9536e6793
commit 46b875fb80

View file

@ -429,18 +429,17 @@ static int dhcp_reset_mtu(Link *link) {
return 0; return 0;
r = sd_dhcp_lease_get_mtu(link->dhcp_lease, &mtu); r = sd_dhcp_lease_get_mtu(link->dhcp_lease, &mtu);
if (r == -ENODATA)
return 0;
if (r < 0) if (r < 0)
return r; return log_link_error_errno(link, r, "DHCP error: failed to get MTU from lease: %m");
if (link->original_mtu == mtu) if (link->original_mtu == mtu)
return 0; return 0;
r = link_set_mtu(link, link->original_mtu); r = link_set_mtu(link, link->original_mtu);
if (r < 0) { if (r < 0)
log_link_error_errno(link, r, "DHCP error: could not reset MTU: %m"); return log_link_error_errno(link, r, "DHCP error: could not reset MTU: %m");
link_enter_failed(link);
return r;
}
return 0; return 0;
} }