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 <gordon@bosvangennip.nl>
This commit is contained in:
Thomas Haller 2021-05-19 09:08:54 +02:00
parent c34e36bb8d
commit aef9b95aaa
No known key found for this signature in database
GPG key ID: 29C2366E4DFC5728

View file

@ -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