From 5d896defeb7a9c65de63515eb87542bf8d7c04e2 Mon Sep 17 00:00:00 2001 From: Yu Watanabe Date: Thu, 5 Oct 2023 06:53:01 +0900 Subject: [PATCH] network: skip to set request address when anonymized 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 | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/network/networkd-dhcp4.c b/src/network/networkd-dhcp4.c index f14e62588f..2a6237c6d5 100644 --- a/src/network/networkd-dhcp4.c +++ b/src/network/networkd-dhcp4.c @@ -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); }