Debian Codegraph @

tapset/linux/udp.stp

raw
1 // UDP tapset
2 // Copyright (C) 2006 Intel Corporation.
3 // Copyright (C) 2013 Red Hat, Inc.
4 //
5 // This file is part of systemtap, and is free software. You can
6 // redistribute it and/or modify it under the terms of the GNU General
7 // Public License (GPL); either version 2, or (at your option) any
8 // later version.
9 // <tapsetdescription>
10 // This family of probe points is used to probe events that occur in the UDP layer.
11 // </tapsetdescription>
12
13 /* Helper functions analogous (or even identical) those in tcp.stp */
14 @__private30 function __get_skb_udphdr:long (skb:long) { return __get_skb_tcphdr(skb) }
15 @__private30 function __udp_sock_sport (sock) { return __tcp_sock_sport (sock) }
16 @__private30 function __udp_sock_dport (sock) { return __tcp_sock_dport (sock) }
17
18 @__private30 function __udp_skb_dport(udphdr) { return ntohs(@cast(udphdr, "udphdr")->dest) }
19 @__private30 function __udp_skb_sport(udphdr) { return ntohs(@cast(udphdr, "udphdr")->source) }
20
21
22
23
24
25 /**
26 * probe udp.sendmsg - Fires whenever a process sends a UDP message
27 * @name: The name of this probe
28 * @sock: Network socket used by the process
29 * @size: Number of bytes sent by the process
30 * @family: IP address family
31 * @saddr: A string representing the source IP address
32 * @daddr: A string representing the destination IP address
33 * @sport: UDP source port
34 * @dport: UDP destination port
35 *
36 * Context:
37 * The process which sent a UDP message
38 */
39 probe udp.sendmsg = kernel.function("udp_sendmsg") {
40 name = "udp.sendmsg"
41 sock = $sk
42 size = $len
43 %( systemtap_v >= "2.3" %?
44 family = __ip_sock_family($sk)
45 saddr = format_ipaddr(__ip_sock_saddr($sk), __ip_sock_family($sk))
46 daddr = format_ipaddr(__ip_sock_daddr($sk), __ip_sock_family($sk))
47 sport = __udp_sock_sport($sk)
48 dport = __udp_sock_dport($sk)
49 %)
50 }
51
52 /**
53 * probe udp.sendmsg.return - Fires whenever an attempt to send a UDP message is completed
54 * @name: The name of this probe
55 * @size: Number of bytes sent by the process
56 *
57 * Context:
58 * The process which sent a UDP message
59 */
60 probe udp.sendmsg.return = kernel.function("udp_sendmsg").return {
61 name = "udp.sendmsg"
62 size = $return
63 %( systemtap_v >= "2.3" %?
64 family = __ip_sock_family(@entry($sk))
65 saddr = format_ipaddr(__ip_sock_saddr(@entry($sk)), __ip_sock_family(@entry($sk)))
66 daddr = format_ipaddr(__ip_sock_daddr(@entry($sk)), __ip_sock_family(@entry($sk)))
67 sport = __udp_sock_sport(@entry($sk))
68 dport = __udp_sock_dport(@entry($sk))
69 %)
70 }
71
72 /**
73 * probe udp.recvmsg - Fires whenever a UDP message is received
74 * @name: The name of this probe
75 * @sock: Network socket used by the process
76 * @size: Number of bytes received by the process
77 * @family: IP address family
78 * @saddr: A string representing the source IP address
79 * @daddr: A string representing the destination IP address
80 * @sport: UDP source port
81 * @dport: UDP destination port
82 *
83 * Context:
84 * The process which received a UDP message
85 */
86 probe udp.recvmsg = kernel.function("udp_recvmsg") {
87 name = "udp.recvmsg"
88 sock = $sk
89 size = $len
90 %( systemtap_v >= "2.3" %?
91 family = __ip_sock_family($sk)
92 saddr = format_ipaddr(__ip_sock_saddr($sk), __ip_sock_family($sk))
93 daddr = format_ipaddr(__ip_sock_daddr($sk), __ip_sock_family($sk))
94 sport = __udp_sock_sport($sk)
95 dport = __udp_sock_dport($sk)
96 %)
97 }
98
99 /**
100 * probe udp.recvmsg.return - Fires whenever an attempt to receive a UDP message received is completed
101 * @name: The name of this probe
102 * @size: Number of bytes received by the process
103 * @family: IP address family
104 * @saddr: A string representing the source IP address
105 * @daddr: A string representing the destination IP address
106 * @sport: UDP source port
107 * @dport: UDP destination port
108 *
109 * Context:
110 * The process which received a UDP message
111 */
112 probe udp.recvmsg.return = kernel.function("udp_recvmsg").return {
113 name = "udp.recvmsg"
114 size = $return
115 %( systemtap_v >= "2.3" %?
116 family = __ip_sock_family(@entry($sk))
117 saddr = format_ipaddr(__ip_sock_saddr(@entry($sk)), __ip_sock_family(@entry($sk)))
118 daddr = format_ipaddr(__ip_sock_daddr(@entry($sk)), __ip_sock_family(@entry($sk)))
119 sport = __udp_sock_sport(@entry($sk))
120 dport = __udp_sock_dport(@entry($sk))
121 %)
122 }
123
124 /**
125 * probe udp.disconnect - Fires when a process requests for a UDP disconnection
126 * @name: The name of this probe
127 * @sock: Network socket used by the process
128 * @flags: Flags (e.g. FIN, etc)
129 * @family: IP address family
130 * @saddr: A string representing the source IP address
131 * @daddr: A string representing the destination IP address
132 * @sport: UDP source port
133 * @dport: UDP destination port
134 *
135 * Context:
136 * The process which requests a UDP disconnection
137 */
138 probe udp.disconnect = kernel.function("udp_disconnect") {
139 name = "udp.disconnect"
140 sock = $sk
141 flags = $flags
142 %( systemtap_v >= "2.3" %?
143 family = __ip_sock_family($sk)
144 saddr = format_ipaddr(__ip_sock_saddr($sk), __ip_sock_family($sk))
145 daddr = format_ipaddr(__ip_sock_daddr($sk), __ip_sock_family($sk))
146 sport = __udp_sock_sport($sk)
147 dport = __udp_sock_dport($sk)
148 %)
149 }
150
151 /**
152 * probe udp.disconnect.return - UDP has been disconnected successfully
153 * @name: The name of this probe
154 * @ret: Error code (0: no error)
155 * @family: IP address family
156 * @saddr: A string representing the source IP address
157 * @daddr: A string representing the destination IP address
158 * @sport: UDP source port
159 * @dport: UDP destination port
160 *
161 * Context:
162 * The process which requested a UDP disconnection
163 */
164 probe udp.disconnect.return = kernel.function("udp_disconnect").return {
165 name = "udp.disconnect"
166 ret = $return
167 %( systemtap_v >= "2.3" %?
168 family = __ip_sock_family(@entry($sk))
169 saddr = format_ipaddr(__ip_sock_saddr(@entry($sk)), __ip_sock_family(@entry($sk)))
170 daddr = format_ipaddr(__ip_sock_daddr(@entry($sk)), __ip_sock_family(@entry($sk)))
171 sport = __udp_sock_sport(@entry($sk))
172 dport = __udp_sock_dport(@entry($sk))
173 %)
174 }