dns_resolver: Add dns_query tracing
Subsystems (3)
PATCH 1/1 dns_resolver: Add dns_query tracing
Signed-off-by Thiago Rafael Becker <[email protected]>
--- 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
include/trace/events/dns_resolver.h new file +39 -0
@@ -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>
net/dns_resolver/dns_query.c +5 -0
@@ -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 ;
Signature · 1 line
2.31.1