From 24c50803a7c6eeabec398b2843dca940e30c2d01 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=8D=C3=B1igo=20Huguet?= Date: Sat, 28 Mar 2026 12:06:07 +0100 Subject: [PATCH] dhcp: improve log message for unknown DHCP plugin If a DHCP plugin is unknown, the logs says "DHCP client 'x' not available". This is the same message that is shown if, for example, it is a valid DHCP plugin name, but the program is not installed in the system. For example, after 'dhclient' was deprecated, now NM is built without support for it. Then, people with old configs `dhcp=dhclient` get the message "DHCP client 'dhclient' not available". That seems to mean that dhclient is not installed. Show a message "unknown DHCP client" instead. Fixes https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/work_items/1917 --- src/core/dhcp/nm-dhcp-manager.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/core/dhcp/nm-dhcp-manager.c b/src/core/dhcp/nm-dhcp-manager.c index 68bb327b52..6c42a0fa3f 100644 --- a/src/core/dhcp/nm-dhcp-manager.c +++ b/src/core/dhcp/nm-dhcp-manager.c @@ -289,8 +289,10 @@ nm_dhcp_manager_init(NMDhcpManager *self) NM_CONFIG_GET_VALUE_STRIP | NM_CONFIG_GET_VALUE_NO_EMPTY); client = client_free; if (client) { - client_factory = _client_factory_available(_client_factory_find_by_name(client)); + client_factory = _client_factory_find_by_name(client); if (!client_factory) + _LOGW(AF_UNSPEC, "init: unknown DHCP client '%s', ignoring", client); + else if (!(client_factory = _client_factory_available(client_factory))) _LOGW(AF_UNSPEC, "init: DHCP client '%s' not available", client); } if (!client_factory) {