summaryrefslogtreecommitdiffstats
path: root/meta/recipes-kernel/lttng/lttng-modules/0003-fix-net-udp-add-IP-port-data-to-the-tracepoint-udp-u.patch
blob: ab28f870c5b805123f66d2ebba9b60800efd3ad0 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
From 4ae0d960e149d1205d0cc167e44c120148c7f4f0 Mon Sep 17 00:00:00 2001
From: Michael Jeanson <mjeanson@efficios.com>
Date: Mon, 27 May 2024 11:11:21 -0400
Subject: [PATCH 3/3] fix: net: udp: add IP/port data to the tracepoint
 udp/udp_fail_queue_rcv_skb (v6.10)

See upstream commit:

  commit e9669a00bba79442dd4862c57761333d6a020c24
  Author: Balazs Scheidler <bazsi77@gmail.com>
  Date:   Tue Mar 26 19:05:47 2024 +0100

    net: udp: add IP/port data to the tracepoint udp/udp_fail_queue_rcv_skb

    The udp_fail_queue_rcv_skb() tracepoint lacks any details on the source
    and destination IP/port whereas this information can be critical in case
    of UDP/syslog.

Upstream-Status: Backport [4ae0d960 fix: net: udp: add IP/port data to the tracepoint udp/udp_fail_queue_rcv_skb (v6.10)]

Change-Id: I0c337c5817b0a120298cbf5088d60671d9625b0d
Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
---
 include/instrumentation/events/udp.h | 30 ++++++++++++++++++++++++++++
 1 file changed, 30 insertions(+)

diff --git a/include/instrumentation/events/udp.h b/include/instrumentation/events/udp.h
index b63a1bb5..0a94b466 100644
--- a/include/instrumentation/events/udp.h
+++ b/include/instrumentation/events/udp.h
@@ -7,7 +7,36 @@
 
 #include <lttng/tracepoint-event.h>
 #include <linux/udp.h>
+#include <lttng/kernel-version.h>
 
+#if (LTTNG_LINUX_VERSION_CODE >= LTTNG_KERNEL_VERSION(6,10,0))
+LTTNG_TRACEPOINT_ENUM(lttng_sk_family,
+	TP_ENUM_VALUES(
+		ctf_enum_value("AF_INET", AF_INET)
+		ctf_enum_value("AF_INET6", AF_INET6)
+	)
+)
+
+LTTNG_TRACEPOINT_EVENT(udp_fail_queue_rcv_skb,
+
+	TP_PROTO(int rc, struct sock *sk, struct sk_buff *skb),
+
+	TP_ARGS(rc, sk, skb),
+
+	TP_FIELDS(
+		ctf_integer(int, rc, rc)
+		ctf_integer(__u16, sport, ntohs(udp_hdr(skb)->source))
+		ctf_integer(__u16, dport, ntohs(udp_hdr(skb)->dest))
+		ctf_enum(lttng_sk_family, __u16, family, sk->sk_family)
+		/*
+		 * The 'saddr' and 'daddr' fields from the upstream tracepoint
+		 * are currently not extracted. It is recommended to use a
+		 * tracepoint from the 'net' probe instead which includes all
+		 * fields from the IP header.
+		 */
+	)
+)
+#else
 LTTNG_TRACEPOINT_EVENT(udp_fail_queue_rcv_skb,
 
 	TP_PROTO(int rc, struct sock *sk),
@@ -19,6 +48,7 @@ LTTNG_TRACEPOINT_EVENT(udp_fail_queue_rcv_skb,
 		ctf_integer(__u16, lport, inet_sk(sk)->inet_num)
 	)
 )
+#endif
 
 #endif /* LTTNG_TRACE_UDP_H */
 
-- 
2.39.2