From 5aebe9c898b3ac242ca875dcea111e485ed19c0d Mon Sep 17 00:00:00 2001 From: Yu Watanabe Date: Tue, 15 Jun 2021 22:07:42 +0900 Subject: [PATCH 1/6] network: downgrade log level in dhcp4_configure() And make the callers warn about failures. --- src/network/networkd-dhcp-common.c | 2 +- src/network/networkd-dhcp4.c | 64 +++++++++++++++--------------- src/network/networkd-link.c | 2 +- 3 files changed, 34 insertions(+), 34 deletions(-) diff --git a/src/network/networkd-dhcp-common.c b/src/network/networkd-dhcp-common.c index 249d780887..369dd59e80 100644 --- a/src/network/networkd-dhcp-common.c +++ b/src/network/networkd-dhcp-common.c @@ -107,7 +107,7 @@ static int link_configure_and_start_dhcp_delayed(Link *link) { if (!link->dhcp_client) { r = dhcp4_configure(link); if (r < 0) - return r; + return log_link_warning_errno(link, r, "Failed to configure DHCP4 client: %m"); } if (!link->dhcp6_client) { diff --git a/src/network/networkd-dhcp4.c b/src/network/networkd-dhcp4.c index c986031b87..135aeace7e 100644 --- a/src/network/networkd-dhcp4.c +++ b/src/network/networkd-dhcp4.c @@ -1311,7 +1311,7 @@ static int dhcp4_set_hostname(Link *link) { else { r = gethostname_strict(&hostname); if (r < 0 && r != -ENXIO) /* ENXIO: no hostname set or hostname is "localhost" */ - return log_link_warning_errno(link, r, "DHCP4 CLIENT: Failed to get hostname: %m"); + return log_link_debug_errno(link, r, "DHCP4 CLIENT: Failed to get hostname: %m"); hn = hostname; } @@ -1321,7 +1321,7 @@ static int dhcp4_set_hostname(Link *link) { /* Ignore error when the machine's hostname is not suitable to send in DHCP packet. */ log_link_debug_errno(link, r, "DHCP4 CLIENT: Failed to set hostname from kernel hostname, ignoring: %m"); else if (r < 0) - return log_link_warning_errno(link, r, "DHCP4 CLIENT: Failed to set hostname: %m"); + return log_link_debug_errno(link, r, "DHCP4 CLIENT: Failed to set hostname: %m"); return 0; } @@ -1351,7 +1351,7 @@ static int dhcp4_set_client_identifier(Link *link) { duid->raw_data_len > 0 ? duid->raw_data : NULL, duid->raw_data_len); if (r < 0) - return log_link_warning_errno(link, r, "DHCP4 CLIENT: Failed to set IAID+DUID: %m"); + return log_link_debug_errno(link, r, "DHCP4 CLIENT: Failed to set IAID+DUID: %m"); break; } case DHCP_CLIENT_ID_DUID_ONLY: { @@ -1367,7 +1367,7 @@ static int dhcp4_set_client_identifier(Link *link) { duid->raw_data_len > 0 ? duid->raw_data : NULL, duid->raw_data_len); if (r < 0) - return log_link_warning_errno(link, r, "DHCP4 CLIENT: Failed to set DUID: %m"); + return log_link_debug_errno(link, r, "DHCP4 CLIENT: Failed to set DUID: %m"); break; } case DHCP_CLIENT_ID_MAC: { @@ -1385,7 +1385,7 @@ static int dhcp4_set_client_identifier(Link *link) { hw_addr, hw_addr_len); if (r < 0) - return log_link_warning_errno(link, r, "DHCP4 CLIENT: Failed to set client ID: %m"); + return log_link_debug_errno(link, r, "DHCP4 CLIENT: Failed to set client ID: %m"); break; } default: @@ -1445,7 +1445,7 @@ static bool link_needs_dhcp_broadcast(Link *link) { if (r < 0 && link->sd_device && sd_device_get_property_value(link->sd_device, "ID_NET_DHCP_BROADCAST", &val) >= 0) { r = parse_boolean(val); if (r < 0) - log_link_warning_errno(link, r, "DHCP4 CLIENT: Failed to parse ID_NET_DHCP_BROADCAST, ignoring: %m"); + log_link_debug_errno(link, r, "DHCP4 CLIENT: Failed to parse ID_NET_DHCP_BROADCAST, ignoring: %m"); else log_link_debug(link, "DHCP4 CLIENT: Detected ID_NET_DHCP_BROADCAST='%d'.", r); @@ -1465,7 +1465,7 @@ int dhcp4_configure(Link *link) { return 0; if (link->dhcp_client) - return -EBUSY; /* Already configured. */ + return log_link_debug_errno(link, SYNTHETIC_ERRNO(EBUSY), "DHCP4 client is already configured."); r = dhcp4_configure_duid(link); if (r <= 0) @@ -1473,76 +1473,76 @@ int dhcp4_configure(Link *link) { r = sd_dhcp_client_new(&link->dhcp_client, link->network->dhcp_anonymize); if (r < 0) - return log_link_warning_errno(link, r, "DHCP4 CLIENT: Failed to allocate DHCP4 client: %m"); + return log_link_debug_errno(link, r, "DHCP4 CLIENT: Failed to allocate DHCP4 client: %m"); r = sd_dhcp_client_attach_event(link->dhcp_client, link->manager->event, 0); if (r < 0) - return log_link_warning_errno(link, r, "DHCP4 CLIENT: Failed to attach event to DHCP4 client: %m"); + return log_link_debug_errno(link, r, "DHCP4 CLIENT: Failed to attach event to DHCP4 client: %m"); r = sd_dhcp_client_set_mac(link->dhcp_client, link->hw_addr.bytes, link->bcast_addr.length > 0 ? link->bcast_addr.bytes : NULL, link->hw_addr.length, link->iftype); if (r < 0) - return log_link_warning_errno(link, r, "DHCP4 CLIENT: Failed to set MAC address: %m"); + return log_link_debug_errno(link, r, "DHCP4 CLIENT: Failed to set MAC address: %m"); r = sd_dhcp_client_set_ifindex(link->dhcp_client, link->ifindex); if (r < 0) - return log_link_warning_errno(link, r, "DHCP4 CLIENT: Failed to set ifindex: %m"); + return log_link_debug_errno(link, r, "DHCP4 CLIENT: Failed to set ifindex: %m"); r = sd_dhcp_client_set_callback(link->dhcp_client, dhcp4_handler, link); if (r < 0) - return log_link_warning_errno(link, r, "DHCP4 CLIENT: Failed to set callback: %m"); + return log_link_debug_errno(link, r, "DHCP4 CLIENT: Failed to set callback: %m"); r = sd_dhcp_client_set_request_broadcast(link->dhcp_client, link_needs_dhcp_broadcast(link)); if (r < 0) - return log_link_warning_errno(link, r, "DHCP4 CLIENT: Failed to set request flag for broadcast: %m"); + return log_link_debug_errno(link, r, "DHCP4 CLIENT: Failed to set request flag for broadcast: %m"); if (link->mtu > 0) { r = sd_dhcp_client_set_mtu(link->dhcp_client, link->mtu); if (r < 0) - return log_link_warning_errno(link, r, "DHCP4 CLIENT: Failed to set MTU: %m"); + return log_link_debug_errno(link, r, "DHCP4 CLIENT: Failed to set MTU: %m"); } if (!link->network->dhcp_anonymize) { if (link->network->dhcp_use_mtu) { r = sd_dhcp_client_set_request_option(link->dhcp_client, SD_DHCP_OPTION_INTERFACE_MTU); if (r < 0) - return log_link_warning_errno(link, r, "DHCP4 CLIENT: Failed to set request flag for MTU: %m"); + return log_link_debug_errno(link, r, "DHCP4 CLIENT: Failed to set request flag for MTU: %m"); } if (link->network->dhcp_use_routes) { r = sd_dhcp_client_set_request_option(link->dhcp_client, SD_DHCP_OPTION_STATIC_ROUTE); if (r < 0) - return log_link_warning_errno(link, r, "DHCP4 CLIENT: Failed to set request flag for static route: %m"); + return log_link_debug_errno(link, r, "DHCP4 CLIENT: Failed to set request flag for static route: %m"); r = sd_dhcp_client_set_request_option(link->dhcp_client, SD_DHCP_OPTION_CLASSLESS_STATIC_ROUTE); if (r < 0) - return log_link_warning_errno(link, r, "DHCP4 CLIENT: Failed to set request flag for classless static route: %m"); + return log_link_debug_errno(link, r, "DHCP4 CLIENT: Failed to set request flag for classless static route: %m"); } if (link->network->dhcp_use_domains != DHCP_USE_DOMAINS_NO) { r = sd_dhcp_client_set_request_option(link->dhcp_client, SD_DHCP_OPTION_DOMAIN_SEARCH_LIST); if (r < 0) - return log_link_warning_errno(link, r, "DHCP4 CLIENT: Failed to set request flag for domain search list: %m"); + return log_link_debug_errno(link, r, "DHCP4 CLIENT: Failed to set request flag for domain search list: %m"); } if (link->network->dhcp_use_ntp) { r = sd_dhcp_client_set_request_option(link->dhcp_client, SD_DHCP_OPTION_NTP_SERVER); if (r < 0) - return log_link_warning_errno(link, r, "DHCP4 CLIENT: Failed to set request flag for NTP server: %m"); + return log_link_debug_errno(link, r, "DHCP4 CLIENT: Failed to set request flag for NTP server: %m"); } if (link->network->dhcp_use_sip) { r = sd_dhcp_client_set_request_option(link->dhcp_client, SD_DHCP_OPTION_SIP_SERVER); if (r < 0) - return log_link_warning_errno(link, r, "DHCP4 CLIENT: Failed to set request flag for SIP server: %m"); + return log_link_debug_errno(link, r, "DHCP4 CLIENT: Failed to set request flag for SIP server: %m"); } if (link->network->dhcp_use_timezone) { r = sd_dhcp_client_set_request_option(link->dhcp_client, SD_DHCP_OPTION_NEW_TZDB_TIMEZONE); if (r < 0) - return log_link_warning_errno(link, r, "DHCP4 CLIENT: Failed to set request flag for timezone: %m"); + return log_link_debug_errno(link, r, "DHCP4 CLIENT: Failed to set request flag for timezone: %m"); } SET_FOREACH(request_options, link->network->dhcp_request_options) { @@ -1550,7 +1550,7 @@ int dhcp4_configure(Link *link) { r = sd_dhcp_client_set_request_option(link->dhcp_client, option); if (r < 0) - return log_link_warning_errno(link, r, "DHCP4 CLIENT: Failed to set request flag for '%u': %m", option); + return log_link_debug_errno(link, r, "DHCP4 CLIENT: Failed to set request flag for '%u': %m", option); } ORDERED_HASHMAP_FOREACH(send_option, link->network->dhcp_client_send_options) { @@ -1558,7 +1558,7 @@ int dhcp4_configure(Link *link) { if (r == -EEXIST) continue; if (r < 0) - return log_link_warning_errno(link, r, "DHCP4 CLIENT: Failed to set send option: %m"); + return log_link_debug_errno(link, r, "DHCP4 CLIENT: Failed to set send option: %m"); } ORDERED_HASHMAP_FOREACH(send_option, link->network->dhcp_client_send_vendor_options) { @@ -1566,7 +1566,7 @@ int dhcp4_configure(Link *link) { if (r == -EEXIST) continue; if (r < 0) - return log_link_warning_errno(link, r, "DHCP4 CLIENT: Failed to set send option: %m"); + return log_link_debug_errno(link, r, "DHCP4 CLIENT: Failed to set send option: %m"); } r = dhcp4_set_hostname(link); @@ -1577,49 +1577,49 @@ int dhcp4_configure(Link *link) { r = sd_dhcp_client_set_vendor_class_identifier(link->dhcp_client, link->network->dhcp_vendor_class_identifier); if (r < 0) - return log_link_warning_errno(link, r, "DHCP4 CLIENT: Failed to set vendor class identifier: %m"); + return log_link_debug_errno(link, r, "DHCP4 CLIENT: Failed to set vendor class identifier: %m"); } if (link->network->dhcp_mudurl) { r = sd_dhcp_client_set_mud_url(link->dhcp_client, link->network->dhcp_mudurl); if (r < 0) - return log_link_warning_errno(link, r, "DHCP4 CLIENT: Failed to set MUD URL: %m"); + return log_link_debug_errno(link, r, "DHCP4 CLIENT: Failed to set MUD URL: %m"); } if (link->network->dhcp_user_class) { r = sd_dhcp_client_set_user_class(link->dhcp_client, link->network->dhcp_user_class); if (r < 0) - return log_link_warning_errno(link, r, "DHCP4 CLIENT: Failed to set user class: %m"); + return log_link_debug_errno(link, r, "DHCP4 CLIENT: Failed to set user class: %m"); } } if (link->network->dhcp_client_port > 0) { r = sd_dhcp_client_set_client_port(link->dhcp_client, link->network->dhcp_client_port); if (r < 0) - return log_link_warning_errno(link, r, "DHCP4 CLIENT: Failed to set listen port: %m"); + return log_link_debug_errno(link, r, "DHCP4 CLIENT: Failed to set listen port: %m"); } if (link->network->dhcp_max_attempts > 0) { r = sd_dhcp_client_set_max_attempts(link->dhcp_client, link->network->dhcp_max_attempts); if (r < 0) - return log_link_warning_errno(link, r, "DHCP4 CLIENT: Failed to set max attempts: %m"); + return log_link_debug_errno(link, r, "DHCP4 CLIENT: Failed to set max attempts: %m"); } if (link->network->dhcp_ip_service_type > 0) { r = sd_dhcp_client_set_service_type(link->dhcp_client, link->network->dhcp_ip_service_type); if (r < 0) - return log_link_warning_errno(link, r, "DHCP4 CLIENT: Failed to set IP service type: %m"); + return log_link_debug_errno(link, r, "DHCP4 CLIENT: Failed to set IP service type: %m"); } if (link->network->dhcp_fallback_lease_lifetime > 0) { r = sd_dhcp_client_set_fallback_lease_lifetime(link->dhcp_client, link->network->dhcp_fallback_lease_lifetime); if (r < 0) - return log_link_warning_errno(link, r, "DHCP4 CLIENT: Failed set to lease lifetime: %m"); + return log_link_debug_errno(link, r, "DHCP4 CLIENT: Failed set to lease lifetime: %m"); } r = dhcp4_set_request_address(link); if (r < 0) - return log_link_warning_errno(link, r, "DHCP4 CLIENT: Failed to set initial DHCPv4 address: %m"); + return log_link_debug_errno(link, r, "DHCP4 CLIENT: Failed to set initial DHCPv4 address: %m"); return dhcp4_set_client_identifier(link); } diff --git a/src/network/networkd-link.c b/src/network/networkd-link.c index 17fb932f81..e31da3a9a5 100644 --- a/src/network/networkd-link.c +++ b/src/network/networkd-link.c @@ -1129,7 +1129,7 @@ static int link_configure(Link *link) { r = dhcp4_configure(link); if (r < 0) - return r; + return log_link_warning_errno(link, r, "Failed to configure DHCP4 client: %m"); r = dhcp6_configure(link); if (r < 0) From bc8bd68db8e1716f60b15114be5b9878e36a5a23 Mon Sep 17 00:00:00 2001 From: Yu Watanabe Date: Tue, 15 Jun 2021 22:16:51 +0900 Subject: [PATCH 2/6] network: downgrade log level in dhcp6_configure() And make the callers warn about failures. --- src/network/networkd-dhcp-common.c | 2 +- src/network/networkd-dhcp6.c | 38 +++++++++++++++--------------- src/network/networkd-link.c | 2 +- 3 files changed, 21 insertions(+), 21 deletions(-) diff --git a/src/network/networkd-dhcp-common.c b/src/network/networkd-dhcp-common.c index 369dd59e80..0fd2376703 100644 --- a/src/network/networkd-dhcp-common.c +++ b/src/network/networkd-dhcp-common.c @@ -113,7 +113,7 @@ static int link_configure_and_start_dhcp_delayed(Link *link) { if (!link->dhcp6_client) { r = dhcp6_configure(link); if (r < 0) - return r; + return log_link_warning_errno(link, r, "Failed to configure DHCP6 client: %m"); } if (link->set_flags_messages > 0) diff --git a/src/network/networkd-dhcp6.c b/src/network/networkd-dhcp6.c index f03bf0651b..605ee7dd11 100644 --- a/src/network/networkd-dhcp6.c +++ b/src/network/networkd-dhcp6.c @@ -1505,7 +1505,7 @@ static int dhcp6_set_hostname(sd_dhcp6_client *client, Link *link) { else { r = gethostname_strict(&hostname); if (r < 0 && r != -ENXIO) /* ENXIO: no hostname set or hostname is "localhost" */ - return r; + return log_link_debug_errno(link, r, "DHCP6 CLIENT: Failed to get hostname: %m"); hn = hostname; } @@ -1513,9 +1513,9 @@ static int dhcp6_set_hostname(sd_dhcp6_client *client, Link *link) { r = sd_dhcp6_client_set_fqdn(client, hn); if (r == -EINVAL && hostname) /* Ignore error when the machine's hostname is not suitable to send in DHCP packet. */ - log_link_warning_errno(link, r, "DHCP6 CLIENT: Failed to set hostname from kernel hostname, ignoring: %m"); + log_link_debug_errno(link, r, "DHCP6 CLIENT: Failed to set hostname from kernel hostname, ignoring: %m"); else if (r < 0) - return log_link_error_errno(link, r, "DHCP6 CLIENT: Failed to set hostname: %m"); + return log_link_debug_errno(link, r, "DHCP6 CLIENT: Failed to set hostname: %m"); return 0; } @@ -1585,7 +1585,7 @@ int dhcp6_configure(Link *link) { return 0; if (link->dhcp6_client) - return -EBUSY; + return log_link_debug_errno(link, SYNTHETIC_ERRNO(EBUSY), "DHCP6 client is already configured."); r = dhcp_configure_duid(link, link_get_dhcp6_duid(link)); if (r <= 0) @@ -1593,24 +1593,24 @@ int dhcp6_configure(Link *link) { r = sd_dhcp6_client_new(&client); if (r == -ENOMEM) - return log_oom(); + return log_oom_debug(); if (r < 0) - return log_link_error_errno(link, r, "DHCP6 CLIENT: Failed to create DHCP6 client: %m"); + return log_link_debug_errno(link, r, "DHCP6 CLIENT: Failed to create DHCP6 client: %m"); r = sd_dhcp6_client_attach_event(client, link->manager->event, 0); if (r < 0) - return log_link_error_errno(link, r, "DHCP6 CLIENT: Failed to attach event: %m"); + return log_link_debug_errno(link, r, "DHCP6 CLIENT: Failed to attach event: %m"); r = dhcp6_set_identifier(link, client); if (r < 0) - return log_link_error_errno(link, r, "DHCP6 CLIENT: Failed to set identifier: %m"); + return log_link_debug_errno(link, r, "DHCP6 CLIENT: Failed to set identifier: %m"); ORDERED_HASHMAP_FOREACH(send_option, link->network->dhcp6_client_send_options) { r = sd_dhcp6_client_add_option(client, send_option); if (r == -EEXIST) continue; if (r < 0) - return log_link_error_errno(link, r, "DHCP6 CLIENT: Failed to set option: %m"); + return log_link_debug_errno(link, r, "DHCP6 CLIENT: Failed to set option: %m"); } r = dhcp6_set_hostname(client, link); @@ -1619,18 +1619,18 @@ int dhcp6_configure(Link *link) { r = sd_dhcp6_client_set_ifindex(client, link->ifindex); if (r < 0) - return log_link_error_errno(link, r, "DHCP6 CLIENT: Failed to set ifindex: %m"); + return log_link_debug_errno(link, r, "DHCP6 CLIENT: Failed to set ifindex: %m"); if (link->network->dhcp6_rapid_commit) { r = sd_dhcp6_client_set_request_option(client, SD_DHCP6_OPTION_RAPID_COMMIT); if (r < 0) - return log_link_error_errno(link, r, "DHCP6 CLIENT: Failed to set request flag for rapid commit: %m"); + return log_link_debug_errno(link, r, "DHCP6 CLIENT: Failed to set request flag for rapid commit: %m"); } if (link->network->dhcp6_mudurl) { r = sd_dhcp6_client_set_request_mud_url(client, link->network->dhcp6_mudurl); if (r < 0) - return log_link_error_errno(link, r, "DHCP6 CLIENT: Failed to set MUD URL: %m"); + return log_link_debug_errno(link, r, "DHCP6 CLIENT: Failed to set MUD URL: %m"); } SET_FOREACH(request_options, link->network->dhcp6_request_options) { @@ -1642,19 +1642,19 @@ int dhcp6_configure(Link *link) { continue; } if (r < 0) - return log_link_error_errno(link, r, "DHCP6 CLIENT: Failed to set request flag for '%u': %m", option); + return log_link_debug_errno(link, r, "DHCP6 CLIENT: Failed to set request flag for '%u': %m", option); } if (link->network->dhcp6_user_class) { r = sd_dhcp6_client_set_request_user_class(client, link->network->dhcp6_user_class); if (r < 0) - return log_link_error_errno(link, r, "DHCP6 CLIENT: Failed to set user class: %m"); + return log_link_debug_errno(link, r, "DHCP6 CLIENT: Failed to set user class: %m"); } if (link->network->dhcp6_vendor_class) { r = sd_dhcp6_client_set_request_vendor_class(client, link->network->dhcp6_vendor_class); if (r < 0) - return log_link_error_errno(link, r, "DHCP6 CLIENT: Failed to set vendor class: %m"); + return log_link_debug_errno(link, r, "DHCP6 CLIENT: Failed to set vendor class: %m"); } ORDERED_HASHMAP_FOREACH(vendor_option, link->network->dhcp6_client_send_vendor_options) { @@ -1662,23 +1662,23 @@ int dhcp6_configure(Link *link) { if (r == -EEXIST) continue; if (r < 0) - return log_link_error_errno(link, r, "DHCP6 CLIENT: Failed to set vendor option: %m"); + return log_link_debug_errno(link, r, "DHCP6 CLIENT: Failed to set vendor option: %m"); } r = sd_dhcp6_client_set_callback(client, dhcp6_handler, link); if (r < 0) - return log_link_error_errno(link, r, "DHCP6 CLIENT: Failed to set callback: %m"); + return log_link_debug_errno(link, r, "DHCP6 CLIENT: Failed to set callback: %m"); if (dhcp6_enable_prefix_delegation(link)) { r = sd_dhcp6_client_set_prefix_delegation(client, true); if (r < 0) - return log_link_error_errno(link, r, "DHCP6 CLIENT: Failed to set prefix delegation: %m"); + return log_link_debug_errno(link, r, "DHCP6 CLIENT: Failed to set prefix delegation: %m"); } if (link->network->dhcp6_pd_length > 0) { r = sd_dhcp6_client_set_prefix_delegation_hint(client, link->network->dhcp6_pd_length, &link->network->dhcp6_pd_address); if (r < 0) - return log_link_error_errno(link, r, "DHCP6 CLIENT: Failed to set prefix hint: %m"); + return log_link_debug_errno(link, r, "DHCP6 CLIENT: Failed to set prefix hint: %m"); } link->dhcp6_client = TAKE_PTR(client); diff --git a/src/network/networkd-link.c b/src/network/networkd-link.c index e31da3a9a5..b4d5155b4a 100644 --- a/src/network/networkd-link.c +++ b/src/network/networkd-link.c @@ -1133,7 +1133,7 @@ static int link_configure(Link *link) { r = dhcp6_configure(link); if (r < 0) - return r; + return log_link_warning_errno(link, r, "Failed to configure DHCP6 client: %m"); r = ndisc_configure(link); if (r < 0) From 6211b7362a6e61c32b392bbc35e73ca01cb5cbbf Mon Sep 17 00:00:00 2001 From: Yu Watanabe Date: Tue, 15 Jun 2021 22:20:16 +0900 Subject: [PATCH 3/6] network: do not request UUID frequently on failure If many interfaces request UUID, and networkd cannot get it for some reasons, then previously we call the DBus method so frequently. --- src/network/networkd-dhcp-common.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/network/networkd-dhcp-common.c b/src/network/networkd-dhcp-common.c index 0fd2376703..dd1dc78dae 100644 --- a/src/network/networkd-dhcp-common.c +++ b/src/network/networkd-dhcp-common.c @@ -242,6 +242,8 @@ int dhcp_configure_duid(Link *link, const DUID *duid) { if (r < 0) { log_link_warning_errno(link, r, "Failed to get product UUID. Falling back to use machine-app-specific ID as DUID-UUID: %m"); + + m->has_product_uuid = true; /* Do not request UUID again on failure. */ return 1; } From ccffa166d8fa6019c472b4d118516841f1b947e4 Mon Sep 17 00:00:00 2001 From: Yu Watanabe Date: Tue, 15 Jun 2021 23:24:46 +0900 Subject: [PATCH 4/6] network: use request queue to configure DHCP{4,6} clients Previously, when UUID is requested for DUID, then the clients are configured in callback of bus methods. But now, 'request queue' was implemented, so we can use it to wait until the product UUID is obtained. --- src/network/networkd-dhcp-common.c | 91 +++++++----------------------- src/network/networkd-dhcp4.c | 88 ++++++++++++++++++++++------- src/network/networkd-dhcp4.h | 6 +- src/network/networkd-dhcp6.c | 74 ++++++++++++++++++++---- src/network/networkd-dhcp6.h | 9 +-- src/network/networkd-link.c | 17 +++--- src/network/networkd-manager.c | 3 +- src/network/networkd-manager.h | 1 - src/network/networkd-ndisc.c | 3 + src/network/networkd-queue.c | 20 ++++++- src/network/networkd-queue.h | 2 + 11 files changed, 195 insertions(+), 119 deletions(-) diff --git a/src/network/networkd-dhcp-common.c b/src/network/networkd-dhcp-common.c index dd1dc78dae..3d00802b20 100644 --- a/src/network/networkd-dhcp-common.c +++ b/src/network/networkd-dhcp-common.c @@ -96,113 +96,64 @@ const DUID *link_get_duid(Link *link, int family) { return duid; } -static int link_configure_and_start_dhcp_delayed(Link *link) { - int r; - - assert(link); - - if (!IN_SET(link->state, LINK_STATE_CONFIGURING, LINK_STATE_CONFIGURED)) - return 0; - - if (!link->dhcp_client) { - r = dhcp4_configure(link); - if (r < 0) - return log_link_warning_errno(link, r, "Failed to configure DHCP4 client: %m"); - } - - if (!link->dhcp6_client) { - r = dhcp6_configure(link); - if (r < 0) - return log_link_warning_errno(link, r, "Failed to configure DHCP6 client: %m"); - } - - if (link->set_flags_messages > 0) - return 0; - - if (!link_has_carrier(link)) - return 0; - - r = dhcp4_start(link); - if (r < 0) - return log_link_warning_errno(link, r, "Failed to start DHCPv4 client: %m"); - - r = ndisc_start(link); - if (r < 0) - return log_link_warning_errno(link, r, "Failed to start IPv6 Router Discovery: %m"); - - r = dhcp6_start(link); - if (r < 0) - return log_link_warning_errno(link, r, "Failed to start DHCPv6 client: %m"); - - return 0; -} - static int get_product_uuid_handler(sd_bus_message *m, void *userdata, sd_bus_error *ret_error) { Manager *manager = userdata; const sd_bus_error *e; const void *a; size_t sz; - Link *link; int r; assert(m); assert(manager); + /* To avoid calling GetProductUUID() bus method so frequently, set the flag below + * even if the method fails. */ + manager->has_product_uuid = true; + e = sd_bus_message_get_error(m); if (e) { r = sd_bus_error_get_errno(e); log_warning_errno(r, "Could not get product UUID. Falling back to use machine-app-specific ID as DUID-UUID: %s", bus_error_message(e, r)); - goto configure; + return 0; } r = sd_bus_message_read_array(m, 'y', &a, &sz); if (r < 0) { log_warning_errno(r, "Failed to get product UUID. Falling back to use machine-app-specific ID as DUID-UUID: %m"); - goto configure; + return 0; } if (sz != sizeof(sd_id128_t)) { log_warning("Invalid product UUID. Falling back to use machine-app-specific ID as DUID-UUID."); - goto configure; + return 0; } + log_debug("Successfully obtained product UUID"); + memcpy(&manager->duid_product_uuid.raw_data, a, sz); manager->duid_product_uuid.raw_data_len = sz; -configure: - /* To avoid calling GetProductUUID() bus method so frequently, set the flag below - * even if the method fails. */ - manager->has_product_uuid = true; - - while ((link = set_steal_first(manager->links_requesting_uuid))) { - r = link_configure_and_start_dhcp_delayed(link); - if (r < 0) - link_enter_failed(link); - - link_unref(link); - } - - manager->links_requesting_uuid = set_free(manager->links_requesting_uuid); - - return 1; + return 0; } int manager_request_product_uuid(Manager *m) { + static bool bus_method_is_called = false; int r; assert(m); - if (m->product_uuid_requested) + if (bus_method_is_called) return 0; - log_debug("Requesting product UUID"); - - if (sd_bus_is_ready(m->bus) <= 0) { + if (sd_bus_is_ready(m->bus) <= 0 && !m->product_uuid_requested) { log_debug("Not connected to system bus, requesting product UUID later."); + m->product_uuid_requested = true; return 0; } + m->product_uuid_requested = false; + r = sd_bus_call_method_async( m->bus, NULL, @@ -217,7 +168,9 @@ int manager_request_product_uuid(Manager *m) { if (r < 0) return log_warning_errno(r, "Failed to get product UUID: %m"); - m->product_uuid_requested = true; + log_debug("Requesting product UUID."); + + bus_method_is_called = true; return 0; } @@ -247,12 +200,6 @@ int dhcp_configure_duid(Link *link, const DUID *duid) { return 1; } - r = set_ensure_put(&m->links_requesting_uuid, NULL, link); - if (r < 0) - return log_oom(); - if (r > 0) - link_ref(link); - return 0; } diff --git a/src/network/networkd-dhcp4.c b/src/network/networkd-dhcp4.c index 135aeace7e..cc6d198851 100644 --- a/src/network/networkd-dhcp4.c +++ b/src/network/networkd-dhcp4.c @@ -1395,15 +1395,6 @@ static int dhcp4_set_client_identifier(Link *link) { return 0; } -static int dhcp4_configure_duid(Link *link) { - assert(link); - - if (!IN_SET(link->network->dhcp_client_identifier, DHCP_CLIENT_ID_DUID, DHCP_CLIENT_ID_DUID_ONLY)) - return 1; - - return dhcp_configure_duid(link, link_get_dhcp4_duid(link)); -} - static int dhcp4_set_request_address(Link *link) { Address *a; @@ -1453,7 +1444,7 @@ static bool link_needs_dhcp_broadcast(Link *link) { return r == true; } -int dhcp4_configure(Link *link) { +static int dhcp4_configure(Link *link) { sd_dhcp_option *send_option; void *request_options; int r; @@ -1461,16 +1452,9 @@ int dhcp4_configure(Link *link) { assert(link); assert(link->network); - if (!link_dhcp4_enabled(link)) - return 0; - if (link->dhcp_client) return log_link_debug_errno(link, SYNTHETIC_ERRNO(EBUSY), "DHCP4 client is already configured."); - r = dhcp4_configure_duid(link); - if (r <= 0) - return r; - r = sd_dhcp_client_new(&link->dhcp_client, link->network->dhcp_anonymize); if (r < 0) return log_link_debug_errno(link, r, "DHCP4 CLIENT: Failed to allocate DHCP4 client: %m"); @@ -1642,17 +1626,83 @@ int dhcp4_update_mac(Link *link) { } int dhcp4_start(Link *link) { + int r; + assert(link); if (!link->dhcp_client) return 0; + if (!link_has_carrier(link)) + return 0; + if (sd_dhcp_client_is_running(link->dhcp_client) > 0) return 0; - log_link_debug(link, "Acquiring DHCPv4 lease"); + r = sd_dhcp_client_start(link->dhcp_client); + if (r < 0) + return r; - return sd_dhcp_client_start(link->dhcp_client); + return 1; +} + +static int dhcp4_configure_duid(Link *link) { + assert(link); + + if (!IN_SET(link->network->dhcp_client_identifier, DHCP_CLIENT_ID_DUID, DHCP_CLIENT_ID_DUID_ONLY)) + return 1; + + return dhcp_configure_duid(link, link_get_dhcp4_duid(link)); +} + +int request_process_dhcp4_client(Request *req) { + Link *link; + int r; + + assert(req); + assert(req->link); + assert(req->type == REQUEST_TYPE_DHCP4_CLIENT); + + link = req->link; + + if (!IN_SET(link->state, LINK_STATE_CONFIGURING, LINK_STATE_CONFIGURED)) + return 0; + + r = dhcp4_configure_duid(link); + if (r <= 0) + return r; + + r = dhcp4_configure(req->link); + if (r < 0) + return log_link_warning_errno(link, r, "Failed to configure DHCPv4 client: %m"); + + r = dhcp4_start(link); + if (r < 0) + return log_link_warning_errno(link, r, "Failed to start DHCPv4 client: %m"); + + log_link_debug(link, "DHCPv4 client is configured%s.", + r > 0 ? ", acquiring DHCPv4 lease" : ""); + + return 1; +} + +int link_request_dhcp4_client(Link *link) { + int r; + + assert(link); + + if (!link_dhcp4_enabled(link)) + return 0; + + if (link->dhcp_client) + return 0; + + r = link_queue_request(link, REQUEST_TYPE_DHCP4_CLIENT, NULL, false, NULL, NULL, NULL); + if (r < 0) + return log_link_warning_errno(link, r, "Failed to request configuring of the DHCPv4 client: %m"); + + log_link_debug(link, "Requested configuring of the DHCPv4 client."); + return 0; } int config_parse_dhcp_max_attempts( diff --git a/src/network/networkd-dhcp4.h b/src/network/networkd-dhcp4.h index e41e39fc6e..152c2213b4 100644 --- a/src/network/networkd-dhcp4.h +++ b/src/network/networkd-dhcp4.h @@ -4,6 +4,8 @@ #include "conf-parser.h" typedef struct Link Link; +typedef struct Network Network; +typedef struct Request Request; typedef enum DHCPClientIdentifier { DHCP_CLIENT_ID_MAC, @@ -18,11 +20,13 @@ typedef enum DHCPClientIdentifier { } DHCPClientIdentifier; void network_adjust_dhcp4(Network *network); -int dhcp4_configure(Link *link); int dhcp4_update_mac(Link *link); int dhcp4_start(Link *link); int dhcp4_lease_lost(Link *link); +int request_process_dhcp4_client(Request *req); +int link_request_dhcp4_client(Link *link); + CONFIG_PARSER_PROTOTYPE(config_parse_dhcp_client_identifier); CONFIG_PARSER_PROTOTYPE(config_parse_dhcp_acl_ip_address); CONFIG_PARSER_PROTOTYPE(config_parse_dhcp_max_attempts); diff --git a/src/network/networkd-dhcp6.c b/src/network/networkd-dhcp6.c index 605ee7dd11..163af103e4 100644 --- a/src/network/networkd-dhcp6.c +++ b/src/network/networkd-dhcp6.c @@ -1393,6 +1393,8 @@ int dhcp6_request_information(Link *link, int ir) { } int dhcp6_start(Link *link) { + int r; + assert(link); if (!link->dhcp6_client) @@ -1401,6 +1403,9 @@ int dhcp6_start(Link *link) { if (!link_dhcp6_enabled(link)) return 0; + if (!link_has_carrier(link)) + return 0; + if (link->network->dhcp6_without_ra == DHCP6_CLIENT_START_MODE_NO) return 0; @@ -1412,9 +1417,11 @@ int dhcp6_start(Link *link) { if (sd_dhcp6_client_is_running(link->dhcp6_client) > 0) return 0; - log_link_debug(link, "Acquiring DHCPv6 lease"); + r = dhcp6_request_information(link, link->network->dhcp6_without_ra == DHCP6_CLIENT_START_MODE_INFORMATION_REQUEST); + if (r < 0) + return r; - return dhcp6_request_information(link, link->network->dhcp6_without_ra == DHCP6_CLIENT_START_MODE_INFORMATION_REQUEST); + return 1; } int dhcp6_request_prefix_delegation(Link *link) { @@ -1571,7 +1578,7 @@ static int dhcp6_set_identifier(Link *link, sd_dhcp6_client *client) { return 0; } -int dhcp6_configure(Link *link) { +static int dhcp6_configure(Link *link) { _cleanup_(sd_dhcp6_client_unrefp) sd_dhcp6_client *client = NULL; sd_dhcp6_option *vendor_option; sd_dhcp6_option *send_option; @@ -1581,16 +1588,9 @@ int dhcp6_configure(Link *link) { assert(link); assert(link->network); - if (!link_dhcp6_enabled(link) && !link_ipv6_accept_ra_enabled(link)) - return 0; - if (link->dhcp6_client) return log_link_debug_errno(link, SYNTHETIC_ERRNO(EBUSY), "DHCP6 client is already configured."); - r = dhcp_configure_duid(link, link_get_dhcp6_duid(link)); - if (r <= 0) - return r; - r = sd_dhcp6_client_new(&client); if (r == -ENOMEM) return log_oom_debug(); @@ -1716,6 +1716,60 @@ int dhcp6_update_mac(Link *link) { return 0; } +int request_process_dhcp6_client(Request *req) { + Link *link; + int r; + + assert(req); + assert(req->link); + assert(req->type == REQUEST_TYPE_DHCP6_CLIENT); + + link = req->link; + + if (!IN_SET(link->state, LINK_STATE_CONFIGURING, LINK_STATE_CONFIGURED)) + return 0; + + r = dhcp_configure_duid(link, link_get_dhcp6_duid(link)); + if (r <= 0) + return r; + + r = dhcp6_configure(link); + if (r < 0) + return log_link_warning_errno(link, r, "Failed to configure DHCPv6 client: %m"); + + r = ndisc_start(link); + if (r < 0) + return log_link_warning_errno(link, r, "Failed to start IPv6 Router Discovery: %m"); + + r = dhcp6_start(link); + if (r < 0) + return log_link_warning_errno(link, r, "Failed to start DHCPv6 client: %m"); + + log_link_debug(link, "DHCPv6 client is configured%s.", + r > 0 ? ", acquiring DHCPv6 lease" : ""); + + return 1; +} + +int link_request_dhcp6_client(Link *link) { + int r; + + assert(link); + + if (!link_dhcp6_enabled(link) && !link_ipv6_accept_ra_enabled(link)) + return 0; + + if (link->dhcp6_client) + return 0; + + r = link_queue_request(link, REQUEST_TYPE_DHCP6_CLIENT, NULL, false, NULL, NULL, NULL); + if (r < 0) + return log_link_warning_errno(link, r, "Failed to request configuring of the DHCPv6 client: %m"); + + log_link_debug(link, "Requested configuring of the DHCPv6 client."); + return 0; +} + int link_serialize_dhcp6_client(Link *link, FILE *f) { _cleanup_free_ char *duid = NULL; uint32_t iaid; diff --git a/src/network/networkd-dhcp6.h b/src/network/networkd-dhcp6.h index 82becb0321..23612454d9 100644 --- a/src/network/networkd-dhcp6.h +++ b/src/network/networkd-dhcp6.h @@ -1,9 +1,8 @@ /* SPDX-License-Identifier: LGPL-2.1-or-later */ #pragma once -#include "sd-dhcp6-client.h" - #include "conf-parser.h" +#include "in-addr-util.h" #include "macro.h" typedef enum DHCP6ClientStartMode { @@ -15,7 +14,7 @@ typedef enum DHCP6ClientStartMode { } DHCP6ClientStartMode; typedef struct Link Link; -typedef struct Manager Manager; +typedef struct Request Request; typedef struct DHCP6DelegatedPrefix { struct in6_addr prefix; /* Prefix assigned to the link */ @@ -29,12 +28,14 @@ DEFINE_TRIVIAL_CLEANUP_FUNC(DHCP6DelegatedPrefix*, dhcp6_pd_free); bool link_dhcp6_with_address_enabled(Link *link); bool link_dhcp6_pd_is_enabled(Link *link); int dhcp6_pd_remove(Link *link); -int dhcp6_configure(Link *link); int dhcp6_update_mac(Link *link); int dhcp6_start(Link *link); int dhcp6_request_information(Link *link, int ir); int dhcp6_request_prefix_delegation(Link *link); +int request_process_dhcp6_client(Request *req); +int link_request_dhcp6_client(Link *link); + int link_serialize_dhcp6_client(Link *link, FILE *f); CONFIG_PARSER_PROTOTYPE(config_parse_dhcp6_pd_hint); diff --git a/src/network/networkd-link.c b/src/network/networkd-link.c index b4d5155b4a..041a53e97b 100644 --- a/src/network/networkd-link.c +++ b/src/network/networkd-link.c @@ -650,12 +650,14 @@ static int link_acquire_dynamic_ipv4_conf(Link *link) { if (r < 0) return log_link_warning_errno(link, r, "Failed to start DHCPv4 client: %m"); - } else if (link->ipv4ll) { - log_link_debug(link, "Acquiring IPv4 link-local address"); + log_link_debug(link, "Acquiring DHCPv4 lease."); + } else if (link->ipv4ll) { r = sd_ipv4ll_start(link->ipv4ll); if (r < 0) return log_link_warning_errno(link, r, "Could not acquire IPv4 link-local address: %m"); + + log_link_debug(link, "Acquiring IPv4 link-local address."); } if (link->dhcp_server) { @@ -975,8 +977,6 @@ static Link *link_drop(Link *link) { link_drop_from_master(link); - link_unref(set_remove(link->manager->links_requesting_uuid, link)); - (void) unlink(link->state_file); link_clean(link); @@ -1127,13 +1127,13 @@ static int link_configure(Link *link) { if (r < 0) return r; - r = dhcp4_configure(link); + r = link_request_dhcp4_client(link); if (r < 0) - return log_link_warning_errno(link, r, "Failed to configure DHCP4 client: %m"); + return r; - r = dhcp6_configure(link); + r = link_request_dhcp6_client(link); if (r < 0) - return log_link_warning_errno(link, r, "Failed to configure DHCP6 client: %m"); + return r; r = ndisc_configure(link); if (r < 0) @@ -1263,7 +1263,6 @@ static int link_reconfigure_impl(Link *link, bool force) { link_free_carrier_maps(link); link_free_engines(link); link->network = network_unref(link->network); - link_unref(set_remove(link->manager->links_requesting_uuid, link)); /* Then, apply new .network file */ link->network = network_ref(network); diff --git a/src/network/networkd-manager.c b/src/network/networkd-manager.c index 374d27bef3..c8df49a490 100644 --- a/src/network/networkd-manager.c +++ b/src/network/networkd-manager.c @@ -103,7 +103,7 @@ static int on_connected(sd_bus_message *message, void *userdata, sd_bus_error *r (void) manager_set_hostname(m, m->dynamic_hostname); if (m->dynamic_timezone) (void) manager_set_timezone(m, m->dynamic_timezone); - if (!set_isempty(m->links_requesting_uuid)) + if (m->product_uuid_requested) (void) manager_request_product_uuid(m); return 0; @@ -460,7 +460,6 @@ Manager* manager_free(Manager *m) { m->dhcp6_pd_prefixes = set_free_with_destructor(m->dhcp6_pd_prefixes, dhcp6_pd_free); m->dirty_links = set_free_with_destructor(m->dirty_links, link_unref); - m->links_requesting_uuid = set_free_with_destructor(m->links_requesting_uuid, link_unref); m->links_by_name = hashmap_free(m->links_by_name); m->links_by_hw_addr = hashmap_free(m->links_by_hw_addr); m->links_by_index = hashmap_free_with_destructor(m->links_by_index, link_unref); diff --git a/src/network/networkd-manager.h b/src/network/networkd-manager.h index 4ee48f3468..4e78904538 100644 --- a/src/network/networkd-manager.h +++ b/src/network/networkd-manager.h @@ -60,7 +60,6 @@ struct Manager { DUID duid_product_uuid; bool has_product_uuid; bool product_uuid_requested; - Set *links_requesting_uuid; char* dynamic_hostname; char* dynamic_timezone; diff --git a/src/network/networkd-ndisc.c b/src/network/networkd-ndisc.c index e5e6f5ac7f..bfdae0bc19 100644 --- a/src/network/networkd-ndisc.c +++ b/src/network/networkd-ndisc.c @@ -1396,6 +1396,9 @@ int ndisc_start(Link *link) { if (!link->ndisc || !link->dhcp6_client) return 0; + if (!link_has_carrier(link)) + return 0; + log_link_debug(link, "Discovering IPv6 routers"); return sd_ndisc_start(link->ndisc); diff --git a/src/network/networkd-queue.c b/src/network/networkd-queue.c index 27a16f2951..7f2481997d 100644 --- a/src/network/networkd-queue.c +++ b/src/network/networkd-queue.c @@ -5,6 +5,8 @@ #include "networkd-bridge-fdb.h" #include "networkd-bridge-mdb.h" #include "networkd-dhcp-server.h" +#include "networkd-dhcp4.h" +#include "networkd-dhcp6.h" #include "networkd-ipv6-proxy-ndp.h" #include "networkd-manager.h" #include "networkd-neighbor.h" @@ -33,6 +35,8 @@ static void request_free_object(RequestType type, void *object) { case REQUEST_TYPE_CREATE_STACKED_NETDEV: break; case REQUEST_TYPE_DHCP_SERVER: + case REQUEST_TYPE_DHCP4_CLIENT: + case REQUEST_TYPE_DHCP6_CLIENT: break; case REQUEST_TYPE_IPV6_PROXY_NDP: free(object); @@ -112,7 +116,9 @@ static void request_hash_func(const Request *req, struct siphash *state) { trivial_hash_func(req->object, state); break; case REQUEST_TYPE_DHCP_SERVER: - /* This type does not have an object. */ + case REQUEST_TYPE_DHCP4_CLIENT: + case REQUEST_TYPE_DHCP6_CLIENT: + /* These types do not have an object. */ break; case REQUEST_TYPE_IPV6_PROXY_NDP: in6_addr_hash_func(req->ipv6_proxy_ndp, state); @@ -170,6 +176,8 @@ static int request_compare_func(const struct Request *a, const struct Request *b case REQUEST_TYPE_CREATE_STACKED_NETDEV: return trivial_compare_func(a->object, b->object); case REQUEST_TYPE_DHCP_SERVER: + case REQUEST_TYPE_DHCP4_CLIENT: + case REQUEST_TYPE_DHCP6_CLIENT: return 0; case REQUEST_TYPE_IPV6_PROXY_NDP: return in6_addr_compare_func(a->ipv6_proxy_ndp, b->ipv6_proxy_ndp); @@ -218,12 +226,16 @@ int link_queue_request( assert(IN_SET(type, REQUEST_TYPE_ACTIVATE_LINK, REQUEST_TYPE_DHCP_SERVER, + REQUEST_TYPE_DHCP4_CLIENT, + REQUEST_TYPE_DHCP6_CLIENT, REQUEST_TYPE_RADV, REQUEST_TYPE_SET_LINK, REQUEST_TYPE_UP_DOWN) || object); assert(IN_SET(type, REQUEST_TYPE_DHCP_SERVER, + REQUEST_TYPE_DHCP4_CLIENT, + REQUEST_TYPE_DHCP6_CLIENT, REQUEST_TYPE_RADV) || netlink_handler); @@ -300,6 +312,12 @@ int manager_process_requests(sd_event_source *s, void *userdata) { case REQUEST_TYPE_DHCP_SERVER: r = request_process_dhcp_server(req); break; + case REQUEST_TYPE_DHCP4_CLIENT: + r = request_process_dhcp4_client(req); + break; + case REQUEST_TYPE_DHCP6_CLIENT: + r = request_process_dhcp6_client(req); + break; case REQUEST_TYPE_IPV6_PROXY_NDP: r = request_process_ipv6_proxy_ndp_address(req); break; diff --git a/src/network/networkd-queue.h b/src/network/networkd-queue.h index 85d2be7367..1fdd07d60a 100644 --- a/src/network/networkd-queue.h +++ b/src/network/networkd-queue.h @@ -28,6 +28,8 @@ typedef enum RequestType { REQUEST_TYPE_BRIDGE_MDB, REQUEST_TYPE_CREATE_STACKED_NETDEV, REQUEST_TYPE_DHCP_SERVER, + REQUEST_TYPE_DHCP4_CLIENT, + REQUEST_TYPE_DHCP6_CLIENT, REQUEST_TYPE_IPV6_PROXY_NDP, REQUEST_TYPE_NEIGHBOR, REQUEST_TYPE_NEXTHOP, From 8716018664e13b71288d9c58c4805484d53ec483 Mon Sep 17 00:00:00 2001 From: Yu Watanabe Date: Tue, 10 Aug 2021 15:02:35 +0900 Subject: [PATCH 5/6] network: DHCP[46] -> DHCPv[46] in log messages --- src/network/networkd-dhcp-common.c | 12 ++--- src/network/networkd-dhcp4.c | 70 +++++++++++++++--------------- src/network/networkd-dhcp6.c | 42 +++++++++--------- src/network/networkd-link.c | 6 +-- 4 files changed, 65 insertions(+), 65 deletions(-) diff --git a/src/network/networkd-dhcp-common.c b/src/network/networkd-dhcp-common.c index 3d00802b20..2b201e271e 100644 --- a/src/network/networkd-dhcp-common.c +++ b/src/network/networkd-dhcp-common.c @@ -492,8 +492,8 @@ int config_parse_iaid(const char *unit, network->dhcp_iaid = iaid; network->dhcp_iaid_set = true; if (!network->dhcp6_iaid_set_explicitly) { - /* Backward compatibility. Previously, IAID is shared by DHCP4 and DHCP6. - * If DHCP6 IAID is not specified explicitly, then use DHCP4 IAID for DHCP6. */ + /* Backward compatibility. Previously, IAID is shared by DHCPv4 and DHCPv6. + * If DHCPv6 IAID is not specified explicitly, then use DHCPv4 IAID for DHCPv6. */ network->dhcp6_iaid = iaid; network->dhcp6_iaid_set = true; } @@ -985,7 +985,7 @@ int config_parse_manager_duid_type( assert(manager); - /* For backward compatibility. Setting both DHCP4 and DHCP6 DUID if they are not specified explicitly. */ + /* For backward compatibility. Setting both DHCPv4 and DHCPv6 DUID if they are not specified explicitly. */ r = config_parse_duid_type(unit, filename, line, section, section_line, lvalue, false, rvalue, &manager->dhcp_duid, manager); if (r < 0) @@ -1015,7 +1015,7 @@ int config_parse_network_duid_type( if (r < 0) return r; - /* For backward compatibility, also set DHCP6 DUID if not specified explicitly. */ + /* For backward compatibility, also set DHCPv6 DUID if not specified explicitly. */ return config_parse_duid_type(unit, filename, line, section, section_line, lvalue, false, rvalue, &network->dhcp6_duid, network); } @@ -1110,7 +1110,7 @@ int config_parse_manager_duid_rawdata( assert(manager); - /* For backward compatibility. Setting both DHCP4 and DHCP6 DUID if they are not specified explicitly. */ + /* For backward compatibility. Setting both DHCPv4 and DHCPv6 DUID if they are not specified explicitly. */ r = config_parse_duid_rawdata(unit, filename, line, section, section_line, lvalue, false, rvalue, &manager->dhcp_duid, manager); if (r < 0) @@ -1140,6 +1140,6 @@ int config_parse_network_duid_rawdata( if (r < 0) return r; - /* For backward compatibility, also set DHCP6 DUID if not specified explicitly. */ + /* For backward compatibility, also set DHCPv6 DUID if not specified explicitly. */ return config_parse_duid_rawdata(unit, filename, line, section, section_line, lvalue, false, rvalue, &network->dhcp6_duid, network); } diff --git a/src/network/networkd-dhcp4.c b/src/network/networkd-dhcp4.c index cc6d198851..12fb85bf90 100644 --- a/src/network/networkd-dhcp4.c +++ b/src/network/networkd-dhcp4.c @@ -1311,7 +1311,7 @@ static int dhcp4_set_hostname(Link *link) { else { r = gethostname_strict(&hostname); if (r < 0 && r != -ENXIO) /* ENXIO: no hostname set or hostname is "localhost" */ - return log_link_debug_errno(link, r, "DHCP4 CLIENT: Failed to get hostname: %m"); + return log_link_debug_errno(link, r, "DHCPv4 CLIENT: Failed to get hostname: %m"); hn = hostname; } @@ -1319,9 +1319,9 @@ static int dhcp4_set_hostname(Link *link) { r = sd_dhcp_client_set_hostname(link->dhcp_client, hn); if (r == -EINVAL && hostname) /* Ignore error when the machine's hostname is not suitable to send in DHCP packet. */ - log_link_debug_errno(link, r, "DHCP4 CLIENT: Failed to set hostname from kernel hostname, ignoring: %m"); + log_link_debug_errno(link, r, "DHCPv4 CLIENT: Failed to set hostname from kernel hostname, ignoring: %m"); else if (r < 0) - return log_link_debug_errno(link, r, "DHCP4 CLIENT: Failed to set hostname: %m"); + return log_link_debug_errno(link, r, "DHCPv4 CLIENT: Failed to set hostname: %m"); return 0; } @@ -1351,7 +1351,7 @@ static int dhcp4_set_client_identifier(Link *link) { duid->raw_data_len > 0 ? duid->raw_data : NULL, duid->raw_data_len); if (r < 0) - return log_link_debug_errno(link, r, "DHCP4 CLIENT: Failed to set IAID+DUID: %m"); + return log_link_debug_errno(link, r, "DHCPv4 CLIENT: Failed to set IAID+DUID: %m"); break; } case DHCP_CLIENT_ID_DUID_ONLY: { @@ -1367,7 +1367,7 @@ static int dhcp4_set_client_identifier(Link *link) { duid->raw_data_len > 0 ? duid->raw_data : NULL, duid->raw_data_len); if (r < 0) - return log_link_debug_errno(link, r, "DHCP4 CLIENT: Failed to set DUID: %m"); + return log_link_debug_errno(link, r, "DHCPv4 CLIENT: Failed to set DUID: %m"); break; } case DHCP_CLIENT_ID_MAC: { @@ -1385,7 +1385,7 @@ static int dhcp4_set_client_identifier(Link *link) { hw_addr, hw_addr_len); if (r < 0) - return log_link_debug_errno(link, r, "DHCP4 CLIENT: Failed to set client ID: %m"); + return log_link_debug_errno(link, r, "DHCPv4 CLIENT: Failed to set client ID: %m"); break; } default: @@ -1415,7 +1415,7 @@ static int dhcp4_set_request_address(Link *link) { if (!a) return 0; - log_link_debug(link, "DHCP4 CLIENT: requesting " IPV4_ADDRESS_FMT_STR, IPV4_ADDRESS_FMT_VAL(a->in_addr.in)); + log_link_debug(link, "DHCPv4 CLIENT: requesting " IPV4_ADDRESS_FMT_STR, IPV4_ADDRESS_FMT_VAL(a->in_addr.in)); return sd_dhcp_client_set_request_address(link->dhcp_client, &a->in_addr.in); } @@ -1436,9 +1436,9 @@ static bool link_needs_dhcp_broadcast(Link *link) { if (r < 0 && link->sd_device && sd_device_get_property_value(link->sd_device, "ID_NET_DHCP_BROADCAST", &val) >= 0) { r = parse_boolean(val); if (r < 0) - log_link_debug_errno(link, r, "DHCP4 CLIENT: Failed to parse ID_NET_DHCP_BROADCAST, ignoring: %m"); + log_link_debug_errno(link, r, "DHCPv4 CLIENT: Failed to parse ID_NET_DHCP_BROADCAST, ignoring: %m"); else - log_link_debug(link, "DHCP4 CLIENT: Detected ID_NET_DHCP_BROADCAST='%d'.", r); + log_link_debug(link, "DHCPv4 CLIENT: Detected ID_NET_DHCP_BROADCAST='%d'.", r); } return r == true; @@ -1453,80 +1453,80 @@ static int dhcp4_configure(Link *link) { assert(link->network); if (link->dhcp_client) - return log_link_debug_errno(link, SYNTHETIC_ERRNO(EBUSY), "DHCP4 client is already configured."); + return log_link_debug_errno(link, SYNTHETIC_ERRNO(EBUSY), "DHCPv4 client is already configured."); r = sd_dhcp_client_new(&link->dhcp_client, link->network->dhcp_anonymize); if (r < 0) - return log_link_debug_errno(link, r, "DHCP4 CLIENT: Failed to allocate DHCP4 client: %m"); + return log_link_debug_errno(link, r, "DHCPv4 CLIENT: Failed to allocate DHCPv4 client: %m"); r = sd_dhcp_client_attach_event(link->dhcp_client, link->manager->event, 0); if (r < 0) - return log_link_debug_errno(link, r, "DHCP4 CLIENT: Failed to attach event to DHCP4 client: %m"); + return log_link_debug_errno(link, r, "DHCPv4 CLIENT: Failed to attach event to DHCPv4 client: %m"); r = sd_dhcp_client_set_mac(link->dhcp_client, link->hw_addr.bytes, link->bcast_addr.length > 0 ? link->bcast_addr.bytes : NULL, link->hw_addr.length, link->iftype); if (r < 0) - return log_link_debug_errno(link, r, "DHCP4 CLIENT: Failed to set MAC address: %m"); + return log_link_debug_errno(link, r, "DHCPv4 CLIENT: Failed to set MAC address: %m"); r = sd_dhcp_client_set_ifindex(link->dhcp_client, link->ifindex); if (r < 0) - return log_link_debug_errno(link, r, "DHCP4 CLIENT: Failed to set ifindex: %m"); + return log_link_debug_errno(link, r, "DHCPv4 CLIENT: Failed to set ifindex: %m"); r = sd_dhcp_client_set_callback(link->dhcp_client, dhcp4_handler, link); if (r < 0) - return log_link_debug_errno(link, r, "DHCP4 CLIENT: Failed to set callback: %m"); + return log_link_debug_errno(link, r, "DHCPv4 CLIENT: Failed to set callback: %m"); r = sd_dhcp_client_set_request_broadcast(link->dhcp_client, link_needs_dhcp_broadcast(link)); if (r < 0) - return log_link_debug_errno(link, r, "DHCP4 CLIENT: Failed to set request flag for broadcast: %m"); + return log_link_debug_errno(link, r, "DHCPv4 CLIENT: Failed to set request flag for broadcast: %m"); if (link->mtu > 0) { r = sd_dhcp_client_set_mtu(link->dhcp_client, link->mtu); if (r < 0) - return log_link_debug_errno(link, r, "DHCP4 CLIENT: Failed to set MTU: %m"); + return log_link_debug_errno(link, r, "DHCPv4 CLIENT: Failed to set MTU: %m"); } if (!link->network->dhcp_anonymize) { if (link->network->dhcp_use_mtu) { r = sd_dhcp_client_set_request_option(link->dhcp_client, SD_DHCP_OPTION_INTERFACE_MTU); if (r < 0) - return log_link_debug_errno(link, r, "DHCP4 CLIENT: Failed to set request flag for MTU: %m"); + return log_link_debug_errno(link, r, "DHCPv4 CLIENT: Failed to set request flag for MTU: %m"); } if (link->network->dhcp_use_routes) { r = sd_dhcp_client_set_request_option(link->dhcp_client, SD_DHCP_OPTION_STATIC_ROUTE); if (r < 0) - return log_link_debug_errno(link, r, "DHCP4 CLIENT: Failed to set request flag for static route: %m"); + return log_link_debug_errno(link, r, "DHCPv4 CLIENT: Failed to set request flag for static route: %m"); r = sd_dhcp_client_set_request_option(link->dhcp_client, SD_DHCP_OPTION_CLASSLESS_STATIC_ROUTE); if (r < 0) - return log_link_debug_errno(link, r, "DHCP4 CLIENT: Failed to set request flag for classless static route: %m"); + return log_link_debug_errno(link, r, "DHCPv4 CLIENT: Failed to set request flag for classless static route: %m"); } if (link->network->dhcp_use_domains != DHCP_USE_DOMAINS_NO) { r = sd_dhcp_client_set_request_option(link->dhcp_client, SD_DHCP_OPTION_DOMAIN_SEARCH_LIST); if (r < 0) - return log_link_debug_errno(link, r, "DHCP4 CLIENT: Failed to set request flag for domain search list: %m"); + return log_link_debug_errno(link, r, "DHCPv4 CLIENT: Failed to set request flag for domain search list: %m"); } if (link->network->dhcp_use_ntp) { r = sd_dhcp_client_set_request_option(link->dhcp_client, SD_DHCP_OPTION_NTP_SERVER); if (r < 0) - return log_link_debug_errno(link, r, "DHCP4 CLIENT: Failed to set request flag for NTP server: %m"); + return log_link_debug_errno(link, r, "DHCPv4 CLIENT: Failed to set request flag for NTP server: %m"); } if (link->network->dhcp_use_sip) { r = sd_dhcp_client_set_request_option(link->dhcp_client, SD_DHCP_OPTION_SIP_SERVER); if (r < 0) - return log_link_debug_errno(link, r, "DHCP4 CLIENT: Failed to set request flag for SIP server: %m"); + return log_link_debug_errno(link, r, "DHCPv4 CLIENT: Failed to set request flag for SIP server: %m"); } if (link->network->dhcp_use_timezone) { r = sd_dhcp_client_set_request_option(link->dhcp_client, SD_DHCP_OPTION_NEW_TZDB_TIMEZONE); if (r < 0) - return log_link_debug_errno(link, r, "DHCP4 CLIENT: Failed to set request flag for timezone: %m"); + return log_link_debug_errno(link, r, "DHCPv4 CLIENT: Failed to set request flag for timezone: %m"); } SET_FOREACH(request_options, link->network->dhcp_request_options) { @@ -1534,7 +1534,7 @@ static int dhcp4_configure(Link *link) { r = sd_dhcp_client_set_request_option(link->dhcp_client, option); if (r < 0) - return log_link_debug_errno(link, r, "DHCP4 CLIENT: Failed to set request flag for '%u': %m", option); + return log_link_debug_errno(link, r, "DHCPv4 CLIENT: Failed to set request flag for '%u': %m", option); } ORDERED_HASHMAP_FOREACH(send_option, link->network->dhcp_client_send_options) { @@ -1542,7 +1542,7 @@ static int dhcp4_configure(Link *link) { if (r == -EEXIST) continue; if (r < 0) - return log_link_debug_errno(link, r, "DHCP4 CLIENT: Failed to set send option: %m"); + return log_link_debug_errno(link, r, "DHCPv4 CLIENT: Failed to set send option: %m"); } ORDERED_HASHMAP_FOREACH(send_option, link->network->dhcp_client_send_vendor_options) { @@ -1550,7 +1550,7 @@ static int dhcp4_configure(Link *link) { if (r == -EEXIST) continue; if (r < 0) - return log_link_debug_errno(link, r, "DHCP4 CLIENT: Failed to set send option: %m"); + return log_link_debug_errno(link, r, "DHCPv4 CLIENT: Failed to set send option: %m"); } r = dhcp4_set_hostname(link); @@ -1561,49 +1561,49 @@ static int dhcp4_configure(Link *link) { r = sd_dhcp_client_set_vendor_class_identifier(link->dhcp_client, link->network->dhcp_vendor_class_identifier); if (r < 0) - return log_link_debug_errno(link, r, "DHCP4 CLIENT: Failed to set vendor class identifier: %m"); + return log_link_debug_errno(link, r, "DHCPv4 CLIENT: Failed to set vendor class identifier: %m"); } if (link->network->dhcp_mudurl) { r = sd_dhcp_client_set_mud_url(link->dhcp_client, link->network->dhcp_mudurl); if (r < 0) - return log_link_debug_errno(link, r, "DHCP4 CLIENT: Failed to set MUD URL: %m"); + return log_link_debug_errno(link, r, "DHCPv4 CLIENT: Failed to set MUD URL: %m"); } if (link->network->dhcp_user_class) { r = sd_dhcp_client_set_user_class(link->dhcp_client, link->network->dhcp_user_class); if (r < 0) - return log_link_debug_errno(link, r, "DHCP4 CLIENT: Failed to set user class: %m"); + return log_link_debug_errno(link, r, "DHCPv4 CLIENT: Failed to set user class: %m"); } } if (link->network->dhcp_client_port > 0) { r = sd_dhcp_client_set_client_port(link->dhcp_client, link->network->dhcp_client_port); if (r < 0) - return log_link_debug_errno(link, r, "DHCP4 CLIENT: Failed to set listen port: %m"); + return log_link_debug_errno(link, r, "DHCPv4 CLIENT: Failed to set listen port: %m"); } if (link->network->dhcp_max_attempts > 0) { r = sd_dhcp_client_set_max_attempts(link->dhcp_client, link->network->dhcp_max_attempts); if (r < 0) - return log_link_debug_errno(link, r, "DHCP4 CLIENT: Failed to set max attempts: %m"); + return log_link_debug_errno(link, r, "DHCPv4 CLIENT: Failed to set max attempts: %m"); } if (link->network->dhcp_ip_service_type > 0) { r = sd_dhcp_client_set_service_type(link->dhcp_client, link->network->dhcp_ip_service_type); if (r < 0) - return log_link_debug_errno(link, r, "DHCP4 CLIENT: Failed to set IP service type: %m"); + return log_link_debug_errno(link, r, "DHCPv4 CLIENT: Failed to set IP service type: %m"); } if (link->network->dhcp_fallback_lease_lifetime > 0) { r = sd_dhcp_client_set_fallback_lease_lifetime(link->dhcp_client, link->network->dhcp_fallback_lease_lifetime); if (r < 0) - return log_link_debug_errno(link, r, "DHCP4 CLIENT: Failed set to lease lifetime: %m"); + 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, "DHCP4 CLIENT: Failed to set initial DHCPv4 address: %m"); + return log_link_debug_errno(link, r, "DHCPv4 CLIENT: Failed to set initial DHCPv4 address: %m"); return dhcp4_set_client_identifier(link); } diff --git a/src/network/networkd-dhcp6.c b/src/network/networkd-dhcp6.c index 163af103e4..2f755bc4eb 100644 --- a/src/network/networkd-dhcp6.c +++ b/src/network/networkd-dhcp6.c @@ -920,7 +920,7 @@ static int dhcp6_pd_prefix_add(Link *link, const struct in6_addr *prefix, uint8_ log_link_full(link, set_contains(link->dhcp6_pd_prefixes, p) ? LOG_DEBUG : prefixlen > 64 || prefixlen < 48 ? LOG_WARNING : LOG_INFO, - "DHCP6: received PD Prefix %s%s", + "DHCPv6: received PD Prefix %s%s", strna(buf), prefixlen > 64 ? " with prefix length > 64, ignoring." : prefixlen < 48 ? " with prefix length < 48, looks unusual.": ""); @@ -928,7 +928,7 @@ static int dhcp6_pd_prefix_add(Link *link, const struct in6_addr *prefix, uint8_ /* Store PD prefix even if prefixlen > 64, not to make logged at warning level so frequently. */ r = set_ensure_put(&link->dhcp6_pd_prefixes, &in_addr_prefix_hash_ops_free, p); if (r < 0) - return log_link_error_errno(link, r, "Failed to store DHCP6 PD prefix %s: %m", strna(buf)); + return log_link_error_errno(link, r, "Failed to store DHCPv6 PD prefix %s: %m", strna(buf)); if (r > 0) TAKE_PTR(p); @@ -1512,7 +1512,7 @@ static int dhcp6_set_hostname(sd_dhcp6_client *client, Link *link) { else { r = gethostname_strict(&hostname); if (r < 0 && r != -ENXIO) /* ENXIO: no hostname set or hostname is "localhost" */ - return log_link_debug_errno(link, r, "DHCP6 CLIENT: Failed to get hostname: %m"); + return log_link_debug_errno(link, r, "DHCPv6 CLIENT: Failed to get hostname: %m"); hn = hostname; } @@ -1520,9 +1520,9 @@ static int dhcp6_set_hostname(sd_dhcp6_client *client, Link *link) { r = sd_dhcp6_client_set_fqdn(client, hn); if (r == -EINVAL && hostname) /* Ignore error when the machine's hostname is not suitable to send in DHCP packet. */ - log_link_debug_errno(link, r, "DHCP6 CLIENT: Failed to set hostname from kernel hostname, ignoring: %m"); + log_link_debug_errno(link, r, "DHCPv6 CLIENT: Failed to set hostname from kernel hostname, ignoring: %m"); else if (r < 0) - return log_link_debug_errno(link, r, "DHCP6 CLIENT: Failed to set hostname: %m"); + return log_link_debug_errno(link, r, "DHCPv6 CLIENT: Failed to set hostname: %m"); return 0; } @@ -1589,28 +1589,28 @@ static int dhcp6_configure(Link *link) { assert(link->network); if (link->dhcp6_client) - return log_link_debug_errno(link, SYNTHETIC_ERRNO(EBUSY), "DHCP6 client is already configured."); + return log_link_debug_errno(link, SYNTHETIC_ERRNO(EBUSY), "DHCPv6 client is already configured."); r = sd_dhcp6_client_new(&client); if (r == -ENOMEM) return log_oom_debug(); if (r < 0) - return log_link_debug_errno(link, r, "DHCP6 CLIENT: Failed to create DHCP6 client: %m"); + return log_link_debug_errno(link, r, "DHCPv6 CLIENT: Failed to create DHCPv6 client: %m"); r = sd_dhcp6_client_attach_event(client, link->manager->event, 0); if (r < 0) - return log_link_debug_errno(link, r, "DHCP6 CLIENT: Failed to attach event: %m"); + return log_link_debug_errno(link, r, "DHCPv6 CLIENT: Failed to attach event: %m"); r = dhcp6_set_identifier(link, client); if (r < 0) - return log_link_debug_errno(link, r, "DHCP6 CLIENT: Failed to set identifier: %m"); + return log_link_debug_errno(link, r, "DHCPv6 CLIENT: Failed to set identifier: %m"); ORDERED_HASHMAP_FOREACH(send_option, link->network->dhcp6_client_send_options) { r = sd_dhcp6_client_add_option(client, send_option); if (r == -EEXIST) continue; if (r < 0) - return log_link_debug_errno(link, r, "DHCP6 CLIENT: Failed to set option: %m"); + return log_link_debug_errno(link, r, "DHCPv6 CLIENT: Failed to set option: %m"); } r = dhcp6_set_hostname(client, link); @@ -1619,18 +1619,18 @@ static int dhcp6_configure(Link *link) { r = sd_dhcp6_client_set_ifindex(client, link->ifindex); if (r < 0) - return log_link_debug_errno(link, r, "DHCP6 CLIENT: Failed to set ifindex: %m"); + return log_link_debug_errno(link, r, "DHCPv6 CLIENT: Failed to set ifindex: %m"); if (link->network->dhcp6_rapid_commit) { r = sd_dhcp6_client_set_request_option(client, SD_DHCP6_OPTION_RAPID_COMMIT); if (r < 0) - return log_link_debug_errno(link, r, "DHCP6 CLIENT: Failed to set request flag for rapid commit: %m"); + return log_link_debug_errno(link, r, "DHCPv6 CLIENT: Failed to set request flag for rapid commit: %m"); } if (link->network->dhcp6_mudurl) { r = sd_dhcp6_client_set_request_mud_url(client, link->network->dhcp6_mudurl); if (r < 0) - return log_link_debug_errno(link, r, "DHCP6 CLIENT: Failed to set MUD URL: %m"); + return log_link_debug_errno(link, r, "DHCPv6 CLIENT: Failed to set MUD URL: %m"); } SET_FOREACH(request_options, link->network->dhcp6_request_options) { @@ -1638,23 +1638,23 @@ static int dhcp6_configure(Link *link) { r = sd_dhcp6_client_set_request_option(client, option); if (r == -EEXIST) { - log_link_debug(link, "DHCP6 CLIENT: Failed to set request flag for '%u' already exists, ignoring.", option); + log_link_debug(link, "DHCPv6 CLIENT: Failed to set request flag for '%u' already exists, ignoring.", option); continue; } if (r < 0) - return log_link_debug_errno(link, r, "DHCP6 CLIENT: Failed to set request flag for '%u': %m", option); + return log_link_debug_errno(link, r, "DHCPv6 CLIENT: Failed to set request flag for '%u': %m", option); } if (link->network->dhcp6_user_class) { r = sd_dhcp6_client_set_request_user_class(client, link->network->dhcp6_user_class); if (r < 0) - return log_link_debug_errno(link, r, "DHCP6 CLIENT: Failed to set user class: %m"); + return log_link_debug_errno(link, r, "DHCPv6 CLIENT: Failed to set user class: %m"); } if (link->network->dhcp6_vendor_class) { r = sd_dhcp6_client_set_request_vendor_class(client, link->network->dhcp6_vendor_class); if (r < 0) - return log_link_debug_errno(link, r, "DHCP6 CLIENT: Failed to set vendor class: %m"); + return log_link_debug_errno(link, r, "DHCPv6 CLIENT: Failed to set vendor class: %m"); } ORDERED_HASHMAP_FOREACH(vendor_option, link->network->dhcp6_client_send_vendor_options) { @@ -1662,23 +1662,23 @@ static int dhcp6_configure(Link *link) { if (r == -EEXIST) continue; if (r < 0) - return log_link_debug_errno(link, r, "DHCP6 CLIENT: Failed to set vendor option: %m"); + return log_link_debug_errno(link, r, "DHCPv6 CLIENT: Failed to set vendor option: %m"); } r = sd_dhcp6_client_set_callback(client, dhcp6_handler, link); if (r < 0) - return log_link_debug_errno(link, r, "DHCP6 CLIENT: Failed to set callback: %m"); + return log_link_debug_errno(link, r, "DHCPv6 CLIENT: Failed to set callback: %m"); if (dhcp6_enable_prefix_delegation(link)) { r = sd_dhcp6_client_set_prefix_delegation(client, true); if (r < 0) - return log_link_debug_errno(link, r, "DHCP6 CLIENT: Failed to set prefix delegation: %m"); + return log_link_debug_errno(link, r, "DHCPv6 CLIENT: Failed to set prefix delegation: %m"); } if (link->network->dhcp6_pd_length > 0) { r = sd_dhcp6_client_set_prefix_delegation_hint(client, link->network->dhcp6_pd_length, &link->network->dhcp6_pd_address); if (r < 0) - return log_link_debug_errno(link, r, "DHCP6 CLIENT: Failed to set prefix hint: %m"); + return log_link_debug_errno(link, r, "DHCPv6 CLIENT: Failed to set prefix hint: %m"); } link->dhcp6_client = TAKE_PTR(client); diff --git a/src/network/networkd-link.c b/src/network/networkd-link.c index 041a53e97b..92fab92553 100644 --- a/src/network/networkd-link.c +++ b/src/network/networkd-link.c @@ -507,7 +507,7 @@ void link_check_ready(Link *link) { !link->dhcp_address && set_isempty(link->dhcp6_addresses) && !has_ndisc_address && !link->ipv4ll_address_configured) /* When DHCP[46] or IPv4LL is enabled, at least one address is acquired by them. */ - return (void) log_link_debug(link, "%s(): DHCP4, DHCP6 or IPv4LL is enabled but no dynamic address is assigned yet.", __func__); + return (void) log_link_debug(link, "%s(): DHCPv4, DHCPv6 or IPv4LL is enabled but no dynamic address is assigned yet.", __func__); /* Ignore NDisc when ConfigureWithoutCarrier= is enabled, as IPv6AcceptRA= is enabled by default. */ if (link_dhcp4_enabled(link) || link_dhcp6_enabled(link) || link_dhcp6_pd_is_enabled(link) || @@ -522,8 +522,8 @@ void link_check_ready(Link *link) { /* When DHCP[46], NDisc, or IPv4LL is enabled, at least one protocol must be finished. */ return (void) log_link_debug(link, "%s(): dynamic addresses or routes are not configured.", __func__); - log_link_debug(link, "%s(): dhcp4:%s ipv4ll:%s dhcp6_addresses:%s dhcp6_routes:%s " - "dhcp6_pd_addresses:%s dhcp6_pd_routes:%s ndisc_addresses:%s ndisc_routes:%s", + log_link_debug(link, "%s(): DHCPv4:%s IPv4LL:%s DHCPv6_addresses:%s DHCPv6_routes:%s " + "DHCPv6PD_addresses:%s DHCPv6PD_routes:%s NDisc_addresses:%s NDisc_routes:%s", __func__, yes_no(link->dhcp4_configured), yes_no(link->ipv4ll_address_configured), From b378b150b7286887f1782759bfa90df0345dc2ba Mon Sep 17 00:00:00 2001 From: Yu Watanabe Date: Tue, 10 Aug 2021 15:04:01 +0900 Subject: [PATCH 6/6] network: adjust log messages Follow-up for #19944. --- src/network/networkd-radv.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/network/networkd-radv.c b/src/network/networkd-radv.c index 953a12b572..afb3795f2f 100644 --- a/src/network/networkd-radv.c +++ b/src/network/networkd-radv.c @@ -869,9 +869,9 @@ int link_request_radv(Link *link) { r = link_queue_request(link, REQUEST_TYPE_RADV, NULL, false, NULL, NULL, NULL); if (r < 0) - return log_link_warning_errno(link, r, "Failed to request IPv6 Router Advertisement engine: %m"); + return log_link_warning_errno(link, r, "Failed to request configuring of the IPv6 Router Advertisement engine: %m"); - log_link_debug(link, "IPv6 Router Advertisement engine is requested."); + log_link_debug(link, "Requested configuring of the IPv6 Router Advertisement engine."); return 0; }