about summary refs log tree commit diff
path: root/src/dhcp/nm-dhcp-client-logging.h
diff options
context:
space:
mode:
authorMichael Biebl <biebl@debian.org>2017-11-07 00:15:27 +0100
committerMichael Biebl <biebl@debian.org>2017-11-07 00:15:27 +0100
commit8254edbf64d60bef0d70eee01490103148dba100 (patch)
tree282eb053995da653ee170e910da05d9530d4ff53 /src/dhcp/nm-dhcp-client-logging.h
parent857e5310d1764114da056cd2eb3d88625bb0ba81 (diff)
parent90e8691111889a7b5f3c812f5a41f15a8a058913 (diff)
Update upstream source from tag 'upstream/1.9.90'
Update to upstream version '1.9.90'
with Debian dir 83533c23245795edf9fe4919e4af3e78f2938519
Diffstat (limited to 'src/dhcp/nm-dhcp-client-logging.h')
-rw-r--r--src/dhcp/nm-dhcp-client-logging.h21
1 files changed, 18 insertions, 3 deletions
diff --git a/src/dhcp/nm-dhcp-client-logging.h b/src/dhcp/nm-dhcp-client-logging.h
index 1047a7d7..1ed47170 100644
--- a/src/dhcp/nm-dhcp-client-logging.h
+++ b/src/dhcp/nm-dhcp-client-logging.h
@@ -23,6 +23,23 @@
 
 #include "nm-dhcp-client.h"
 
+static inline NMLogDomain
+_nm_dhcp_client_get_domain (NMDhcpClient *self)
+{
+	if (self) {
+		switch (nm_dhcp_client_get_addr_family (self)) {
+		case AF_INET:
+			return LOGD_DHCP4;
+		case AF_INET6:
+			return LOGD_DHCP6;
+		default:
+			nm_assert_not_reached ();
+			break;
+		}
+	}
+	return LOGD_DHCP;
+}
+
 #define _NMLOG_PREFIX_NAME    "dhcp"
 #define _NMLOG_DOMAIN         LOGD_DHCP
 #define _NMLOG(level, ...) \
@@ -38,9 +55,7 @@
         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); \
+            const NMLogDomain _domain = _nm_dhcp_client_get_domain (_self); \
             \
             nm_log (_level, _domain, __ifname, NULL, \
                     "%s%s%s%s%s: " _NM_UTILS_MACRO_FIRST (__VA_ARGS__), \