]> git.ipfire.org Git - thirdparty/systemd.git/blobdiff - src/network/networkd-dhcp4.c
codespell: fix spelling errors
[thirdparty/systemd.git] / src / network / networkd-dhcp4.c
index 4493da4d59062edabcfed3a2d4702f89334e4e4e..9ea49b09de5d578cac8f58cf129084b15aef825f 100644 (file)
@@ -120,10 +120,12 @@ static int link_set_dhcp_routes(Link *link) {
         }
 
         r = sd_dhcp_lease_get_router(link->dhcp_lease, &router);
-        if (r < 0 && r != -ENODATA)
+        if (IN_SET(r, 0, -ENODATA))
+                log_link_info(link, "DHCP: No gateway received from DHCP server.");
+        else if (r < 0)
                 log_link_warning_errno(link, r, "DHCP error: could not get gateway: %m");
-        else if (r <= 0 || in4_addr_is_null(&router[0]))
-                log_link_info_errno(link, r, "DHCP: No gateway received from DHCP server: %m");
+        else if (in4_addr_is_null(&router[0]))
+                log_link_info(link, "DHCP: Received gateway is null.");
 
         /* According to RFC 3442: If the DHCP server returns both a Classless Static Routes option and
            a Router option, the DHCP client MUST ignore the Router option. */
@@ -259,7 +261,7 @@ static int dhcp_lease_lost(Link *link) {
 
                 r = sd_dhcp_lease_get_mtu(link->dhcp_lease, &mtu);
                 if (r >= 0 && link->original_mtu != mtu) {
-                        r = link_set_mtu(link, link->original_mtu);
+                        r = link_set_mtu(link, link->original_mtu, true);
                         if (r < 0) {
                                 log_link_warning(link,
                                                  "DHCP error: could not reset MTU");
@@ -449,7 +451,7 @@ static int dhcp_lease_acquired(sd_dhcp_client *client, Link *link) {
 
                 r = sd_dhcp_lease_get_mtu(lease, &mtu);
                 if (r >= 0) {
-                        r = link_set_mtu(link, mtu);
+                        r = link_set_mtu(link, mtu, true);
                         if (r < 0)
                                 log_link_error_errno(link, r, "Failed to set MTU to %" PRIu16 ": %m", mtu);
                 }
@@ -469,7 +471,7 @@ static int dhcp_lease_acquired(sd_dhcp_client *client, Link *link) {
                         if (r < 0)
                                 log_link_warning_errno(link, r, "Unable to shorten overlong DHCP hostname '%s', ignoring: %m", dhcpname);
                         if (r == 1)
-                                log_link_notice(link, "Overlong DCHP hostname received, shortened from '%s' to '%s'", dhcpname, hostname);
+                                log_link_notice(link, "Overlong DHCP hostname received, shortened from '%s' to '%s'", dhcpname, hostname);
                 }
 
                 if (hostname) {