diff --git a/src/devices/nm-device.c b/src/devices/nm-device.c index 9df4141016..24d8b3d415 100644 --- a/src/devices/nm-device.c +++ b/src/devices/nm-device.c @@ -7828,7 +7828,7 @@ generate_duid_from_machine_id (void) } static GBytes * -dhcp6_get_duid (NMDevice *self, NMConnection *connection, GBytes *hwaddr, NMDhcpDuidEnforce *out_enforce) +dhcp6_get_duid (NMDevice *self, NMConnection *connection, GBytes *hwaddr, gboolean *out_enforce) { NMSettingIPConfig *s_ip6; const char *duid; @@ -7837,7 +7837,7 @@ dhcp6_get_duid (NMDevice *self, NMConnection *connection, GBytes *hwaddr, NMDhcp GBytes *duid_out; guint8 sha256_digest[32]; gsize len = sizeof (sha256_digest); - NMDhcpDuidEnforce duid_enforce = NM_DHCP_DUID_ENFORCE_ALWAYS; + gboolean duid_enforce = TRUE; gs_free char *logstr1 = NULL; s_ip6 = nm_connection_get_setting_ip6_config (connection); @@ -7852,7 +7852,7 @@ dhcp6_get_duid (NMDevice *self, NMConnection *connection, GBytes *hwaddr, NMDhcp } if (nm_streq (duid, "lease")) { - duid_enforce = NM_DHCP_DUID_ENFORCE_NEVER; + duid_enforce = FALSE; duid_out = generate_duid_from_machine_id (); if (!duid_out) { duid_error = "failure to read machine-id"; @@ -7972,7 +7972,7 @@ out_good: "ipv6.dhcp-duid: generate %s DUID '%s' (%s)", duid, (logstr1 = nm_dhcp_utils_duid_to_string (duid_out)), - (duid_enforce == NM_DHCP_DUID_ENFORCE_ALWAYS) ? "enforcing" : "fallback"); + duid_enforce ? "enforcing" : "prefer lease"); NM_SET_OUT (out_enforce, duid_enforce); return duid_out; @@ -7985,7 +7985,7 @@ dhcp6_start_with_link_ready (NMDevice *self, NMConnection *connection) NMSettingIPConfig *s_ip6; gs_unref_bytes GBytes *hwaddr = NULL; gs_unref_bytes GBytes *duid = NULL; - NMDhcpDuidEnforce enforce_duid = NM_DHCP_DUID_ENFORCE_NEVER; + gboolean enforce_duid = FALSE; const NMPlatformIP6Address *ll_addr = NULL; diff --git a/src/dhcp/nm-dhcp-client.c b/src/dhcp/nm-dhcp-client.c index 390b7054ec..360bd36767 100644 --- a/src/dhcp/nm-dhcp-client.c +++ b/src/dhcp/nm-dhcp-client.c @@ -513,7 +513,7 @@ nm_dhcp_client_start_ip4 (NMDhcpClient *self, } static GBytes * -get_duid (NMDhcpClient *self, gboolean global) +get_duid (NMDhcpClient *self) { return NULL; } @@ -521,7 +521,7 @@ get_duid (NMDhcpClient *self, gboolean global) gboolean nm_dhcp_client_start_ip6 (NMDhcpClient *self, GBytes *client_id, - NMDhcpDuidEnforce enforce_duid, + gboolean enforce_duid, const char *dhcp_anycast_addr, const struct in6_addr *ll_addr, const char *hostname, @@ -541,12 +541,9 @@ nm_dhcp_client_start_ip6 (NMDhcpClient *self, nm_assert (!priv->duid); nm_assert (client_id); - if (enforce_duid == NM_DHCP_DUID_ENFORCE_NEVER) - priv->duid = NM_DHCP_CLIENT_GET_CLASS (self)->get_duid (self, TRUE); - else if (enforce_duid == NM_DHCP_DUID_ENFORCE_LEASE_FALLBACK) - priv->duid = NM_DHCP_CLIENT_GET_CLASS (self)->get_duid (self, FALSE); + if (!enforce_duid) + priv->duid = NM_DHCP_CLIENT_GET_CLASS (self)->get_duid (self); - /* NM_DHCP_DUID_ENFORCE_ALWAYS and fallback */ if (!priv->duid) priv->duid = g_bytes_ref (client_id); diff --git a/src/dhcp/nm-dhcp-client.h b/src/dhcp/nm-dhcp-client.h index 98c3ed262e..f3d0b7d184 100644 --- a/src/dhcp/nm-dhcp-client.h +++ b/src/dhcp/nm-dhcp-client.h @@ -96,15 +96,13 @@ typedef struct { /** * get_duid: * @self: the #NMDhcpClient - * @global: if set to #true, the duid should be searched also in the - * DHCP client's system-wide persistent configuration. * * Attempts to find an existing DHCPv6 DUID for this client in the DHCP * client's persistent configuration. Returned DUID should be the binary * representation of the DUID. If no DUID is found, %NULL should be * returned. */ - GBytes *(*get_duid) (NMDhcpClient *self, gboolean global); + GBytes *(*get_duid) (NMDhcpClient *self); /* Signals */ void (*state_changed) (NMDhcpClient *self, @@ -153,7 +151,7 @@ gboolean nm_dhcp_client_start_ip4 (NMDhcpClient *self, gboolean nm_dhcp_client_start_ip6 (NMDhcpClient *self, GBytes *client_id, - NMDhcpDuidEnforce enforce_duid, + gboolean enforce_duid, const char *dhcp_anycast_addr, const struct in6_addr *ll_addr, const char *hostname, diff --git a/src/dhcp/nm-dhcp-dhclient.c b/src/dhcp/nm-dhcp-dhclient.c index 43746dd394..3bd14ebe89 100644 --- a/src/dhcp/nm-dhcp-dhclient.c +++ b/src/dhcp/nm-dhcp-dhclient.c @@ -582,7 +582,7 @@ state_changed (NMDhcpClient *client, } static GBytes * -get_duid (NMDhcpClient *client, gboolean global) +get_duid (NMDhcpClient *client) { NMDhcpDhclient *self = NM_DHCP_DHCLIENT (client); NMDhcpDhclientPrivate *priv = NM_DHCP_DHCLIENT_GET_PRIVATE (self); @@ -607,7 +607,7 @@ get_duid (NMDhcpClient *client, gboolean global) g_free (leasefile); } - if (!duid && global) { + if (!duid) { /* Otherwise read the default machine-wide DUID */ _LOGD ("looking for default DUID in '%s'", priv->def_leasefile); duid = nm_dhcp_dhclient_read_duid (priv->def_leasefile, &error); diff --git a/src/dhcp/nm-dhcp-manager.c b/src/dhcp/nm-dhcp-manager.c index 2d85c73ac7..672543237e 100644 --- a/src/dhcp/nm-dhcp-manager.c +++ b/src/dhcp/nm-dhcp-manager.c @@ -164,7 +164,7 @@ client_start (NMDhcpManager *self, guint32 route_metric, const struct in6_addr *ipv6_ll_addr, GBytes *dhcp_client_id, - NMDhcpDuidEnforce enforce_duid, + gboolean enforce_duid, guint32 timeout, const char *dhcp_anycast_addr, const char *hostname, @@ -299,7 +299,7 @@ nm_dhcp_manager_start_ip6 (NMDhcpManager *self, gboolean send_hostname, const char *dhcp_hostname, GBytes *duid, - NMDhcpDuidEnforce enforce_duid, + gboolean enforce_duid, guint32 timeout, const char *dhcp_anycast_addr, gboolean info_only, diff --git a/src/dhcp/nm-dhcp-manager.h b/src/dhcp/nm-dhcp-manager.h index ed8ee742a9..7eb32c37da 100644 --- a/src/dhcp/nm-dhcp-manager.h +++ b/src/dhcp/nm-dhcp-manager.h @@ -73,7 +73,7 @@ NMDhcpClient * nm_dhcp_manager_start_ip6 (NMDhcpManager *manager, gboolean send_hostname, const char *dhcp_hostname, GBytes *duid, - NMDhcpDuidEnforce enforce_duid, + gboolean enforce_duid, guint32 timeout, const char *dhcp_anycast_addr, gboolean info_only, diff --git a/src/dhcp/nm-dhcp-utils.h b/src/dhcp/nm-dhcp-utils.h index afb87c1a14..5c127bd194 100644 --- a/src/dhcp/nm-dhcp-utils.h +++ b/src/dhcp/nm-dhcp-utils.h @@ -24,12 +24,6 @@ #include "nm-ip4-config.h" #include "nm-ip6-config.h" -typedef enum { - NM_DHCP_DUID_ENFORCE_NEVER = 0, - NM_DHCP_DUID_ENFORCE_LEASE_FALLBACK, - NM_DHCP_DUID_ENFORCE_ALWAYS, -} NMDhcpDuidEnforce; - NMIP4Config *nm_dhcp_utils_ip4_config_from_options (struct _NMDedupMultiIndex *multi_idx, int ifindex, const char *iface,