lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [day] [month] [year] [list]
Date:   Mon, 14 Feb 2022 15:53:04 -0300
From:   Thiago Rafael Becker <trbecker@...il.com>
To:     netdev@...r.kernel.org
Cc:     Jakub Kicinski <kuba@...nel.org>,
        "David S. Miller" <davem@...emloft.net>,
        Ingo Molnar <mingo@...hat.com>,
        Steven Rostedt <rostedt@...dmis.org>, dhowells@...hat.com,
        Thiago Rafael Becker <trbecker@...il.com>
Subject: [PATCH] dns_resolver: Add dns_query tracing

Signed-off-by: Thiago Rafael Becker <trbecker@...il.com>
---
 include/trace/events/dns_resolver.h | 39 +++++++++++++++++++++++++++++
 net/dns_resolver/dns_query.c        |  5 ++++
 2 files changed, 44 insertions(+)
 create mode 100644 include/trace/events/dns_resolver.h

diff --git a/include/trace/events/dns_resolver.h b/include/trace/events/dns_resolver.h
new file mode 100644
index 000000000000..c733e61ccd1e
--- /dev/null
+++ b/include/trace/events/dns_resolver.h
@@ -0,0 +1,39 @@
+/* SPDX-License-Identifier: GPL-2.0 */
+#undef TRACE_SYSTEM
+#define TRACE_SYSTEM dns_resolver
+
+#if !defined(_TRACE_DNS_RESOLVER_H) || defined(TRACE_HEADER_MULTI_READ)
+#define _TRACE_DNS_RESOLVER_H
+
+#include <linux/tracepoint.h>
+
+TRACE_EVENT(dns_query,
+	TP_PROTO(
+		const char *type,
+		const char *name,
+		size_t namelen,
+		const char *options
+	),
+
+	TP_ARGS(type, name, namelen, options),
+
+	TP_STRUCT__entry(
+		__string(type, type)
+		__string_len(name, name, namelen)
+		__string(options, options)
+	),
+
+	TP_fast_assign(
+		__assign_str(type, type);
+		__assign_str_len(name, name, namelen);
+		__assign_str(options, options);
+	),
+
+	TP_printk("t=%s n=%s o=%s",
+		__get_str(type), __get_str(name), __get_str(options))
+);
+
+#endif /* _TRACE_DNS_RESOLVER_H */
+
+/* This part must be outside protection */
+#include <trace/define_trace.h>
diff --git a/net/dns_resolver/dns_query.c b/net/dns_resolver/dns_query.c
index 82b084cc1cc6..610938dfbf6b 100644
--- a/net/dns_resolver/dns_query.c
+++ b/net/dns_resolver/dns_query.c
@@ -47,6 +47,9 @@
 
 #include "internal.h"
 
+#define CREATE_TRACE_POINTS
+#include <trace/events/dns_resolver.h>
+
 /**
  * dns_query - Query the DNS
  * @net: The network namespace to operate in.
@@ -86,6 +89,8 @@ int dns_query(struct net *net,
 	kenter("%s,%*.*s,%zu,%s",
 	       type, (int)namelen, (int)namelen, name, namelen, options);
 
+	trace_dns_query(type, name, namelen, options);
+
 	if (!name || namelen == 0)
 		return -EINVAL;
 
-- 
2.31.1

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ