* [PATCH] dns_resolver: Add dns_query tracing
@ 2022-02-14 18:53 Thiago Rafael Becker
0 siblings, 0 replies; only message in thread
From: Thiago Rafael Becker @ 2022-02-14 18:53 UTC (permalink / raw)
To: netdev
Cc: Jakub Kicinski, David S. Miller, Ingo Molnar, Steven Rostedt,
dhowells, Thiago Rafael Becker
Signed-off-by: Thiago Rafael Becker <trbecker@gmail.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
^ permalink raw reply related [flat|nested] only message in thread
only message in thread, other threads:[~2022-02-14 20:14 UTC | newest]
Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-02-14 18:53 [PATCH] dns_resolver: Add dns_query tracing Thiago Rafael Becker
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).