]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
network: do not fail if UseMTU=yes on DHCP lease lost
authorYu Watanabe <watanabe.yu+github@gmail.com>
Tue, 18 Aug 2020 10:21:25 +0000 (19:21 +0900)
committerLennart Poettering <lennart@poettering.net>
Tue, 18 Aug 2020 18:33:58 +0000 (20:33 +0200)
This fixes a bug introduced by 6906794dd1698954b349ec3ec84f1494ecd63cd3.

Fixes #16768.

src/network/networkd-dhcp4.c

index 722e0d213bb045cb7dcf1b0566e9ada283885c99..d28c3e3806045eece987f8694aa70958e8622905 100644 (file)
@@ -429,18 +429,17 @@ static int dhcp_reset_mtu(Link *link) {
                 return 0;
 
         r = sd_dhcp_lease_get_mtu(link->dhcp_lease, &mtu);
+        if (r == -ENODATA)
+                return 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)
                 return 0;
 
         r = link_set_mtu(link, link->original_mtu);
-        if (r < 0) {
-                log_link_error_errno(link, r, "DHCP error: could not reset MTU: %m");
-                link_enter_failed(link);
-                return r;
-        }
+        if (r < 0)
+                return log_link_error_errno(link, r, "DHCP error: could not reset MTU: %m");
 
         return 0;
 }