summary refs log tree commit diff
path: root/src/dhcp
diff options
context:
space:
mode:
Diffstat (limited to 'src/dhcp')
-rw-r--r--src/dhcp/meson.build2
-rw-r--r--src/dhcp/nm-dhcp-client.c18
-rw-r--r--src/dhcp/nm-dhcp-dhclient-utils.c2
-rw-r--r--src/dhcp/nm-dhcp-dhclient.c2
-rw-r--r--src/dhcp/nm-dhcp-dhcpcanon.c2
-rw-r--r--src/dhcp/nm-dhcp-dhcpcd.c2
-rw-r--r--src/dhcp/nm-dhcp-listener.c4
-rw-r--r--src/dhcp/nm-dhcp-manager.c2
-rw-r--r--src/dhcp/nm-dhcp-manager.h2
-rw-r--r--src/dhcp/nm-dhcp-nettools.c58
-rw-r--r--src/dhcp/nm-dhcp-systemd.c32
-rw-r--r--src/dhcp/nm-dhcp-utils.c12
-rw-r--r--src/dhcp/tests/meson.build2
13 files changed, 74 insertions, 66 deletions
diff --git a/src/dhcp/meson.build b/src/dhcp/meson.build
index 609fe663..67f055d9 100644
--- a/src/dhcp/meson.build
+++ b/src/dhcp/meson.build
@@ -1,3 +1,5 @@
+# SPDX-License-Identifier: LGPL-2.1+
+
 name = 'nm-dhcp-helper'
 
 c_flags = [
diff --git a/src/dhcp/nm-dhcp-client.c b/src/dhcp/nm-dhcp-client.c
index 81c4ad9c..90a64aca 100644
--- a/src/dhcp/nm-dhcp-client.c
+++ b/src/dhcp/nm-dhcp-client.c
@@ -925,7 +925,7 @@ nm_dhcp_client_handle_event (gpointer unused,
 		    && !ip_config) {
 			_LOGW ("client bound but IP config not received");
 			new_state = NM_DHCP_STATE_FAIL;
-			g_clear_pointer (&str_options, g_hash_table_unref);
+			nm_clear_pointer (&str_options, g_hash_table_unref);
 		}
 
 		nm_dhcp_client_set_state (self, new_state, ip_config, str_options);
@@ -940,7 +940,7 @@ static void
 get_property (GObject *object, guint prop_id,
               GValue *value, GParamSpec *pspec)
 {
-	NMDhcpClientPrivate *priv = NM_DHCP_CLIENT_GET_PRIVATE ((NMDhcpClient *) object);
+	NMDhcpClientPrivate *priv = NM_DHCP_CLIENT_GET_PRIVATE (object);
 
 	switch (prop_id) {
 	case PROP_IFACE:
@@ -989,7 +989,7 @@ static void
 set_property (GObject *object, guint prop_id,
               const GValue *value, GParamSpec *pspec)
 {
-	NMDhcpClientPrivate *priv = NM_DHCP_CLIENT_GET_PRIVATE ((NMDhcpClient *) object);
+	NMDhcpClientPrivate *priv = NM_DHCP_CLIENT_GET_PRIVATE (object);
 	guint flags;
 
 	switch (prop_id) {
@@ -1099,12 +1099,12 @@ dispose (GObject *object)
 	watch_cleanup (self);
 	timeout_cleanup (self);
 
-	g_clear_pointer (&priv->iface, g_free);
-	g_clear_pointer (&priv->hostname, g_free);
-	g_clear_pointer (&priv->uuid, g_free);
-	g_clear_pointer (&priv->client_id, g_bytes_unref);
-	g_clear_pointer (&priv->hwaddr, g_bytes_unref);
-	g_clear_pointer (&priv->bcast_hwaddr, g_bytes_unref);
+	nm_clear_g_free (&priv->iface);
+	nm_clear_g_free (&priv->hostname);
+	nm_clear_g_free (&priv->uuid);
+	nm_clear_pointer (&priv->client_id, g_bytes_unref);
+	nm_clear_pointer (&priv->hwaddr, g_bytes_unref);
+	nm_clear_pointer (&priv->bcast_hwaddr, g_bytes_unref);
 
 	G_OBJECT_CLASS (nm_dhcp_client_parent_class)->dispose (object);
 
diff --git a/src/dhcp/nm-dhcp-dhclient-utils.c b/src/dhcp/nm-dhcp-dhclient-utils.c
index f31c493c..da28abad 100644
--- a/src/dhcp/nm-dhcp-dhclient-utils.c
+++ b/src/dhcp/nm-dhcp-dhclient-utils.c
@@ -385,7 +385,7 @@ nm_dhcp_dhclient_create_config (const char *interface,
 
 				/* Otherwise capture and return the existing client id */
 				if (out_new_client_id)
-					g_clear_pointer (out_new_client_id, g_bytes_unref);
+					nm_clear_pointer (out_new_client_id, g_bytes_unref);
 				NM_SET_OUT (out_new_client_id, read_client_id (p));
 			}
 
diff --git a/src/dhcp/nm-dhcp-dhclient.c b/src/dhcp/nm-dhcp-dhclient.c
index 869966fb..617ce236 100644
--- a/src/dhcp/nm-dhcp-dhclient.c
+++ b/src/dhcp/nm-dhcp-dhclient.c
@@ -665,7 +665,7 @@ nm_dhcp_dhclient_init (NMDhcpDhclient *self)
 static void
 dispose (GObject *object)
 {
-	NMDhcpDhclientPrivate *priv = NM_DHCP_DHCLIENT_GET_PRIVATE ((NMDhcpDhclient *) object);
+	NMDhcpDhclientPrivate *priv = NM_DHCP_DHCLIENT_GET_PRIVATE (object);
 
 	if (priv->dhcp_listener) {
 		g_signal_handlers_disconnect_by_func (priv->dhcp_listener,
diff --git a/src/dhcp/nm-dhcp-dhcpcanon.c b/src/dhcp/nm-dhcp-dhcpcanon.c
index f9cc0f0a..63484a4b 100644
--- a/src/dhcp/nm-dhcp-dhcpcanon.c
+++ b/src/dhcp/nm-dhcp-dhcpcanon.c
@@ -207,7 +207,7 @@ nm_dhcp_dhcpcanon_init (NMDhcpDhcpcanon *self)
 static void
 dispose (GObject *object)
 {
-	NMDhcpDhcpcanonPrivate *priv = NM_DHCP_DHCPCANON_GET_PRIVATE ((NMDhcpDhcpcanon *) object);
+	NMDhcpDhcpcanonPrivate *priv = NM_DHCP_DHCPCANON_GET_PRIVATE (object);
 
 	if (priv->dhcp_listener) {
 		g_signal_handlers_disconnect_by_func (priv->dhcp_listener,
diff --git a/src/dhcp/nm-dhcp-dhcpcd.c b/src/dhcp/nm-dhcp-dhcpcd.c
index 1690bce5..ff695dbe 100644
--- a/src/dhcp/nm-dhcp-dhcpcd.c
+++ b/src/dhcp/nm-dhcp-dhcpcd.c
@@ -200,7 +200,7 @@ nm_dhcp_dhcpcd_init (NMDhcpDhcpcd *self)
 static void
 dispose (GObject *object)
 {
-	NMDhcpDhcpcdPrivate *priv = NM_DHCP_DHCPCD_GET_PRIVATE ((NMDhcpDhcpcd *) object);
+	NMDhcpDhcpcdPrivate *priv = NM_DHCP_DHCPCD_GET_PRIVATE (object);
 
 	if (priv->dhcp_listener) {
 		g_signal_handlers_disconnect_by_func (priv->dhcp_listener,
diff --git a/src/dhcp/nm-dhcp-listener.c b/src/dhcp/nm-dhcp-listener.c
index a54b9643..79dea898 100644
--- a/src/dhcp/nm-dhcp-listener.c
+++ b/src/dhcp/nm-dhcp-listener.c
@@ -287,12 +287,12 @@ nm_dhcp_listener_init (NMDhcpListener *self)
 static void
 dispose (GObject *object)
 {
-	NMDhcpListenerPrivate *priv = NM_DHCP_LISTENER_GET_PRIVATE ((NMDhcpListener *) object);
+	NMDhcpListenerPrivate *priv = NM_DHCP_LISTENER_GET_PRIVATE (object);
 
 	nm_clear_g_signal_handler (priv->dbus_mgr, &priv->new_conn_id);
 	nm_clear_g_signal_handler (priv->dbus_mgr, &priv->dis_conn_id);
 
-	g_clear_pointer (&priv->connections, g_hash_table_destroy);
+	nm_clear_pointer (&priv->connections, g_hash_table_destroy);
 
 	g_clear_object (&priv->dbus_mgr);
 
diff --git a/src/dhcp/nm-dhcp-manager.c b/src/dhcp/nm-dhcp-manager.c
index 10ed9589..333744dd 100644
--- a/src/dhcp/nm-dhcp-manager.c
+++ b/src/dhcp/nm-dhcp-manager.c
@@ -515,7 +515,7 @@ nm_dhcp_manager_set_default_hostname (NMDhcpManager *manager, const char *hostna
 {
 	NMDhcpManagerPrivate *priv = NM_DHCP_MANAGER_GET_PRIVATE (manager);
 
-	g_clear_pointer (&priv->default_hostname, g_free);
+	nm_clear_g_free (&priv->default_hostname);
 
 	/* Never send 'localhost'-type names to the DHCP server */
 	if (!nm_utils_is_specific_hostname (hostname))
diff --git a/src/dhcp/nm-dhcp-manager.h b/src/dhcp/nm-dhcp-manager.h
index fb1c9834..1b793c22 100644
--- a/src/dhcp/nm-dhcp-manager.h
+++ b/src/dhcp/nm-dhcp-manager.h
@@ -9,7 +9,7 @@
 
 #include "nm-dhcp-client.h"
 #include "nm-ip4-config.h"
-#include "nm-dhcp4-config.h"
+#include "nm-dhcp-config.h"
 
 #define NM_TYPE_DHCP_MANAGER            (nm_dhcp_manager_get_type ())
 #define NM_DHCP_MANAGER(obj)            (G_TYPE_CHECK_INSTANCE_CAST ((obj), NM_TYPE_DHCP_MANAGER, NMDhcpManager))
diff --git a/src/dhcp/nm-dhcp-nettools.c b/src/dhcp/nm-dhcp-nettools.c
index 622251a3..00b416da 100644
--- a/src/dhcp/nm-dhcp-nettools.c
+++ b/src/dhcp/nm-dhcp-nettools.c
@@ -49,8 +49,7 @@ typedef struct {
 	NDhcp4Client *client;
 	NDhcp4ClientProbe *probe;
 	NDhcp4ClientLease *lease;
-	GIOChannel *channel;
-	guint event_id;
+	GSource *event_source;
 	char *lease_file;
 } NMDhcpNettoolsPrivate;
 
@@ -376,8 +375,8 @@ lease_parse_address (NDhcp4ClientLease *lease,
 		 * Here we still do it... it seems safe enough. */
 		nm_assert (nettools_basetime > 0);
 		nm_assert (nettools_lifetime >= nettools_basetime);
-		nm_assert (((nettools_lifetime - nettools_basetime) % NM_UTILS_NS_PER_SECOND) == 0);
-		nm_assert ((nettools_lifetime - nettools_basetime) / NM_UTILS_NS_PER_SECOND <= G_MAXUINT32);
+		nm_assert (((nettools_lifetime - nettools_basetime) % NM_UTILS_NSEC_PER_SEC) == 0);
+		nm_assert ((nettools_lifetime - nettools_basetime) / NM_UTILS_NSEC_PER_SEC <= G_MAXUINT32);
 
 		if (nettools_lifetime <= nettools_basetime) {
 			/* A lease time of 0 is allowed on some dhcp servers, so, let's accept it. */
@@ -387,7 +386,7 @@ lease_parse_address (NDhcp4ClientLease *lease,
 
 			/* we "ceil" the value to the next second. In practice, we don't expect any sub-second values
 			 * from n-dhcp4 anyway, so this should have no effect. */
-			lifetime += NM_UTILS_NS_PER_SECOND - 1;
+			lifetime += NM_UTILS_NSEC_PER_SEC - 1;
 		}
 
 		ts = nm_utils_monotonic_timestamp_from_boottime (nettools_basetime, 1);
@@ -395,11 +394,11 @@ lease_parse_address (NDhcp4ClientLease *lease,
 		/* the timestamp must be positive, because we only started nettools DHCP client
 		 * after obtaining the first monotonic timestamp. Hence, the lease must have been
 		 * received afterwards. */
-		nm_assert (ts >= NM_UTILS_NS_PER_SECOND);
+		nm_assert (ts >= NM_UTILS_NSEC_PER_SEC);
 
-		a_timestamp = ts / NM_UTILS_NS_PER_SECOND;
-		a_lifetime = NM_MIN (lifetime / NM_UTILS_NS_PER_SECOND, NM_PLATFORM_LIFETIME_PERMANENT - 1);
-		a_expiry = time (NULL) + ((lifetime - (nm_utils_clock_gettime_ns (CLOCK_BOOTTIME) - nettools_basetime)) / NM_UTILS_NS_PER_SECOND);
+		a_timestamp = ts / NM_UTILS_NSEC_PER_SEC;
+		a_lifetime = NM_MIN (lifetime / NM_UTILS_NSEC_PER_SEC, NM_PLATFORM_LIFETIME_PERMANENT - 1);
+		a_expiry = time (NULL) + ((lifetime - (nm_utils_clock_gettime_nsec (CLOCK_BOOTTIME) - nettools_basetime)) / NM_UTILS_NSEC_PER_SEC);
 	}
 
 	if (!lease_get_in_addr (lease, NM_DHCP_OPTION_DHCP4_SUBNET_MASK, &a_netmask)) {
@@ -407,7 +406,7 @@ lease_parse_address (NDhcp4ClientLease *lease,
 		return FALSE;
 	}
 
-	nm_utils_inet4_ntop (a_address.s_addr, addr_str);
+	_nm_utils_inet4_ntop (a_address.s_addr, addr_str);
 	a_plen = nm_utils_ip4_netmask_to_prefix (a_netmask.s_addr);
 
 	nm_dhcp_option_add_option (options,
@@ -417,7 +416,7 @@ lease_parse_address (NDhcp4ClientLease *lease,
 	nm_dhcp_option_add_option (options,
 	                           _nm_dhcp_option_dhcp4_options,
 	                           NM_DHCP_OPTION_DHCP4_SUBNET_MASK,
-	                           nm_utils_inet4_ntop (a_netmask.s_addr, addr_str));
+	                           _nm_utils_inet4_ntop (a_netmask.s_addr, addr_str));
 
 	nm_dhcp_option_add_option_u64 (options,
 	                               _nm_dhcp_option_dhcp4_options,
@@ -434,7 +433,7 @@ lease_parse_address (NDhcp4ClientLease *lease,
 
 	n_dhcp4_client_lease_get_siaddr (lease, &a_next_server);
 	if (a_next_server.s_addr != INADDR_ANY) {
-		nm_utils_inet4_ntop (a_next_server.s_addr, addr_str);
+		_nm_utils_inet4_ntop (a_next_server.s_addr, addr_str);
 		nm_dhcp_option_add_option (options,
 		                           _nm_dhcp_option_dhcp4_options,
 		                           NM_DHCP_OPTION_DHCP4_NM_NEXT_SERVER,
@@ -475,7 +474,7 @@ lease_parse_domain_name_servers (NDhcp4ClientLease *lease,
 
 	while (lease_option_next_in_addr (&addr, &data, &n_data)) {
 
-		nm_utils_inet4_ntop (addr.s_addr, addr_str);
+		_nm_utils_inet4_ntop (addr.s_addr, addr_str);
 		g_string_append (nm_gstring_add_space_delimiter (str), addr_str);
 
 		if (   addr.s_addr == 0
@@ -521,8 +520,8 @@ lease_parse_routes (NDhcp4ClientLease *lease,
 
 		while (lease_option_next_route (&dest, &plen, &gateway, TRUE, &data, &n_data)) {
 
-			nm_utils_inet4_ntop (dest.s_addr, dest_str);
-			nm_utils_inet4_ntop (gateway.s_addr, gateway_str);
+			_nm_utils_inet4_ntop (dest.s_addr, dest_str);
+			_nm_utils_inet4_ntop (gateway.s_addr, gateway_str);
 
 			g_string_append_printf (nm_gstring_add_space_delimiter (str),
 			                        "%s/%d %s",
@@ -565,8 +564,8 @@ lease_parse_routes (NDhcp4ClientLease *lease,
 
 		while (lease_option_next_route (&dest, &plen, &gateway, FALSE, &data, &n_data)) {
 
-			nm_utils_inet4_ntop (dest.s_addr, dest_str);
-			nm_utils_inet4_ntop (gateway.s_addr, gateway_str);
+			_nm_utils_inet4_ntop (dest.s_addr, dest_str);
+			_nm_utils_inet4_ntop (gateway.s_addr, gateway_str);
 
 			g_string_append_printf (nm_gstring_add_space_delimiter (str),
 			                        "%s/%d %s",
@@ -611,7 +610,7 @@ lease_parse_routes (NDhcp4ClientLease *lease,
 		nm_gstring_prepare (&str);
 
 		while (lease_option_next_in_addr (&gateway, &data, &n_data)) {
-			s = nm_utils_inet4_ntop (gateway.s_addr, gateway_str);
+			s = _nm_utils_inet4_ntop (gateway.s_addr, gateway_str);
 			g_string_append (nm_gstring_add_space_delimiter (str), s);
 
 			if (gateway.s_addr == 0) {
@@ -710,7 +709,7 @@ lease_parse_ntps (NDhcp4ClientLease *lease,
 	nm_gstring_prepare (&str);
 
 	while (lease_option_next_in_addr (&addr, &data, &n_data)) {
-		nm_utils_inet4_ntop (addr.s_addr, addr_str);
+		_nm_utils_inet4_ntop (addr.s_addr, addr_str);
 		g_string_append (nm_gstring_add_space_delimiter (str), addr_str);
 	}
 
@@ -967,7 +966,7 @@ lease_save (NMDhcpNettools *self, NDhcp4ClientLease *lease, const char *lease_fi
 		return;
 
 	g_string_append_printf (new_contents,
-	                        "ADDRESS=%s\n", nm_utils_inet4_ntop (a_address.s_addr, sbuf));
+	                        "ADDRESS=%s\n", _nm_utils_inet4_ntop (a_address.s_addr, sbuf));
 
 	if (!g_file_set_contents (lease_file,
 	                          new_contents->str,
@@ -1054,7 +1053,7 @@ dhcp4_event_handle (NMDhcpNettools *self,
 }
 
 static gboolean
-dhcp4_event_cb (GIOChannel *source,
+dhcp4_event_cb (int fd,
                 GIOCondition condition,
                 gpointer data)
 {
@@ -1073,7 +1072,7 @@ dhcp4_event_cb (GIOChannel *source,
 		 * a predefined number of times (possibly infinite).
 		 */
 		_LOGE ("error %d dispatching events", r);
-		priv->event_id = 0;
+		nm_clear_g_source_inst (&priv->event_source);
 		nm_dhcp_client_set_state (NM_DHCP_CLIENT (self), NM_DHCP_STATE_FAIL, NULL, NULL);
 		return G_SOURCE_REMOVE;
 	}
@@ -1199,8 +1198,14 @@ nettools_create (NMDhcpNettools *self,
 	client = NULL;
 
 	n_dhcp4_client_get_fd (priv->client, &fd);
-	priv->channel = g_io_channel_unix_new (fd);
-	priv->event_id = g_io_add_watch (priv->channel, G_IO_IN, dhcp4_event_cb, self);
+
+	priv->event_source = nm_g_unix_fd_source_new (fd,
+	                                              G_IO_IN,
+	                                              G_PRIORITY_DEFAULT,
+	                                              dhcp4_event_cb,
+	                                              self,
+	                                              NULL);
+	g_source_attach (priv->event_source, NULL);
 
 	return TRUE;
 }
@@ -1427,11 +1432,10 @@ nm_dhcp_nettools_init (NMDhcpNettools *self)
 static void
 dispose (GObject *object)
 {
-	NMDhcpNettoolsPrivate *priv = NM_DHCP_NETTOOLS_GET_PRIVATE ((NMDhcpNettools *) object);
+	NMDhcpNettoolsPrivate *priv = NM_DHCP_NETTOOLS_GET_PRIVATE (object);
 
 	nm_clear_pointer (&priv->lease_file, g_free);
-	nm_clear_pointer (&priv->channel, g_io_channel_unref);
-	nm_clear_g_source (&priv->event_id);
+	nm_clear_g_source_inst (&priv->event_source);
 	nm_clear_pointer (&priv->lease, n_dhcp4_client_lease_unref);
 	nm_clear_pointer (&priv->probe, n_dhcp4_client_probe_free);
 	nm_clear_pointer (&priv->client, n_dhcp4_client_unref);
diff --git a/src/dhcp/nm-dhcp-systemd.c b/src/dhcp/nm-dhcp-systemd.c
index 6e6aa243..23862e9e 100644
--- a/src/dhcp/nm-dhcp-systemd.c
+++ b/src/dhcp/nm-dhcp-systemd.c
@@ -93,7 +93,7 @@ lease_to_ip4_config (NMDedupMultiIndex *multi_idx,
 	gboolean has_router_from_classless = FALSE;
 	gboolean has_classless_route = FALSE;
 	gboolean has_static_route = FALSE;
-	const gint32 ts = nm_utils_get_monotonic_timestamp_s ();
+	const gint32 ts = nm_utils_get_monotonic_timestamp_sec ();
 	gint64 ts_time = time (NULL);
 	struct in_addr a_address;
 	struct in_addr a_netmask;
@@ -128,7 +128,7 @@ lease_to_ip4_config (NMDedupMultiIndex *multi_idx,
 
 	options = out_options ? nm_dhcp_option_create_options_dict () : NULL;
 
-	nm_utils_inet4_ntop (a_address.s_addr, addr_str);
+	_nm_utils_inet4_ntop (a_address.s_addr, addr_str);
 	nm_dhcp_option_add_option (options,
 	                           _nm_dhcp_option_dhcp4_options,
 	                           NM_DHCP_OPTION_DHCP4_NM_IP_ADDRESS,
@@ -138,7 +138,7 @@ lease_to_ip4_config (NMDedupMultiIndex *multi_idx,
 	nm_dhcp_option_add_option (options,
 	                           _nm_dhcp_option_dhcp4_options,
 	                           NM_DHCP_OPTION_DHCP4_SUBNET_MASK,
-	                           nm_utils_inet4_ntop (a_netmask.s_addr, addr_str));
+	                           _nm_utils_inet4_ntop (a_netmask.s_addr, addr_str));
 
 	nm_dhcp_option_add_option_u64 (options,
 	                               _nm_dhcp_option_dhcp4_options,
@@ -150,7 +150,7 @@ lease_to_ip4_config (NMDedupMultiIndex *multi_idx,
 	                               (guint64) (ts_time + a_lifetime));
 
 	if (sd_dhcp_lease_get_next_server (lease, &a_next_server) == 0) {
-		nm_utils_inet4_ntop (a_next_server.s_addr, addr_str);
+		_nm_utils_inet4_ntop (a_next_server.s_addr, addr_str);
 		nm_dhcp_option_add_option (options,
 		                           _nm_dhcp_option_dhcp4_options,
 		                           NM_DHCP_OPTION_DHCP4_NM_NEXT_SERVER,
@@ -169,7 +169,7 @@ lease_to_ip4_config (NMDedupMultiIndex *multi_idx,
 	                           }));
 
 	if (sd_dhcp_lease_get_server_identifier (lease, &server_id) >= 0) {
-		nm_utils_inet4_ntop (server_id.s_addr, addr_str);
+		_nm_utils_inet4_ntop (server_id.s_addr, addr_str);
 		nm_dhcp_option_add_option (options,
 		                           _nm_dhcp_option_dhcp4_options,
 		                           NM_DHCP_OPTION_DHCP4_SERVER_ID,
@@ -177,7 +177,7 @@ lease_to_ip4_config (NMDedupMultiIndex *multi_idx,
 	}
 
 	if (sd_dhcp_lease_get_broadcast (lease, &broadcast) >= 0) {
-		nm_utils_inet4_ntop (broadcast.s_addr, addr_str);
+		_nm_utils_inet4_ntop (broadcast.s_addr, addr_str);
 		nm_dhcp_option_add_option (options,
 		                           _nm_dhcp_option_dhcp4_options,
 		                           NM_DHCP_OPTION_DHCP4_BROADCAST,
@@ -188,7 +188,7 @@ lease_to_ip4_config (NMDedupMultiIndex *multi_idx,
 	if (num > 0) {
 		nm_gstring_prepare (&str);
 		for (i = 0; i < num; i++) {
-			nm_utils_inet4_ntop (addr_list[i].s_addr, addr_str);
+			_nm_utils_inet4_ntop (addr_list[i].s_addr, addr_str);
 			g_string_append (nm_gstring_add_space_delimiter (str), addr_str);
 
 			if (   addr_list[i].s_addr == 0
@@ -288,8 +288,8 @@ lease_to_ip4_config (NMDedupMultiIndex *multi_idx,
 
 			network_net = nm_utils_ip4_address_clear_host_address (r_network.s_addr,
 			                                                       r_plen);
-			nm_utils_inet4_ntop (network_net, network_net_str);
-			nm_utils_inet4_ntop (r_gateway.s_addr, gateway_str);
+			_nm_utils_inet4_ntop (network_net, network_net_str);
+			_nm_utils_inet4_ntop (r_gateway.s_addr, gateway_str);
 
 			g_string_append_printf (nm_gstring_add_space_delimiter (  option == NM_DHCP_OPTION_DHCP4_CLASSLESS_STATIC_ROUTE
 			                                                        ? str_classless
@@ -359,7 +359,7 @@ lease_to_ip4_config (NMDedupMultiIndex *multi_idx,
 		for (i = 0; i < num; i++) {
 			guint32 m;
 
-			s = nm_utils_inet4_ntop (a_router[i].s_addr, addr_str);
+			s = _nm_utils_inet4_ntop (a_router[i].s_addr, addr_str);
 			g_string_append (nm_gstring_add_space_delimiter (str), s);
 
 			if (a_router[i].s_addr == 0) {
@@ -411,7 +411,7 @@ lease_to_ip4_config (NMDedupMultiIndex *multi_idx,
 	if (num > 0) {
 		nm_gstring_prepare (&str);
 		for (i = 0; i < num; i++) {
-			nm_utils_inet4_ntop (addr_list[i].s_addr, addr_str);
+			_nm_utils_inet4_ntop (addr_list[i].s_addr, addr_str);
 			g_string_append (nm_gstring_add_space_delimiter (str), addr_str);
 		}
 		nm_dhcp_option_add_option (options,
@@ -752,7 +752,7 @@ lease_to_ip6_config (NMDedupMultiIndex *multi_idx,
 
 		nm_ip6_config_add_address (ip6_config, &address);
 
-		nm_utils_inet6_ntop (&tmp_addr, addr_str);
+		_nm_utils_inet6_ntop (&tmp_addr, addr_str);
 		g_string_append (nm_gstring_add_space_delimiter (str), addr_str);
 	};
 	if (str->len)
@@ -774,7 +774,7 @@ lease_to_ip6_config (NMDedupMultiIndex *multi_idx,
 	if (num > 0) {
 		nm_gstring_prepare (&str);
 		for (i = 0; i < num; i++) {
-			nm_utils_inet6_ntop (&dns[i], addr_str);
+			_nm_utils_inet6_ntop (&dns[i], addr_str);
 			g_string_append (nm_gstring_add_space_delimiter (str), addr_str);
 			nm_ip6_config_add_nameserver (ip6_config, &dns[i]);
 		}
@@ -805,7 +805,7 @@ static void
 bound6_handle (NMDhcpSystemd *self)
 {
 	NMDhcpSystemdPrivate *priv = NM_DHCP_SYSTEMD_GET_PRIVATE (self);
-	const gint32 ts = nm_utils_get_monotonic_timestamp_s ();
+	const gint32 ts = nm_utils_get_monotonic_timestamp_sec ();
 	const char *iface = nm_dhcp_client_get_iface (NM_DHCP_CLIENT (self));
 	gs_unref_object NMIP6Config *ip6_config = NULL;
 	gs_unref_hashtable GHashTable *options = NULL;
@@ -1056,9 +1056,9 @@ nm_dhcp_systemd_init (NMDhcpSystemd *self)
 static void
 dispose (GObject *object)
 {
-	NMDhcpSystemdPrivate *priv = NM_DHCP_SYSTEMD_GET_PRIVATE ((NMDhcpSystemd *) object);
+	NMDhcpSystemdPrivate *priv = NM_DHCP_SYSTEMD_GET_PRIVATE (object);
 
-	g_clear_pointer (&priv->lease_file, g_free);
+	nm_clear_g_free (&priv->lease_file);
 
 	if (priv->client4) {
 		sd_dhcp_client_stop (priv->client4);
diff --git a/src/dhcp/nm-dhcp-utils.c b/src/dhcp/nm-dhcp-utils.c
index c5da3e02..d8e5a653 100644
--- a/src/dhcp/nm-dhcp-utils.c
+++ b/src/dhcp/nm-dhcp-utils.c
@@ -181,9 +181,9 @@ ip4_process_dhclient_rfc3442_routes (const char *iface,
 			nm_ip4_config_add_route (ip4_config, &route, NULL);
 
 			_LOG2I (LOGD_DHCP4, iface, "  classless static route %s/%d gw %s",
-			        nm_utils_inet4_ntop (route.network, b1),
+			        _nm_utils_inet4_ntop (route.network, b1),
 			        route.plen,
-			        nm_utils_inet4_ntop (route.gateway, b2));
+			        _nm_utils_inet4_ntop (route.gateway, b2));
 		}
 	}
 
@@ -388,7 +388,7 @@ nm_dhcp_utils_ip4_config_from_options (NMDedupMultiIndex *multi_idx,
 
 	ip4_config = nm_ip4_config_new (multi_idx, ifindex);
 	memset (&address, 0, sizeof (address));
-	address.timestamp = nm_utils_get_monotonic_timestamp_s ();
+	address.timestamp = nm_utils_get_monotonic_timestamp_sec ();
 
 	str = g_hash_table_lookup (options, "ip_address");
 	if (str && (inet_pton (AF_INET, str, &addr) > 0))
@@ -414,7 +414,7 @@ nm_dhcp_utils_ip4_config_from_options (NMDedupMultiIndex *multi_idx,
 		process_classful_routes (iface, options, route_table, route_metric, ip4_config);
 
 	if (gateway) {
-		_LOG2I (LOGD_DHCP4, iface, "  gateway %s", nm_utils_inet4_ntop (gateway, sbuf));
+		_LOG2I (LOGD_DHCP4, iface, "  gateway %s", _nm_utils_inet4_ntop (gateway, sbuf));
 		gateway_has = TRUE;
 	} else {
 		/* If the gateway wasn't provided as a classless static route with a
@@ -601,7 +601,7 @@ nm_dhcp_utils_ip6_prefix_from_options (GHashTable *options)
 	address.address = tmp_addr;
 	address.addr_source = NM_IP_CONFIG_SOURCE_DHCP;
 	address.plen = prefix;
-	address.timestamp = nm_utils_get_monotonic_timestamp_s ();
+	address.timestamp = nm_utils_get_monotonic_timestamp_sec ();
 
 	str = g_hash_table_lookup (options, "max_life");
 	if (str)
@@ -630,7 +630,7 @@ nm_dhcp_utils_ip6_config_from_options (NMDedupMultiIndex *multi_idx,
 
 	memset (&address, 0, sizeof (address));
 	address.plen = 128;
-	address.timestamp = nm_utils_get_monotonic_timestamp_s ();
+	address.timestamp = nm_utils_get_monotonic_timestamp_sec ();
 
 	ip6_config = nm_ip6_config_new (multi_idx, ifindex);
 
diff --git a/src/dhcp/tests/meson.build b/src/dhcp/tests/meson.build
index 031e2efd..59a647cc 100644
--- a/src/dhcp/tests/meson.build
+++ b/src/dhcp/tests/meson.build
@@ -1,3 +1,5 @@
+# SPDX-License-Identifier: LGPL-2.1+
+
 test_units = [
   'test-dhcp-dhclient',
   'test-dhcp-utils',