]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
network: skip to set request address when anonymized
authorYu Watanabe <watanabe.yu+github@gmail.com>
Wed, 4 Oct 2023 21:53:01 +0000 (06:53 +0900)
committerYu Watanabe <watanabe.yu+github@gmail.com>
Wed, 4 Oct 2023 21:56:51 +0000 (06:56 +0900)
In sd-dhcp-client.c, we do not set the option in the DHCPDISCOVER
message when anonymized, and the specified address is ignored
anyway. So, this does not change the behavior, but suppress
misleading debugging log in dhcp4_set_request_address().

src/network/networkd-dhcp4.c

index f14e62588fec073dd5ed8642fa48bf04b5cf9405..2a6237c6d5159979cac6c83704109eed34f988e0 100644 (file)
@@ -1487,6 +1487,10 @@ static int dhcp4_configure(Link *link) {
         }
 
         if (!link->network->dhcp_anonymize) {
+                r = dhcp4_set_request_address(link);
+                if (r < 0)
+                        return log_link_debug_errno(link, r, "DHCPv4 CLIENT: Failed to set initial DHCPv4 address: %m");
+
                 if (link->network->dhcp_use_mtu) {
                         r = sd_dhcp_client_set_request_option(link->dhcp_client, SD_DHCP_OPTION_MTU_INTERFACE);
                         if (r < 0)
@@ -1616,10 +1620,6 @@ static int dhcp4_configure(Link *link) {
                         return log_link_debug_errno(link, r, "DHCPv4 CLIENT: Failed set to lease lifetime: %m");
         }
 
-        r = dhcp4_set_request_address(link);
-        if (r < 0)
-                return log_link_debug_errno(link, r, "DHCPv4 CLIENT: Failed to set initial DHCPv4 address: %m");
-
         return dhcp4_set_client_identifier(link);
 }