From aef9b95aaaec92937bae38b819d416c7042940d2 Mon Sep 17 00:00:00 2001 From: Thomas Haller Date: Wed, 19 May 2021 09:08:54 +0200 Subject: [PATCH] dhcp: map "static" DHCP state for dhcpcd to bound A user might configure /etc/dhcpcd.conf to contain static fallback addresses. In that case, the dhcpcd plugin reports the state as "static". Let's treat that the same way as bound. Note that this is not an officially supported or endorsed way of configuring fallback addresses in NetworkManager. Rather, when using DHCP plugins, the user can hack the system and make unsupported modifications in /etc/dhcpcd.conf or /etc/dhcp. This change only makes it a bit easier to do it. See-also: https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/issues/579#note_922758 https://bugzilla.gnome.org/show_bug.cgi?id=768362 Based-on-patch-by: gordonb3 --- src/core/dhcp/nm-dhcp-client.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/core/dhcp/nm-dhcp-client.c b/src/core/dhcp/nm-dhcp-client.c index 5d85500d8d..33a8173c45 100644 --- a/src/core/dhcp/nm-dhcp-client.c +++ b/src/core/dhcp/nm-dhcp-client.c @@ -363,7 +363,8 @@ state_to_string(NMDhcpState state) static NMDhcpState reason_to_state(NMDhcpClient *self, const char *iface, const char *reason) { - if (g_ascii_strcasecmp(reason, "bound") == 0 || g_ascii_strcasecmp(reason, "bound6") == 0) + if (g_ascii_strcasecmp(reason, "bound") == 0 || g_ascii_strcasecmp(reason, "bound6") == 0 + || g_ascii_strcasecmp(reason, "static") == 0) return NM_DHCP_STATE_BOUND; else if (g_ascii_strcasecmp(reason, "renew") == 0 || g_ascii_strcasecmp(reason, "renew6") == 0 || g_ascii_strcasecmp(reason, "reboot") == 0