From 28d7f9b7c4787db101e30a549c6b05aad2ce89c3 Mon Sep 17 00:00:00 2001 From: Thomas Haller Date: Mon, 12 Dec 2022 19:20:19 +0100 Subject: [PATCH] dhcp: drop NMDhcpClientClass.get_duid() hook Note that there are no callers of nm_dhcp_client_get_effective_client_id(), hence calling the setter had no effect. This is a bug, that we will fix later. But before fixing the bug, change how this works. Drop the get_duid() hook. It's only confusing and backward. We will keep the nm_dhcp_client_[gs]et_effective_client_id() functions. They will be used later. --- src/core/dhcp/nm-dhcp-client.c | 14 +------------- src/core/dhcp/nm-dhcp-client.h | 11 ----------- src/core/dhcp/nm-dhcp-dhclient.c | 3 +-- 3 files changed, 2 insertions(+), 26 deletions(-) diff --git a/src/core/dhcp/nm-dhcp-client.c b/src/core/dhcp/nm-dhcp-client.c index 72ad661aa..3674198a2 100644 --- a/src/core/dhcp/nm-dhcp-client.c +++ b/src/core/dhcp/nm-dhcp-client.c @@ -967,12 +967,6 @@ _dhcp_client_decline(NMDhcpClient *self, return klass->decline(self, l3cd, error_message, error); } -static GBytes * -get_duid(NMDhcpClient *self) -{ - return NULL; -} - static gboolean ipv6_lladdr_timeout(gpointer user_data) { @@ -1318,11 +1312,6 @@ nm_dhcp_client_start(NMDhcpClient *self, GError **error) IS_IPv4 = NM_IS_IPv4(priv->config.addr_family); if (!IS_IPv4) { - if (!priv->config.v6.enforce_duid) - own_client_id = NM_DHCP_CLIENT_GET_CLASS(self)->get_duid(self); - - nm_dhcp_client_set_effective_client_id(self, own_client_id ?: priv->config.client_id); - addr = ipv6_lladdr_find(self); if (!addr) { _LOGD("waiting for IPv6LL address"); @@ -1915,8 +1904,7 @@ nm_dhcp_client_class_init(NMDhcpClientClass *client_class) client_class->accept = _accept; client_class->decline = decline; - client_class->stop = stop; - client_class->get_duid = get_duid; + client_class->stop = stop; obj_properties[PROP_CONFIG] = g_param_spec_pointer(NM_DHCP_CLIENT_CONFIG, diff --git a/src/core/dhcp/nm-dhcp-client.h b/src/core/dhcp/nm-dhcp-client.h index cb8cbb565..26fca4a95 100644 --- a/src/core/dhcp/nm-dhcp-client.h +++ b/src/core/dhcp/nm-dhcp-client.h @@ -215,17 +215,6 @@ typedef struct { gboolean (*ip6_start)(NMDhcpClient *self, const struct in6_addr *ll_addr, GError **error); void (*stop)(NMDhcpClient *self, gboolean release); - - /** - * get_duid: - * @self: the #NMDhcpClient - * - * 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); } NMDhcpClientClass; GType nm_dhcp_client_get_type(void); diff --git a/src/core/dhcp/nm-dhcp-dhclient.c b/src/core/dhcp/nm-dhcp-dhclient.c index bed3c8662..92b4332a7 100644 --- a/src/core/dhcp/nm-dhcp-dhclient.c +++ b/src/core/dhcp/nm-dhcp-dhclient.c @@ -627,7 +627,7 @@ stop(NMDhcpClient *client, gboolean release) } } -static GBytes * +_nm_unused static GBytes * get_duid(NMDhcpClient *client) { NMDhcpDhclient *self = NM_DHCP_DHCLIENT(client); @@ -724,7 +724,6 @@ nm_dhcp_dhclient_class_init(NMDhcpDhclientClass *dhclient_class) client_class->ip4_start = ip4_start; client_class->ip6_start = ip6_start; client_class->stop = stop; - client_class->get_duid = get_duid; } const NMDhcpClientFactory _nm_dhcp_client_factory_dhclient = {