summary refs log tree commit diff
path: root/src/dhcp-manager
diff options
context:
space:
mode:
Diffstat (limited to 'src/dhcp-manager')
-rw-r--r--src/dhcp-manager/nm-dhcp-client-logging.h55
-rw-r--r--src/dhcp-manager/nm-dhcp-client.c86
-rw-r--r--src/dhcp-manager/nm-dhcp-dhclient.c118
-rw-r--r--src/dhcp-manager/nm-dhcp-dhcpcd.c21
-rw-r--r--src/dhcp-manager/nm-dhcp-manager.c63
-rw-r--r--src/dhcp-manager/nm-dhcp-systemd.c206
-rw-r--r--src/dhcp-manager/tests/test-dhcp-utils.c14
7 files changed, 359 insertions, 204 deletions
diff --git a/src/dhcp-manager/nm-dhcp-client-logging.h b/src/dhcp-manager/nm-dhcp-client-logging.h
new file mode 100644
index 00000000..bb4f2f4a
--- /dev/null
+++ b/src/dhcp-manager/nm-dhcp-client-logging.h
@@ -0,0 +1,55 @@
+/* -*- Mode: C; tab-width: 4; indent-tabs-mode: t; c-basic-offset: 4 -*- */
+/* NetworkManager -- Network link manager
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along
+ * with this program; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Copyright (C) 2016 Red Hat, Inc.
+ */
+
+#ifndef __NETWORKMANAGER_DHCP_CLIENT_LOGGING_H__
+#define __NETWORKMANAGER_DHCP_CLIENT_LOGGING_H__
+
+#include "nm-default.h"
+#include "nm-dhcp-client.h"
+
+#define _NMLOG_PREFIX_NAME    "dhcp"
+#define _NMLOG_DOMAIN         LOGD_DHCP
+#define _NMLOG(level, ...) \
+    G_STMT_START { \
+        const NMLogLevel _level = (level); \
+        \
+        /* we check first for LOGD_DHCP instead of the correct domain.
+         * In the worst case, we guess wrong and enter the block.
+         *
+         * Same for the _NMLOG_ENABLED() macro. Probably it would be more
+         * expensive to determine the correct value then what we could
+         * safe. */ \
+        if (nm_logging_enabled (_level, _NMLOG_DOMAIN)) { \
+            NMDhcpClient *_self = (NMDhcpClient *) (self); \
+            const char *__ifname = _self ? nm_dhcp_client_get_iface (_self) : NULL; \
+            const NMLogDomain _domain = !_self \
+                                            ? LOGD_DHCP \
+                                            : (nm_dhcp_client_get_ipv6 (_self) ? LOGD_DHCP6 : LOGD_DHCP4); \
+            \
+            nm_log (_level, _domain, \
+                    "%s%s%s%s%s: " _NM_UTILS_MACRO_FIRST (__VA_ARGS__), \
+                    _NMLOG_PREFIX_NAME, \
+                    (_domain == LOGD_DHCP4 ? "4" : (_domain == LOGD_DHCP6 ? "6" : "")), \
+                    NM_PRINT_FMT_QUOTED (__ifname, " (", __ifname, ")", "") \
+                    _NM_UTILS_MACRO_REST (__VA_ARGS__)); \
+        } \
+    } G_STMT_END
+
+#endif /* __NETWORKMANAGER_DHCP_CLIENT_LOGGING_H__ */
diff --git a/src/dhcp-manager/nm-dhcp-client.c b/src/dhcp-manager/nm-dhcp-client.c
index 0aeb6118..b8161ab5 100644
--- a/src/dhcp-manager/nm-dhcp-client.c
+++ b/src/dhcp-manager/nm-dhcp-client.c
@@ -35,6 +35,8 @@
 #include "nm-dhcp-utils.h"
 #include "nm-platform.h"
 
+#include "nm-dhcp-client-logging.h"
+
 typedef struct {
 	char *       iface;
 	int          ifindex;
@@ -204,7 +206,7 @@ state_to_string (NMDhcpState state)
 }
 
 static NMDhcpState
-reason_to_state (const char *iface, const char *reason)
+reason_to_state (NMDhcpClient *self, const char *iface, const char *reason)
 {
 	if (g_ascii_strcasecmp (reason, "bound") == 0 ||
 	    g_ascii_strcasecmp (reason, "bound6") == 0 ||
@@ -226,7 +228,7 @@ reason_to_state (const char *iface, const char *reason)
 	         g_ascii_strcasecmp (reason, "abend") == 0)
 		return NM_DHCP_STATE_FAIL;
 
-	nm_log_dbg (LOGD_DHCP, "(%s): unmapped DHCP state '%s'", iface, reason);
+	_LOGD ("unmapped DHCP state '%s'", reason);
 	return NM_DHCP_STATE_UNKNOWN;
 }
 
@@ -319,13 +321,10 @@ nm_dhcp_client_set_state (NMDhcpClient *self,
 			event_id = g_strdup_printf ("%s|%s", iaid, start);
 	}
 
-	nm_log_info (priv->ipv6 ? LOGD_DHCP6 : LOGD_DHCP4,
-	             "(%s): DHCPv%c state changed %s -> %s%s%s%s",
-	             priv->iface,
-	             priv->ipv6 ? '6' : '4',
-	             state_to_string (priv->state),
-	             state_to_string (new_state),
-	             NM_PRINT_FMT_QUOTED (event_id, ", event ID=\"", event_id, "\"", ""));
+	_LOGI ("state changed %s -> %s%s%s%s",
+	       state_to_string (priv->state),
+	       state_to_string (new_state),
+	       NM_PRINT_FMT_QUOTED (event_id, ", event ID=\"", event_id, "\"", ""));
 
 	priv->state = new_state;
 	g_signal_emit (G_OBJECT (self),
@@ -343,10 +342,7 @@ transaction_timeout (gpointer user_data)
 	NMDhcpClientPrivate *priv = NM_DHCP_CLIENT_GET_PRIVATE (self);
 
 	priv->timeout_id = 0;
-	nm_log_warn (priv->ipv6 ? LOGD_DHCP6 : LOGD_DHCP4,
-	             "(%s): DHCPv%c request timed out.",
-	             priv->iface,
-	             priv->ipv6 ? '6' : '4');
+	_LOGW ("request timed out");
 	nm_dhcp_client_set_state (self, NM_DHCP_STATE_TIMEOUT, NULL, NULL);
 	return G_SOURCE_REMOVE;
 }
@@ -357,29 +353,20 @@ daemon_watch_cb (GPid pid, gint status, gpointer user_data)
 	NMDhcpClient *self = NM_DHCP_CLIENT (user_data);
 	NMDhcpClientPrivate *priv = NM_DHCP_CLIENT_GET_PRIVATE (self);
 	NMDhcpState new_state;
-	guint64 log_domain;
-	guint ip_ver;
 
 	g_return_if_fail (priv->watch_id);
 	priv->watch_id = 0;
 
-	log_domain = priv->ipv6 ? LOGD_DHCP6 : LOGD_DHCP4;
-	ip_ver = priv->ipv6 ? 6 : 4;
-
 	if (WIFEXITED (status))
-		nm_log_info (log_domain, "(%s): DHCPv%d client pid %d exited with status %d",
-		             priv->iface, ip_ver, pid, WEXITSTATUS (status));
+		_LOGI ("client pid %d exited with status %d", pid, WEXITSTATUS (status));
 	else if (WIFSIGNALED (status))
-		nm_log_info (log_domain, "(%s): DHCPv%d client pid %d killed by signal %d",
-		             priv->iface, ip_ver, pid, WTERMSIG (status));
+		_LOGI ("client pid %d killed by signal %d", pid, WTERMSIG (status));
 	else if (WIFSTOPPED(status))
-		nm_log_info (log_domain, "(%s): DHCPv%d client pid %d stopped by signal %d",
-		             priv->iface, ip_ver, pid, WSTOPSIG (status));
+		_LOGI ("client pid %d stopped by signal %d", pid, WSTOPSIG (status));
 	else if (WIFCONTINUED (status))
-		nm_log_info (log_domain, "(%s): DHCPv%d client pid %d resumed (by SIGCONT)",
-		             priv->iface, ip_ver, pid);
+		_LOGI ("client pid %d resumed (by SIGCONT)", pid);
 	else
-		nm_log_warn (LOGD_DHCP, "DHCP client died abnormally");
+		_LOGW ("client died abnormally");
 
 	if (!WIFEXITED (status))
 		new_state = NM_DHCP_STATE_FAIL;
@@ -426,6 +413,7 @@ nm_dhcp_client_start_ip4 (NMDhcpClient *self,
                           const char *last_ip4_address)
 {
 	NMDhcpClientPrivate *priv;
+	gs_unref_bytes GBytes *tmp = NULL;
 
 	g_return_val_if_fail (NM_IS_DHCP_CLIENT (self), FALSE);
 
@@ -434,10 +422,11 @@ nm_dhcp_client_start_ip4 (NMDhcpClient *self,
 	g_return_val_if_fail (priv->ipv6 == FALSE, FALSE);
 	g_return_val_if_fail (priv->uuid != NULL, FALSE);
 
-	nm_log_info (LOGD_DHCP, "Activation (%s) Beginning DHCPv4 transaction (timeout in %d seconds)",
-	             priv->iface, priv->timeout);
+	_LOGI ("activation: beginning transaction (timeout in %d seconds)", priv->timeout);
 
-	nm_dhcp_client_set_client_id (self, dhcp_client_id ? nm_dhcp_utils_client_id_string_to_bytes (dhcp_client_id) : NULL);
+	if (dhcp_client_id)
+		tmp = nm_dhcp_utils_client_id_string_to_bytes (dhcp_client_id);
+	nm_dhcp_client_set_client_id (self, tmp);
 
 	g_clear_pointer (&priv->hostname, g_free);
 	priv->hostname = g_strdup (hostname);
@@ -506,7 +495,7 @@ generate_duid_from_machine_id (void)
 	}
 
 	if (!success) {
-		nm_log_warn (LOGD_DHCP6, "Failed to read " SYSCONFDIR "/machine-id "
+		nm_log_warn (LOGD_DHCP6, "dhcp6: failed to read " SYSCONFDIR "/machine-id "
 		             "or " LOCALSTATEDIR "/lib/dbus/machine-id to generate "
 		             "DHCPv6 DUID; creating non-persistent random DUID.");
 
@@ -546,7 +535,7 @@ get_duid (NMDhcpClient *self)
 
 		if (nm_logging_enabled (LOGL_DEBUG, LOGD_DHCP6)) {
 			str = nm_dhcp_utils_duid_to_string (duid);
-			nm_log_dbg (LOGD_DHCP6, "Generated DUID %s", str);
+			_LOGD ("generated DUID %s", str);
 			g_free (str);
 		}
 	}
@@ -583,9 +572,9 @@ nm_dhcp_client_start_ip6 (NMDhcpClient *self,
 	if (!priv->duid)
 		priv->duid = NM_DHCP_CLIENT_GET_CLASS (self)->get_duid (self);
 
-	if (nm_logging_enabled (LOGL_DEBUG, LOGD_DHCP)) {
+	if (nm_logging_enabled (LOGL_DEBUG, LOGD_DHCP6)) {
 		str = nm_dhcp_utils_duid_to_string (priv->duid);
-		nm_log_dbg (LOGD_DHCP, "(%s): DHCPv6 DUID is '%s'", priv->iface, str);
+		_LOGD ("DUID is '%s'", str);
 		g_free (str);
 	}
 
@@ -594,8 +583,8 @@ nm_dhcp_client_start_ip6 (NMDhcpClient *self,
 
 	priv->info_only = info_only;
 
-	nm_log_info (LOGD_DHCP, "Activation (%s) Beginning DHCPv6 transaction (timeout in %d seconds)",
-	             priv->iface, priv->timeout);
+	_LOGI ("activation: beginning transaction (timeout in %d seconds)",
+	       priv->timeout);
 
 	return NM_DHCP_CLIENT_GET_CLASS (self)->ip6_start (self,
 	                                                   dhcp_anycast_addr,
@@ -645,8 +634,10 @@ nm_dhcp_client_stop_existing (const char *pid_file, const char *binary_name)
 		}
 	}
 
-	if (remove (pid_file) == -1)
-		nm_log_dbg (LOGD_DHCP, "Could not remove dhcp pid file \"%s\": %d (%s)", pid_file, errno, g_strerror (errno));
+	if (remove (pid_file) == -1) {
+		nm_log_dbg (LOGD_DHCP, "dhcp: could not remove pid file \"%s\": %d (%s)",
+		            pid_file, errno, g_strerror (errno));
+	}
 
 	g_free (proc_path);
 	g_free (pid_contents);
@@ -666,11 +657,10 @@ nm_dhcp_client_stop (NMDhcpClient *self, gboolean release)
 	/* Kill the DHCP client */
 	old_pid = priv->pid;
 	NM_DHCP_CLIENT_GET_CLASS (self)->stop (self, release, priv->duid);
-	if (old_pid > 0) {
-		nm_log_info (LOGD_DHCP, "(%s): canceled DHCP transaction, DHCP client pid %d",
-		             priv->iface, old_pid);
-	} else
-		nm_log_info (LOGD_DHCP, "(%s): canceled DHCP transaction", priv->iface);
+	if (old_pid > 0)
+		_LOGI ("canceled DHCP transaction, DHCP client pid %d", old_pid);
+	else
+		_LOGI ("canceled DHCP transaction");
 	g_assert (priv->pid == -1);
 
 	nm_dhcp_client_set_state (self, NM_DHCP_STATE_DONE, NULL, NULL);
@@ -710,7 +700,7 @@ bytearray_variant_to_string (GVariant *value, const char *key)
 
 	converted = str->str;
 	if (!g_utf8_validate (converted, -1, NULL))
-		nm_log_warn (LOGD_DHCP, "DHCP option '%s' couldn't be converted to UTF-8", key);
+		nm_log_warn (LOGD_DHCP, "dhcp: option '%s' couldn't be converted to UTF-8", key);
 	g_string_free (str, FALSE);
 	return converted;
 }
@@ -782,9 +772,9 @@ nm_dhcp_client_handle_event (gpointer unused,
 		return FALSE;
 
 	old_state = priv->state;
-	new_state = reason_to_state (priv->iface, reason);
-	nm_log_dbg (LOGD_DHCP, "(%s): DHCP reason '%s' -> state '%s'",
-	            iface, reason, state_to_string (new_state));
+	new_state = reason_to_state (self, priv->iface, reason);
+	_LOGD ("DHCP reason '%s' -> state '%s'",
+	       reason, state_to_string (new_state));
 
 	if (new_state == NM_DHCP_STATE_BOUND) {
 		GVariantIter iter;
@@ -817,7 +807,7 @@ nm_dhcp_client_handle_event (gpointer unused,
 
 			/* Fail if no valid IP config was received */
 			if (ip_config == NULL) {
-				nm_log_warn (LOGD_DHCP, "(%s): DHCP client bound but IP config not received", iface);
+				_LOGW ("client bound but IP config not received");
 				new_state = NM_DHCP_STATE_FAIL;
 				g_clear_pointer (&str_options, g_hash_table_unref);
 			}
diff --git a/src/dhcp-manager/nm-dhcp-dhclient.c b/src/dhcp-manager/nm-dhcp-dhclient.c
index bc4345fe..4b6d301b 100644
--- a/src/dhcp-manager/nm-dhcp-dhclient.c
+++ b/src/dhcp-manager/nm-dhcp-dhclient.c
@@ -41,6 +41,7 @@
 #include "nm-dhcp-manager.h"
 #include "NetworkManagerUtils.h"
 #include "nm-dhcp-listener.h"
+#include "nm-dhcp-client-logging.h"
 
 G_DEFINE_TYPE (NMDhcpDhclient, nm_dhcp_dhclient, NM_TYPE_DHCP_CLIENT)
 
@@ -148,7 +149,8 @@ nm_dhcp_dhclient_get_lease_ip_configs (const char *iface,
 }
 
 static gboolean
-merge_dhclient_config (const char *iface,
+merge_dhclient_config (NMDhcpDhclient *self,
+                       const char *iface,
                        const char *conf_file,
                        gboolean is_ip6,
                        GBytes *client_id,
@@ -169,8 +171,8 @@ merge_dhclient_config (const char *iface,
 		GError *read_error = NULL;
 
 		if (!g_file_get_contents (orig_path, &orig, NULL, &read_error)) {
-			nm_log_warn (LOGD_DHCP, "(%s): error reading dhclient%s configuration %s: %s",
-			             iface, is_ip6 ? "6" : "", orig_path, read_error->message);
+			_LOGW ("error reading dhclient configuration %s: %s",
+			       orig_path, read_error->message);
 			g_error_free (read_error);
 		}
 	}
@@ -185,7 +187,7 @@ merge_dhclient_config (const char *iface,
 }
 
 static char *
-find_existing_config (const char *iface, const char *uuid, gboolean ipv6)
+find_existing_config (NMDhcpDhclient *self, const char *iface, const char *uuid, gboolean ipv6)
 {
 	char *path;
 
@@ -195,20 +197,20 @@ find_existing_config (const char *iface, const char *uuid, gboolean ipv6)
 	 */
 	if (uuid) {
 		path = g_strdup_printf (NMCONFDIR "/dhclient%s-%s.conf", ipv6 ? "6" : "", uuid);
-		nm_log_dbg (ipv6 ? LOGD_DHCP6 : LOGD_DHCP4, "(%s) looking for existing config %s", iface, path);
+		_LOGD ("looking for existing config %s", path);
 		if (g_file_test (path, G_FILE_TEST_EXISTS))
 			return path;
 		g_free (path);
 	}
 
 	path = g_strdup_printf (NMCONFDIR "/dhclient%s-%s.conf", ipv6 ? "6" : "", iface);
-	nm_log_dbg (ipv6 ? LOGD_DHCP6 : LOGD_DHCP4, "(%s) looking for existing config %s", iface, path);
+	_LOGD ("looking for existing config %s", path);
 	if (g_file_test (path, G_FILE_TEST_EXISTS))
 		return path;
 	g_free (path);
 
 	path = g_strdup_printf (NMCONFDIR "/dhclient%s.conf", ipv6 ? "6" : "");
-	nm_log_dbg (ipv6 ? LOGD_DHCP6 : LOGD_DHCP4, "(%s) looking for existing config %s", iface, path);
+	_LOGD ("looking for existing config %s", path);
 	if (g_file_test (path, G_FILE_TEST_EXISTS))
 		return path;
 	g_free (path);
@@ -222,25 +224,25 @@ find_existing_config (const char *iface, const char *uuid, gboolean ipv6)
 	 * (including Fedora) don't even provide a default configuration file.
 	 */
 	path = g_strdup_printf (SYSCONFDIR "/dhcp/dhclient%s-%s.conf", ipv6 ? "6" : "", iface);
-	nm_log_dbg (ipv6 ? LOGD_DHCP6 : LOGD_DHCP4, "(%s) looking for existing config %s", iface, path);
+	_LOGD ("looking for existing config %s", path);
 	if (g_file_test (path, G_FILE_TEST_EXISTS))
 		return path;
 	g_free (path);
 
 	path = g_strdup_printf (SYSCONFDIR "/dhclient%s-%s.conf", ipv6 ? "6" : "", iface);
-	nm_log_dbg (ipv6 ? LOGD_DHCP6 : LOGD_DHCP4, "(%s) looking for existing config %s", iface, path);
+	_LOGD ("looking for existing config %s", path);
 	if (g_file_test (path, G_FILE_TEST_EXISTS))
 		return path;
 	g_free (path);
 
 	path = g_strdup_printf (SYSCONFDIR "/dhcp/dhclient%s.conf", ipv6 ? "6" : "");
-	nm_log_dbg (ipv6 ? LOGD_DHCP6 : LOGD_DHCP4, "(%s) looking for existing config %s", iface, path);
+	_LOGD ("looking for existing config %s", path);
 	if (g_file_test (path, G_FILE_TEST_EXISTS))
 		return path;
 	g_free (path);
 
 	path = g_strdup_printf (SYSCONFDIR "/dhclient%s.conf", ipv6 ? "6" : "");
-	nm_log_dbg (ipv6 ? LOGD_DHCP6 : LOGD_DHCP4, "(%s) looking for existing config %s", iface, path);
+	_LOGD ("looking for existing config %s", path);
 	if (g_file_test (path, G_FILE_TEST_EXISTS))
 		return path;
 	g_free (path);
@@ -256,7 +258,8 @@ find_existing_config (const char *iface, const char *uuid, gboolean ipv6)
  * config file along with the NM options.
  */
 static char *
-create_dhclient_config (const char *iface,
+create_dhclient_config (NMDhcpDhclient *self,
+                        const char *iface,
                         gboolean is_ip6,
                         const char *uuid,
                         GBytes *client_id,
@@ -272,26 +275,19 @@ create_dhclient_config (const char *iface,
 	g_return_val_if_fail (iface != NULL, NULL);
 
 	new = g_strdup_printf (NMSTATEDIR "/dhclient%s-%s.conf", is_ip6 ? "6" : "", iface);
-	nm_log_dbg (is_ip6 ? LOGD_DHCP6 : LOGD_DHCP4,
-	            "(%s): creating composite dhclient config %s",
-	            iface, new);
-
-	orig = find_existing_config (iface, uuid, is_ip6);
-	if (orig) {
-		nm_log_dbg (is_ip6 ? LOGD_DHCP6 : LOGD_DHCP4,
-		            "(%s): merging existing dhclient config %s",
-		            iface, orig);
-	} else {
-		nm_log_dbg (is_ip6 ? LOGD_DHCP6 : LOGD_DHCP4,
-		            "(%s): no existing dhclient configuration to merge",
-		            iface);
-	}
+	_LOGD ("creating composite dhclient config %s", new);
+
+	orig = find_existing_config (self, iface, uuid, is_ip6);
+	if (orig)
+		_LOGD ("merging existing dhclient config %s", orig);
+	else
+		_LOGD ("no existing dhclient configuration to merge");
 
 	error = NULL;
-	success = merge_dhclient_config (iface, new, is_ip6, client_id, dhcp_anycast_addr, hostname, fqdn, orig, out_new_client_id, &error);
+	success = merge_dhclient_config (self, iface, new, is_ip6, client_id, dhcp_anycast_addr,
+			                         hostname, fqdn, orig, out_new_client_id, &error);
 	if (!success) {
-		nm_log_warn (LOGD_DHCP, "(%s): error creating dhclient%s configuration: %s",
-		             iface, is_ip6 ? "6" : "", error->message);
+		_LOGW ("error creating dhclient configuration: %s", error->message);
 		g_error_free (error);
 	}
 
@@ -307,14 +303,14 @@ dhclient_start (NMDhcpClient *client,
                 gboolean release,
                 pid_t *out_pid)
 {
-	NMDhcpDhclientPrivate *priv = NM_DHCP_DHCLIENT_GET_PRIVATE (client);
+	NMDhcpDhclient *self = NM_DHCP_DHCLIENT (client);
+	NMDhcpDhclientPrivate *priv = NM_DHCP_DHCLIENT_GET_PRIVATE (self);
 	GPtrArray *argv = NULL;
 	pid_t pid;
 	GError *error = NULL;
 	const char *iface, *uuid, *system_bus_address, *dhclient_path = NULL;
 	char *binary_name, *cmd_str, *pid_file = NULL, *system_bus_address_env = NULL;
 	gboolean ipv6, success;
-	guint log_domain;
 	char *escaped, *preferred_leasefile_path = NULL;
 
 	g_return_val_if_fail (priv->pid_file == NULL, FALSE);
@@ -323,11 +319,9 @@ dhclient_start (NMDhcpClient *client,
 	uuid = nm_dhcp_client_get_uuid (client);
 	ipv6 = nm_dhcp_client_get_ipv6 (client);
 
-	log_domain = ipv6 ? LOGD_DHCP6 : LOGD_DHCP4;
-
 	dhclient_path = nm_dhcp_dhclient_get_path ();
 	if (!dhclient_path) {
-		nm_log_warn (log_domain, "dhclient could not be found");
+		_LOGW ("dhclient could not be found");
 		return FALSE;
 	}
 
@@ -362,9 +356,9 @@ dhclient_start (NMDhcpClient *client,
 			priv->lease_file = g_strdup (g_file_get_path (dst));
 		} else {
 			/* Failure; just use the existing leasefile */
-			nm_log_warn (log_domain, "Failed to copy leasefile %s to %s: (%d) %s",
-			             g_file_get_path (src), g_file_get_path (dst),
-			             error->code, error->message);
+			_LOGW ("failed to copy leasefile %s to %s: %s",
+			       g_file_get_path (src), g_file_get_path (dst),
+			       error->message);
 			g_clear_error (&error);
 		}
 		g_object_unref (src);
@@ -378,10 +372,7 @@ dhclient_start (NMDhcpClient *client,
 		success = nm_dhcp_dhclient_save_duid (priv->lease_file, escaped, &error);
 		g_free (escaped);
 		if (!success) {
-			nm_log_warn (log_domain, "(%s): failed to save DUID to %s: (%d) %s.",
-			             iface, priv->lease_file,
-			             error ? error->code : -1,
-			             error && error->message ? error->message : "(unknown)");
+			_LOGW ("failed to save DUID to %s: %s", priv->lease_file, error->message);
 			g_free (pid_file);
 			return FALSE;
 		}
@@ -437,19 +428,19 @@ dhclient_start (NMDhcpClient *client,
 	g_ptr_array_add (argv, NULL);
 
 	cmd_str = g_strjoinv (" ", (gchar **) argv->pdata);
-	nm_log_dbg (log_domain, "running: %s", cmd_str);
+	_LOGD ("running: %s", cmd_str);
 	g_free (cmd_str);
 
 	if (g_spawn_async (NULL, (char **) argv->pdata, NULL,
 	                   G_SPAWN_DO_NOT_REAP_CHILD | G_SPAWN_STDOUT_TO_DEV_NULL | G_SPAWN_STDERR_TO_DEV_NULL,
 	                   nm_utils_setpgid, NULL, &pid, &error)) {
 		g_assert (pid > 0);
-		nm_log_info (log_domain, "dhclient started with pid %d", pid);
+		_LOGI ("dhclient started with pid %d", pid);
 		if (release == FALSE)
 			nm_dhcp_client_watch_child (client, pid);
 		priv->pid_file = pid_file;
 	} else {
-		nm_log_warn (log_domain, "dhclient failed to start: '%s'", error->message);
+		_LOGW ("dhclient failed to start: '%s'", error->message);
 		g_error_free (error);
 		g_free (pid_file);
 	}
@@ -465,7 +456,8 @@ dhclient_start (NMDhcpClient *client,
 static gboolean
 ip4_start (NMDhcpClient *client, const char *dhcp_anycast_addr, const char *last_ip4_address)
 {
-	NMDhcpDhclientPrivate *priv = NM_DHCP_DHCLIENT_GET_PRIVATE (client);
+	NMDhcpDhclient *self = NM_DHCP_DHCLIENT (client);
+	NMDhcpDhclientPrivate *priv = NM_DHCP_DHCLIENT_GET_PRIVATE (self);
 	GBytes *client_id;
 	gs_unref_bytes GBytes *new_client_id = NULL;
 	const char *iface, *uuid, *hostname, *fqdn;
@@ -477,14 +469,14 @@ ip4_start (NMDhcpClient *client, const char *dhcp_anycast_addr, const char *last
 	hostname = nm_dhcp_client_get_hostname (client);
 	fqdn = nm_dhcp_client_get_fqdn (client);
 
-	priv->conf_file = create_dhclient_config (iface, FALSE, uuid, client_id, dhcp_anycast_addr,
+	priv->conf_file = create_dhclient_config (self, iface, FALSE, uuid, client_id, dhcp_anycast_addr,
 	                                          hostname, fqdn, &new_client_id);
 	if (priv->conf_file) {
 		if (new_client_id)
 			nm_dhcp_client_set_client_id (client, new_client_id);
 		success = dhclient_start (client, NULL, NULL, FALSE, NULL);
 	} else
-		nm_log_warn (LOGD_DHCP4, "(%s): error creating dhclient configuration file.", iface);
+		_LOGW ("error creating dhclient configuration file");
 
 	return success;
 }
@@ -497,16 +489,17 @@ ip6_start (NMDhcpClient *client,
            NMSettingIP6ConfigPrivacy privacy,
            const GByteArray *duid)
 {
-	NMDhcpDhclientPrivate *priv = NM_DHCP_DHCLIENT_GET_PRIVATE (client);
+	NMDhcpDhclient *self = NM_DHCP_DHCLIENT (client);
+	NMDhcpDhclientPrivate *priv = NM_DHCP_DHCLIENT_GET_PRIVATE (self);
 	const char *iface, *uuid, *hostname;
 
 	iface = nm_dhcp_client_get_iface (client);
 	uuid = nm_dhcp_client_get_uuid (client);
 	hostname = nm_dhcp_client_get_hostname (client);
 
-	priv->conf_file = create_dhclient_config (iface, TRUE, uuid, NULL, dhcp_anycast_addr, hostname, NULL, NULL);
+	priv->conf_file = create_dhclient_config (self, iface, TRUE, uuid, NULL, dhcp_anycast_addr, hostname, NULL, NULL);
 	if (!priv->conf_file) {
-		nm_log_warn (LOGD_DHCP6, "(%s): error creating dhclient6 configuration file.", iface);
+		_LOGW ("error creating dhclient configuration file");
 		return FALSE;
 	}
 
@@ -516,17 +509,18 @@ ip6_start (NMDhcpClient *client,
 static void
 stop (NMDhcpClient *client, gboolean release, const GByteArray *duid)
 {
-	NMDhcpDhclientPrivate *priv = NM_DHCP_DHCLIENT_GET_PRIVATE (client);
+	NMDhcpDhclient *self = NM_DHCP_DHCLIENT (client);
+	NMDhcpDhclientPrivate *priv = NM_DHCP_DHCLIENT_GET_PRIVATE (self);
 
 	/* Chain up to parent */
 	NM_DHCP_CLIENT_CLASS (nm_dhcp_dhclient_parent_class)->stop (client, release, duid);
 
 	if (priv->conf_file)
 		if (remove (priv->conf_file) == -1)
-			nm_log_dbg (LOGD_DHCP, "Could not remove dhcp config file \"%s\": %d (%s)", priv->conf_file, errno, g_strerror (errno));
+			_LOGD ("could not remove dhcp config file \"%s\": %d (%s)", priv->conf_file, errno, g_strerror (errno));
 	if (priv->pid_file) {
 		if (remove (priv->pid_file) == -1)
-			nm_log_dbg (LOGD_DHCP, "Could not remove dhcp pid file \"%s\": %d (%s)", priv->pid_file, errno, g_strerror (errno));
+			_LOGD ("could not remove dhcp pid file \"%s\": %d (%s)", priv->pid_file, errno, g_strerror (errno));
 		g_free (priv->pid_file);
 		priv->pid_file = NULL;
 	}
@@ -562,7 +556,8 @@ state_changed (NMDhcpClient *client,
 static GByteArray *
 get_duid (NMDhcpClient *client)
 {
-	NMDhcpDhclientPrivate *priv = NM_DHCP_DHCLIENT_GET_PRIVATE (client);
+	NMDhcpDhclient *self = NM_DHCP_DHCLIENT (client);
+	NMDhcpDhclientPrivate *priv = NM_DHCP_DHCLIENT_GET_PRIVATE (self);
 	GByteArray *duid = NULL;
 	char *leasefile;
 	GError *error = NULL;
@@ -573,12 +568,12 @@ get_duid (NMDhcpClient *client)
 	                                    TRUE,
 	                                    NULL);
 	if (leasefile) {
-		nm_log_dbg (LOGD_DHCP, "Looking for DHCPv6 DUID in '%s'.", leasefile);
+		_LOGD ("looking for DUID in '%s'", leasefile);
 		duid = nm_dhcp_dhclient_read_duid (leasefile, &error);
 
 		if (error) {
-			nm_log_warn (LOGD_DHCP, "Failed to read leasefile '%s': (%d) %s",
-			             leasefile, error->code, error->message);
+			_LOGW ("failed to read leasefile '%s': %s",
+			       leasefile, error->message);
 			g_clear_error (&error);
 		}
 		g_free (leasefile);
@@ -586,13 +581,12 @@ get_duid (NMDhcpClient *client)
 
 	if (!duid && priv->def_leasefile) {
 		/* Otherwise read the default machine-wide DUID */
-		nm_log_dbg (LOGD_DHCP, "Looking for default DHCPv6 DUID in '%s'.", priv->def_leasefile);
+		_LOGD ("looking for default DUID in '%s'", priv->def_leasefile);
 		duid = nm_dhcp_dhclient_read_duid (priv->def_leasefile, &error);
 		if (error) {
-			nm_log_warn (LOGD_DHCP, "Failed to read leasefile '%s': (%d) %s",
-			             priv->def_leasefile,
-			             error ? error->code : -1,
-			             error ? error->message : "(unknown)");
+			_LOGW ("failed to read leasefile '%s': %s",
+			        priv->def_leasefile,
+			        error->message);
 			g_clear_error (&error);
 		}
 	}
diff --git a/src/dhcp-manager/nm-dhcp-dhcpcd.c b/src/dhcp-manager/nm-dhcp-dhcpcd.c
index 8060cc6a..8bbb6e4c 100644
--- a/src/dhcp-manager/nm-dhcp-dhcpcd.c
+++ b/src/dhcp-manager/nm-dhcp-dhcpcd.c
@@ -36,6 +36,7 @@
 #include "nm-utils.h"
 #include "NetworkManagerUtils.h"
 #include "nm-dhcp-listener.h"
+#include "nm-dhcp-client-logging.h"
 
 G_DEFINE_TYPE (NMDhcpDhcpcd, nm_dhcp_dhcpcd, NM_TYPE_DHCP_CLIENT)
 
@@ -58,7 +59,8 @@ nm_dhcp_dhcpcd_get_path (void)
 static gboolean
 ip4_start (NMDhcpClient *client, const char *dhcp_anycast_addr, const char *last_ip4_address)
 {
-	NMDhcpDhcpcdPrivate *priv = NM_DHCP_DHCPCD_GET_PRIVATE (client);
+	NMDhcpDhcpcd *self = NM_DHCP_DHCPCD (client);
+	NMDhcpDhcpcdPrivate *priv = NM_DHCP_DHCPCD_GET_PRIVATE (self);
 	GPtrArray *argv = NULL;
 	pid_t pid = -1;
 	GError *error = NULL;
@@ -77,7 +79,7 @@ ip4_start (NMDhcpClient *client, const char *dhcp_anycast_addr, const char *last
 
 	dhcpcd_path = nm_dhcp_dhcpcd_get_path ();
 	if (!dhcpcd_path) {
-		nm_log_warn (LOGD_DHCP4, "dhcpcd could not be found");
+		_LOGW ("dhcpcd could not be found");
 		return FALSE;
 	}
 
@@ -134,17 +136,17 @@ ip4_start (NMDhcpClient *client, const char *dhcp_anycast_addr, const char *last
 	g_ptr_array_add (argv, NULL);
 
 	cmd_str = g_strjoinv (" ", (gchar **) argv->pdata);
-	nm_log_dbg (LOGD_DHCP4, "running: %s", cmd_str);
+	_LOGD ("running: %s", cmd_str);
 	g_free (cmd_str);
 
 	if (g_spawn_async (NULL, (char **) argv->pdata, NULL,
 	                   G_SPAWN_DO_NOT_REAP_CHILD | G_SPAWN_STDOUT_TO_DEV_NULL | G_SPAWN_STDERR_TO_DEV_NULL,
 	                   nm_utils_setpgid, NULL, &pid, &error)) {
 		g_assert (pid > 0);
-		nm_log_info (LOGD_DHCP4, "dhcpcd started with pid %d", pid);
+		_LOGI ("dhcpcd started with pid %d", pid);
 		nm_dhcp_client_watch_child (client, pid);
 	} else {
-		nm_log_warn (LOGD_DHCP4, "dhcpcd failed to start.  error: '%s'", error->message);
+		_LOGW ("dhcpcd failed to start, error: '%s'", error->message);
 		g_error_free (error);
 	}
 
@@ -161,21 +163,24 @@ ip6_start (NMDhcpClient *client,
            NMSettingIP6ConfigPrivacy privacy,
            const GByteArray *duid)
 {
-	nm_log_warn (LOGD_DHCP6, "the dhcpcd backend does not support IPv6.");
+	NMDhcpDhcpcd *self = NM_DHCP_DHCPCD (client);
+
+	_LOGW ("the dhcpcd backend does not support IPv6");
 	return FALSE;
 }
 
 static void
 stop (NMDhcpClient *client, gboolean release, const GByteArray *duid)
 {
-	NMDhcpDhcpcdPrivate *priv = NM_DHCP_DHCPCD_GET_PRIVATE (client);
+	NMDhcpDhcpcd *self = NM_DHCP_DHCPCD (client);
+	NMDhcpDhcpcdPrivate *priv = NM_DHCP_DHCPCD_GET_PRIVATE (self);
 
 	/* Chain up to parent */
 	NM_DHCP_CLIENT_CLASS (nm_dhcp_dhcpcd_parent_class)->stop (client, release, duid);
 
 	if (priv->pid_file) {
 		if (remove (priv->pid_file) == -1)
-			nm_log_dbg (LOGD_DHCP, "Could not remove dhcp pid file \"%s\": %d (%s)", priv->pid_file, errno, g_strerror (errno));
+			_LOGD ("could not remove dhcp pid file \"%s\": %d (%s)", priv->pid_file, errno, g_strerror (errno));
 	}
 
 	/* FIXME: implement release... */
diff --git a/src/dhcp-manager/nm-dhcp-manager.c b/src/dhcp-manager/nm-dhcp-manager.c
index 44c3365d..fe723e96 100644
--- a/src/dhcp-manager/nm-dhcp-manager.c
+++ b/src/dhcp-manager/nm-dhcp-manager.c
@@ -113,7 +113,7 @@ find_client_desc (const char *name, GType gtype)
 }
 
 static GType
-is_client_enabled (const char *name, GError **error)
+is_client_enabled (const char *name)
 {
 	ClientDesc *desc;
 
@@ -121,9 +121,6 @@ is_client_enabled (const char *name, GError **error)
 	if (desc && (!desc->get_path_func || desc->get_path_func()))
 		return desc->gtype;
 
-	g_set_error (error, NM_MANAGER_ERROR, NM_MANAGER_ERROR_FAILED,
-	             _("'%s' support not found or not enabled."),
-	             name);
 	return G_TYPE_INVALID;
 }
 
@@ -153,28 +150,6 @@ get_client_for_ifindex (NMDhcpManager *manager, int ifindex, gboolean ip6)
 	return NULL;
 }
 
-static GType
-get_client_type (const char *client, GError **error)
-{
-	GType client_gtype;
-
-	if (client)
-		client_gtype = is_client_enabled (client, error);
-	else {
-		/* Fallbacks */
-		client_gtype = is_client_enabled ("dhclient", NULL);
-		if (client_gtype == G_TYPE_INVALID)
-			client_gtype = is_client_enabled ("dhcpcd", NULL);
-		if (client_gtype == G_TYPE_INVALID)
-			client_gtype = is_client_enabled ("internal", NULL);
-		if (client_gtype == G_TYPE_INVALID) {
-			g_set_error_literal (error, NM_MANAGER_ERROR, NM_MANAGER_ERROR_FAILED,
-				                 _("no usable DHCP client could be found."));
-		}
-	}
-	return client_gtype;
-}
-
 static void client_state_changed (NMDhcpClient *client,
                                   NMDhcpState state,
                                   GObject *ip_config,
@@ -237,7 +212,8 @@ client_start (NMDhcpManager *self,
 	priv = NM_DHCP_MANAGER_GET_PRIVATE (self);
 
 	/* Ensure we have a usable DHCP client */
-	g_return_val_if_fail (priv->client_type != 0, NULL);
+	if (priv->client_type == G_TYPE_INVALID)
+		return NULL;
 
 	/* Kill any old client instance */
 	client = get_client_for_ifindex (self, ifindex, ipv6);
@@ -362,6 +338,7 @@ nm_dhcp_manager_get_lease_ip_configs (NMDhcpManager *self,
                                       gboolean ipv6,
                                       guint32 default_route_metric)
 {
+	NMDhcpManagerPrivate *priv;
 	ClientDesc *desc;
 
 	g_return_val_if_fail (NM_IS_DHCP_MANAGER (self), NULL);
@@ -369,7 +346,11 @@ nm_dhcp_manager_get_lease_ip_configs (NMDhcpManager *self,
 	g_return_val_if_fail (ifindex >= -1, NULL);
 	g_return_val_if_fail (uuid != NULL, NULL);
 
-	desc = find_client_desc (NULL, NM_DHCP_MANAGER_GET_PRIVATE (self)->client_type);
+	priv = NM_DHCP_MANAGER_GET_PRIVATE (self);
+	if (priv->client_type == G_TYPE_INVALID)
+		return NULL;
+
+	desc = find_client_desc (NULL, priv->client_type);
 	if (desc && desc->get_lease_configs_func)
 		return desc->get_lease_configs_func (iface, ifindex, uuid, ipv6, default_route_metric);
 	return NULL;
@@ -385,8 +366,8 @@ nm_dhcp_manager_init (NMDhcpManager *self)
 	NMDhcpManagerPrivate *priv = NM_DHCP_MANAGER_GET_PRIVATE (self);
 	NMConfig *config = nm_config_get ();
 	const char *client;
-	GError *error = NULL;
 	GSList *iter;
+	GType type = G_TYPE_INVALID;
 
 	for (iter = client_descs; iter; iter = iter->next) {
 		ClientDesc *desc = iter->data;
@@ -403,16 +384,26 @@ nm_dhcp_manager_init (NMDhcpManager *self)
 		client = "internal";
 	}
 
-	priv->client_type = get_client_type (client, &error);
-	if (priv->client_type == G_TYPE_INVALID) {
-		nm_log_warn (LOGD_DHCP, "No usable DHCP client found (%s)! DHCP configurations will fail.",
-		             error->message);
-	} else {
-		nm_log_dbg (LOGD_DHCP, "Using DHCP client '%s'", find_client_desc (NULL, priv->client_type)->name);
+	if (client)
+		type = is_client_enabled (client);
 
+	if (type == G_TYPE_INVALID) {
+		if (client)
+			nm_log_warn (LOGD_DHCP, "DHCP client '%s' not available", client);
+
+		type = is_client_enabled ("dhclient");
+		if (type == G_TYPE_INVALID)
+			type = is_client_enabled ("dhcpcd");
+		if (type == G_TYPE_INVALID)
+			type = is_client_enabled ("internal");
 	}
-	g_clear_error (&error);
 
+	if (type == G_TYPE_INVALID)
+		nm_log_warn (LOGD_DHCP, "No usable DHCP client found! DHCP configurations will fail");
+	else
+		nm_log_info (LOGD_DHCP, "Using DHCP client '%s'", find_client_desc (NULL, type)->name);
+
+	priv->client_type = type;
 	priv->clients = g_hash_table_new_full (g_direct_hash, g_direct_equal,
 	                                       NULL,
 	                                       (GDestroyNotify) g_object_unref);
diff --git a/src/dhcp-manager/nm-dhcp-systemd.c b/src/dhcp-manager/nm-dhcp-systemd.c
index b5a3d67c..91fa8803 100644
--- a/src/dhcp-manager/nm-dhcp-systemd.c
+++ b/src/dhcp-manager/nm-dhcp-systemd.c
@@ -33,11 +33,11 @@
 #include "nm-dhcp-utils.h"
 #include "NetworkManagerUtils.h"
 #include "nm-platform.h"
+#include "nm-dhcp-client-logging.h"
 
 #include "sd-dhcp-client.h"
 #include "sd-dhcp6-client.h"
 
-/* we use a private systemd header, thus need to include nm-sd-adapt.h. */
 #include "nm-sd-adapt.h"
 #include "dhcp-lease-internal.h"
 
@@ -53,6 +53,7 @@ typedef struct {
 	guint request_count;
 
 	gboolean privacy;
+	gboolean info_only;
 } NMDhcpSystemdPrivate;
 
 /************************************************************/
@@ -464,15 +465,15 @@ bound4_handle (NMDhcpSystemd *self)
 	GError *error = NULL;
 	int r;
 
-	nm_log_dbg (LOGD_DHCP4, "(%s): lease available", iface);
-
 	r = sd_dhcp_client_get_lease (priv->client4, &lease);
 	if (r < 0 || !lease) {
-		nm_log_warn (LOGD_DHCP4, "(%s): no lease!", iface);
+		_LOGW ("no lease!");
 		nm_dhcp_client_set_state (NM_DHCP_CLIENT (self), NM_DHCP_STATE_FAIL, NULL, NULL);
 		return;
 	}
 
+	_LOGD ("lease available");
+
 	options = g_hash_table_new_full (g_str_hash, g_str_equal, NULL, g_free);
 	ip4_config = lease_to_ip4_config (iface,
 	                                  nm_dhcp_client_get_ifindex (NM_DHCP_CLIENT (self)),
@@ -498,7 +499,7 @@ bound4_handle (NMDhcpSystemd *self)
 		                          G_OBJECT (ip4_config),
 		                          options);
 	} else {
-		nm_log_warn (LOGD_DHCP4, "(%s): %s", iface, error->message);
+		_LOGW ("%s", error->message);
 		nm_dhcp_client_set_state (NM_DHCP_CLIENT (self), NM_DHCP_STATE_FAIL, NULL, NULL);
 		g_clear_error (&error);
 	}
@@ -512,11 +513,10 @@ dhcp_event_cb (sd_dhcp_client *client, int event, gpointer user_data)
 {
 	NMDhcpSystemd *self = NM_DHCP_SYSTEMD (user_data);
 	NMDhcpSystemdPrivate *priv = NM_DHCP_SYSTEMD_GET_PRIVATE (self);
-	const char *iface = nm_dhcp_client_get_iface (NM_DHCP_CLIENT (self));
 
 	g_assert (priv->client4 == client);
 
-	nm_log_dbg (LOGD_DHCP4, "(%s): DHCPv4 client event %d", iface, event);
+	_LOGD ("client event %d", event);
 
 	switch (event) {
 	case SD_DHCP_CLIENT_EVENT_EXPIRED:
@@ -531,7 +531,7 @@ dhcp_event_cb (sd_dhcp_client *client, int event, gpointer user_data)
 		bound4_handle (self);
 		break;
 	default:
-		nm_log_warn (LOGD_DHCP4, "(%s): unhandled DHCP event %d", iface, event);
+		_LOGW ("unhandled DHCP event %d", event);
 		break;
 	}
 }
@@ -550,7 +550,8 @@ get_arp_type (const GByteArray *hwaddr)
 static gboolean
 ip4_start (NMDhcpClient *client, const char *dhcp_anycast_addr, const char *last_ip4_address)
 {
-	NMDhcpSystemdPrivate *priv = NM_DHCP_SYSTEMD_GET_PRIVATE (client);
+	NMDhcpSystemd *self = NM_DHCP_SYSTEMD (client);
+	NMDhcpSystemdPrivate *priv = NM_DHCP_SYSTEMD_GET_PRIVATE (self);
 	const char *iface = nm_dhcp_client_get_iface (client);
 	const GByteArray *hwaddr;
 	sd_dhcp_lease *lease = NULL;
@@ -571,13 +572,13 @@ ip4_start (NMDhcpClient *client, const char *dhcp_anycast_addr, const char *last
 
 	r = sd_dhcp_client_new (&priv->client4);
 	if (r < 0) {
-		nm_log_warn (LOGD_DHCP4, "(%s): failed to create DHCPv4 client (%d)", iface, r);
+		_LOGW ("failed to create client (%d)", r);
 		return FALSE;
 	}
 
 	r = sd_dhcp_client_attach_event (priv->client4, NULL, 0);
 	if (r < 0) {
-		nm_log_warn (LOGD_DHCP4, "(%s): failed to attach DHCP event (%d)", iface, r);
+		_LOGW ("failed to attach event (%d)", r);
 		goto error;
 	}
 
@@ -585,7 +586,7 @@ ip4_start (NMDhcpClient *client, const char *dhcp_anycast_addr, const char *last
 	if (hwaddr) {
 		arp_type= get_arp_type (hwaddr);
 		if (arp_type == ARPHRD_NONE) {
-			nm_log_warn (LOGD_DHCP4, "(%s): failed to determine ARP type", iface);
+			_LOGW ("failed to determine ARP type");
 			goto error;
 		}
 
@@ -594,26 +595,26 @@ ip4_start (NMDhcpClient *client, const char *dhcp_anycast_addr, const char *last
 		                            hwaddr->len,
 		                            arp_type);
 		if (r < 0) {
-			nm_log_warn (LOGD_DHCP4, "(%s): failed to set DHCP MAC address (%d)", iface, r);
+			_LOGW ("failed to set MAC address (%d)", r);
 			goto error;
 		}
 	}
 
 	r = sd_dhcp_client_set_index (priv->client4, nm_dhcp_client_get_ifindex (client));
 	if (r < 0) {
-		nm_log_warn (LOGD_DHCP4, "(%s): failed to set DHCP ifindex (%d)", iface, r);
+		_LOGW ("failed to set ifindex (%d)", r);
 		goto error;
 	}
 
 	r = sd_dhcp_client_set_callback (priv->client4, dhcp_event_cb, client);
 	if (r < 0) {
-		nm_log_warn (LOGD_DHCP4, "(%s): failed to set DHCP callback (%d)", iface, r);
+		_LOGW ("failed to set callback (%d)", r);
 		goto error;
 	}
 
 	r = sd_dhcp_client_set_request_broadcast (priv->client4, true);
 	if (r < 0) {
-		nm_log_warn (LOGD_DHCP4, "(%s): failed to set DHCP broadcast (%d)", iface, r);
+		_LOGW ("failed to enable broadcast mode (%d)", r);
 		goto error;
 	}
 
@@ -627,7 +628,7 @@ ip4_start (NMDhcpClient *client, const char *dhcp_anycast_addr, const char *last
 	if (last_addr.s_addr) {
 		r = sd_dhcp_client_set_request_address (priv->client4, &last_addr);
 		if (r < 0) {
-			nm_log_warn (LOGD_DHCP4, "(%s): failed to set last IPv4 address (%d)", iface, r);
+			_LOGW ("failed to set last IPv4 address (%d)", r);
 			goto error;
 		}
 	}
@@ -675,7 +676,7 @@ ip4_start (NMDhcpClient *client, const char *dhcp_anycast_addr, const char *last
 		free (prefix);
 
 		if (r < 0) {
-			nm_log_warn (LOGD_DHCP4, "(%s): failed to set DHCP hostname (%d)", iface, r);
+			_LOGW ("failed to set DHCP hostname (%d)", r);
 			goto error;
 		}
 	}
@@ -684,14 +685,14 @@ ip4_start (NMDhcpClient *client, const char *dhcp_anycast_addr, const char *last
 	if (fqdn) {
 		r = sd_dhcp_client_set_hostname (priv->client4, fqdn);
 		if (r < 0) {
-			nm_log_warn (LOGD_DHCP4, "(%s): failed to set DHCP FQDN (%d)", iface, r);
+			_LOGW ("failed to set DHCP FQDN (%d)", r);
 			goto error;
 		}
 	}
 
 	r = sd_dhcp_client_start (priv->client4);
 	if (r < 0) {
-		nm_log_warn (LOGD_DHCP4, "(%s): failed to start DHCP (%d)", iface, r);
+		_LOGW ("failed to start client (%d)", r);
 		goto error;
 	}
 
@@ -706,13 +707,134 @@ error:
 	return success;
 }
 
+static NMIP6Config *
+lease_to_ip6_config (const char *iface,
+                     int ifindex,
+                     sd_dhcp6_lease *lease,
+                     GHashTable *options,
+                     gboolean log_lease,
+                     gboolean info_only,
+                     GError **error)
+{
+	struct in6_addr tmp_addr, *dns;
+	uint32_t lft_pref, lft_valid;
+	NMIP6Config *ip6_config;
+	const char *addr_str;
+	char **domains;
+	GString *str;
+	int num, i;
+	gint32 ts;
+
+	g_return_val_if_fail (lease, NULL);
+	ip6_config = nm_ip6_config_new (ifindex);
+	ts = nm_utils_get_monotonic_timestamp_s ();
+	str = g_string_sized_new (30);
+
+	/* Addresses */
+	sd_dhcp6_lease_reset_address_iter (lease);
+	while (sd_dhcp6_lease_get_address (lease, &tmp_addr, &lft_pref, &lft_valid) >= 0) {
+		NMPlatformIP6Address address = {
+			.plen = 128,
+			.address = tmp_addr,
+			.timestamp = ts,
+			.lifetime = lft_valid,
+			.preferred = lft_pref,
+			.source = NM_IP_CONFIG_SOURCE_DHCP,
+		};
+
+		nm_ip6_config_add_address (ip6_config, &address);
+
+		addr_str = nm_utils_inet6_ntop (&tmp_addr, NULL);
+		g_string_append_printf (str, "%s%s", str->len ? " " : "", addr_str);
+
+		LOG_LEASE (LOGD_DHCP6,
+		           "  address %s",
+		           nm_platform_ip6_address_to_string (&address, NULL, 0));
+	};
+
+	if (str->len) {
+		add_option (options, dhcp6_requests, DHCP6_OPTION_IP_ADDRESS, str->str);
+		g_string_set_size (str , 0);
+	}
+
+	if (!info_only && nm_ip6_config_get_num_addresses (ip6_config) == 0) {
+		g_string_free (str, TRUE);
+		g_object_unref (ip6_config);
+		g_set_error_literal (error,
+		                     NM_MANAGER_ERROR,
+		                     NM_MANAGER_ERROR_FAILED,
+		                     "no address received in managed mode");
+		return NULL;
+	}
+
+	/* DNS servers */
+	num = sd_dhcp6_lease_get_dns (lease, &dns);
+	if (num > 0) {
+		for (i = 0; i < num; i++) {
+			nm_ip6_config_add_nameserver (ip6_config, &dns[i]);
+			addr_str = nm_utils_inet6_ntop (&dns[i], NULL);
+			g_string_append_printf (str, "%s%s", str->len ? " " : "", addr_str);
+			LOG_LEASE (LOGD_DHCP6, "  nameserver %s", addr_str);
+		}
+		add_option (options, dhcp6_requests, SD_DHCP6_OPTION_DNS_SERVERS, str->str);
+		g_string_set_size (str, 0);
+	}
+
+	/* Search domains */
+	num = sd_dhcp6_lease_get_domains (lease, &domains);
+	if (num > 0) {
+		for (i = 0; i < num; i++) {
+			nm_ip6_config_add_search (ip6_config, domains[i]);
+			g_string_append_printf (str, "%s%s", str->len ? " " : "", domains[i]);
+			LOG_LEASE (LOGD_DHCP6, "  domain name '%s'", domains[i]);
+		}
+		add_option (options, dhcp6_requests, SD_DHCP6_OPTION_DOMAIN_LIST, str->str);
+		g_string_set_size (str, 0);
+	}
+
+	g_string_free (str, TRUE);
+
+	return ip6_config;
+}
+
 static void
 bound6_handle (NMDhcpSystemd *self)
 {
-	/* not yet supported... */
-	nm_log_warn (LOGD_DHCP6, "(%s): internal DHCP does not yet support DHCPv6",
-	             nm_dhcp_client_get_iface (NM_DHCP_CLIENT (self)));
-	nm_dhcp_client_set_state (NM_DHCP_CLIENT (self), NM_DHCP_STATE_FAIL, NULL, NULL);
+	NMDhcpSystemdPrivate *priv = NM_DHCP_SYSTEMD_GET_PRIVATE (self);
+	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;
+	gs_free_error GError *error = NULL;
+	sd_dhcp6_lease *lease;
+	int r;
+
+	r = sd_dhcp6_client_get_lease (priv->client6, &lease);
+	if (r < 0 || !lease) {
+		_LOGW (" no lease!");
+		nm_dhcp_client_set_state (NM_DHCP_CLIENT (self), NM_DHCP_STATE_FAIL, NULL, NULL);
+		return;
+	}
+
+	_LOGD ("lease available");
+
+	options = g_hash_table_new_full (g_str_hash, g_str_equal, NULL, g_free);
+	ip6_config = lease_to_ip6_config (iface,
+	                                  nm_dhcp_client_get_ifindex (NM_DHCP_CLIENT (self)),
+	                                  lease,
+	                                  options,
+	                                  TRUE,
+	                                  priv->info_only,
+	                                  &error);
+
+	if (ip6_config) {
+		nm_dhcp_client_set_state (NM_DHCP_CLIENT (self),
+		                          NM_DHCP_STATE_BOUND,
+		                          G_OBJECT (ip6_config),
+		                          options);
+	} else {
+		_LOGW ("%s", error->message);
+		nm_dhcp_client_set_state (NM_DHCP_CLIENT (self), NM_DHCP_STATE_FAIL, NULL, NULL);
+	}
 }
 
 static void
@@ -720,11 +842,10 @@ dhcp6_event_cb (sd_dhcp6_client *client, int event, gpointer user_data)
 {
 	NMDhcpSystemd *self = NM_DHCP_SYSTEMD (user_data);
 	NMDhcpSystemdPrivate *priv = NM_DHCP_SYSTEMD_GET_PRIVATE (self);
-	const char *iface = nm_dhcp_client_get_iface (NM_DHCP_CLIENT (self));
 
 	g_assert (priv->client6 == client);
 
-	nm_log_dbg (LOGD_DHCP6, "(%s): DHCPv6 client event %d", iface, event);
+	_LOGD ("client event %d", event);
 
 	switch (event) {
 	case SD_DHCP6_CLIENT_EVENT_RETRANS_MAX:
@@ -738,7 +859,7 @@ dhcp6_event_cb (sd_dhcp6_client *client, int event, gpointer user_data)
 		bound6_handle (self);
 		break;
 	default:
-		nm_log_warn (LOGD_DHCP6, "(%s): unhandled DHCPv6 event %d", iface, event);
+		_LOGW ("unhandled event %d", event);
 		break;
 	}
 }
@@ -751,7 +872,8 @@ ip6_start (NMDhcpClient *client,
            NMSettingIP6ConfigPrivacy privacy,
            const GByteArray *duid)
 {
-	NMDhcpSystemdPrivate *priv = NM_DHCP_SYSTEMD_GET_PRIVATE (client);
+	NMDhcpSystemd *self = NM_DHCP_SYSTEMD (client);
+	NMDhcpSystemdPrivate *priv = NM_DHCP_SYSTEMD_GET_PRIVATE (self);
 	const char *iface = nm_dhcp_client_get_iface (client);
 	const GByteArray *hwaddr;
 	int r, i;
@@ -762,10 +884,11 @@ ip6_start (NMDhcpClient *client,
 
 	g_free (priv->lease_file);
 	priv->lease_file = get_leasefile_path (iface, nm_dhcp_client_get_uuid (client), TRUE);
+	priv->info_only = info_only;
 
 	r = sd_dhcp6_client_new (&priv->client6);
 	if (r < 0) {
-		nm_log_warn (LOGD_DHCP6, "(%s): failed to create DHCPv6 client (%d)", iface, r);
+		_LOGW ("failed to create client (%d)", r);
 		return FALSE;
 	}
 
@@ -777,13 +900,13 @@ ip6_start (NMDhcpClient *client,
 	                              duid->data + 2,
 	                              duid->len - 2);
 	if (r < 0) {
-		nm_log_warn (LOGD_DHCP6, "(%s): failed to create DHCPv6 client (%d)", iface, r);
+		_LOGW ("failed to set DUID (%d)", r);
 		return FALSE;
 	}
 
 	r = sd_dhcp6_client_attach_event (priv->client6, NULL, 0);
 	if (r < 0) {
-		nm_log_warn (LOGD_DHCP6, "(%s): failed to attach DHCP event (%d)", iface, r);
+		_LOGW ("failed to attach event (%d)", r);
 		goto error;
 	}
 
@@ -794,20 +917,20 @@ ip6_start (NMDhcpClient *client,
 		                             hwaddr->len,
 		                             get_arp_type (hwaddr));
 		if (r < 0) {
-			nm_log_warn (LOGD_DHCP6, "(%s): failed to set DHCP MAC address (%d)", iface, r);
+			_LOGW ("failed to set MAC address (%d)", r);
 			goto error;
 		}
 	}
 
 	r = sd_dhcp6_client_set_index (priv->client6, nm_dhcp_client_get_ifindex (client));
 	if (r < 0) {
-		nm_log_warn (LOGD_DHCP6, "(%s): failed to set DHCP ifindex (%d)", iface, r);
+		_LOGW ("failed to set ifindex (%d)", r);
 		goto error;
 	}
 
 	r = sd_dhcp6_client_set_callback (priv->client6, dhcp6_event_cb, client);
 	if (r < 0) {
-		nm_log_warn (LOGD_DHCP6, "(%s): failed to set DHCP callback (%d)", iface, r);
+		_LOGW ("failed to set callback (%d)", r);
 		goto error;
 	}
 
@@ -819,13 +942,13 @@ ip6_start (NMDhcpClient *client,
 
 	r = sd_dhcp6_client_set_local_address (priv->client6, ll_addr);
 	if (r < 0) {
-		nm_log_warn (LOGD_DHCP6, "(%s): failed to set local address (%d)", iface, r);
+		_LOGW ("failed to set local address (%d)", r);
 		goto error;
 	}
 
 	r = sd_dhcp6_client_start (priv->client6);
 	if (r < 0) {
-		nm_log_warn (LOGD_DHCP6, "(%s): failed to start DHCP (%d)", iface, r);
+		_LOGW ("failed to start client (%d)", r);
 		goto error;
 	}
 
@@ -840,7 +963,8 @@ error:
 static void
 stop (NMDhcpClient *client, gboolean release, const GByteArray *duid)
 {
-	NMDhcpSystemdPrivate *priv = NM_DHCP_SYSTEMD_GET_PRIVATE (client);
+	NMDhcpSystemd *self = NM_DHCP_SYSTEMD (client);
+	NMDhcpSystemdPrivate *priv = NM_DHCP_SYSTEMD_GET_PRIVATE (self);
 	int r = 0;
 
 	if (priv->client4) {
@@ -851,12 +975,8 @@ stop (NMDhcpClient *client, gboolean release, const GByteArray *duid)
 		r = sd_dhcp6_client_stop (priv->client6);
 	}
 
-	if (r) {
-		nm_log_warn (priv->client6 ? LOGD_DHCP6 : LOGD_DHCP4,
-			         "(%s): failed to stop DHCP client (%d)",
-			         nm_dhcp_client_get_iface (client),
-			         r);
-	}
+	if (r)
+		_LOGW ("failed to stop client (%d)", r);
 }
 
 /***************************************************/
diff --git a/src/dhcp-manager/tests/test-dhcp-utils.c b/src/dhcp-manager/tests/test-dhcp-utils.c
index 38051326..162f2dd4 100644
--- a/src/dhcp-manager/tests/test-dhcp-utils.c
+++ b/src/dhcp-manager/tests/test-dhcp-utils.c
@@ -331,7 +331,7 @@ test_dhclient_invalid_classless_routes_1 (void)
 	options = fill_table (generic_options, NULL);
 	options = fill_table (data, options);
 
-	g_test_expect_message ("NetworkManager", G_LOG_LEVEL_WARNING,
+	g_test_expect_message ("NetworkManager", G_LOG_LEVEL_MESSAGE,
 	                       "*ignoring invalid classless static routes*");
 	ip4_config = nm_dhcp_utils_ip4_config_from_options (1, "eth0", options, 0);
 	g_assert (ip4_config);
@@ -362,7 +362,7 @@ test_dhcpcd_invalid_classless_routes_1 (void)
 	options = fill_table (generic_options, NULL);
 	options = fill_table (data, options);
 
-	g_test_expect_message ("NetworkManager", G_LOG_LEVEL_WARNING,
+	g_test_expect_message ("NetworkManager", G_LOG_LEVEL_MESSAGE,
 	                       "*ignoring invalid classless static routes*");
 	ip4_config = nm_dhcp_utils_ip4_config_from_options (1, "eth0", options, 0);
 	g_assert (ip4_config);
@@ -395,7 +395,7 @@ test_dhclient_invalid_classless_routes_2 (void)
 	options = fill_table (generic_options, NULL);
 	options = fill_table (data, options);
 
-	g_test_expect_message ("NetworkManager", G_LOG_LEVEL_WARNING,
+	g_test_expect_message ("NetworkManager", G_LOG_LEVEL_MESSAGE,
 	                       "*ignoring invalid classless static routes*");
 	ip4_config = nm_dhcp_utils_ip4_config_from_options (1, "eth0", options, 0);
 	g_assert (ip4_config);
@@ -428,7 +428,7 @@ test_dhcpcd_invalid_classless_routes_2 (void)
 	options = fill_table (generic_options, NULL);
 	options = fill_table (data, options);
 
-	g_test_expect_message ("NetworkManager", G_LOG_LEVEL_WARNING,
+	g_test_expect_message ("NetworkManager", G_LOG_LEVEL_MESSAGE,
 	                       "*ignoring invalid classless static routes*");
 	ip4_config = nm_dhcp_utils_ip4_config_from_options (1, "eth0", options, 0);
 	g_assert (ip4_config);
@@ -461,7 +461,7 @@ test_dhclient_invalid_classless_routes_3 (void)
 	options = fill_table (generic_options, NULL);
 	options = fill_table (data, options);
 
-	g_test_expect_message ("NetworkManager", G_LOG_LEVEL_WARNING,
+	g_test_expect_message ("NetworkManager", G_LOG_LEVEL_MESSAGE,
 	                       "*ignoring invalid classless static routes*");
 	ip4_config = nm_dhcp_utils_ip4_config_from_options (1, "eth0", options, 0);
 	g_assert (ip4_config);
@@ -489,7 +489,7 @@ test_dhcpcd_invalid_classless_routes_3 (void)
 	options = fill_table (generic_options, NULL);
 	options = fill_table (data, options);
 
-	g_test_expect_message ("NetworkManager", G_LOG_LEVEL_WARNING,
+	g_test_expect_message ("NetworkManager", G_LOG_LEVEL_MESSAGE,
 	                       "*DHCP provided invalid classless static route*");
 	ip4_config = nm_dhcp_utils_ip4_config_from_options (1, "eth0", options, 0);
 	g_assert (ip4_config);
@@ -598,7 +598,7 @@ test_invalid_escaped_domain_searches (void)
 	options = fill_table (generic_options, NULL);
 	options = fill_table (data, options);
 
-	g_test_expect_message ("NetworkManager", G_LOG_LEVEL_WARNING,
+	g_test_expect_message ("NetworkManager", G_LOG_LEVEL_MESSAGE,
 	                       "*invalid domain search*");
 	ip4_config = nm_dhcp_utils_ip4_config_from_options (1, "eth0", options, 0);
 	g_assert (ip4_config);