xref: /freebsd/sys/netinet/in_kdtrace.c (revision 8312a902f98c8a1d991bcee86acbff2abc218d58)
1 /*-
2  * SPDX-License-Identifier: BSD-2-Clause
3  *
4  * Copyright (c) 2013 Mark Johnston <markj@FreeBSD.org>
5  *
6  * Redistribution and use in source and binary forms, with or without
7  * modification, are permitted provided that the following conditions are
8  * met:
9  * 1. Redistributions of source code must retain the above copyright
10  *    notice, this list of conditions and the following disclaimer.
11  * 2. Redistributions in binary form must reproduce the above copyright
12  *    notice, this list of conditions and the following disclaimer in
13  *    the documentation and/or other materials provided with the
14  *    distribution.
15  *
16  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
17  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
18  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
19  * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
20  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
21  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
22  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
23  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
24  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
25  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
26  * SUCH DAMAGE.
27  */
28 
29 #include <sys/param.h>
30 #include <sys/systm.h>
31 #include <sys/sdt.h>
32 
33 SDT_PROVIDER_DEFINE(ip);
34 SDT_PROVIDER_DEFINE(tcp);
35 SDT_PROVIDER_DEFINE(udp);
36 SDT_PROVIDER_DEFINE(udplite);
37 
38 SDT_PROBE_DEFINE6_XLATE(ip, , , receive,
39     "void *", "pktinfo_t *",
40     "void *", "csinfo_t *",
41     "uint8_t *", "ipinfo_t *",
42     "struct ifnet *", "ifinfo_t *",
43     "struct ip *", "ipv4info_t *",
44     "struct ip6_hdr *", "ipv6info_t *");
45 
46 SDT_PROBE_DEFINE6_XLATE(ip, , , send,
47     "void *", "pktinfo_t *",
48     "void *", "csinfo_t *",
49     "uint8_t *", "ipinfo_t *",
50     "struct ifnet *", "ifinfo_t *",
51     "struct ip *", "ipv4info_t *",
52     "struct ip6_hdr *", "ipv6info_t *");
53 
54 SDT_PROBE_DEFINE5_XLATE(tcp, , , accept__established,
55     "void *", "pktinfo_t *",
56     "struct tcpcb *", "csinfo_t *",
57     "struct mbuf *", "ipinfo_t *",
58     "struct tcpcb *", "tcpsinfo_t *" ,
59     "struct tcphdr *", "tcpinfoh_t *");
60 
61 SDT_PROBE_DEFINE5_XLATE(tcp, , , accept__refused,
62     "void *", "pktinfo_t *",
63     "struct tcpcb *", "csinfo_t *",
64     "struct mbuf *", "ipinfo_t *",
65     "struct tcpcb *", "tcpsinfo_t *" ,
66     "struct tcphdr *", "tcpinfo_t *");
67 
68 SDT_PROBE_DEFINE5_XLATE(tcp, , , connect__established,
69     "void *", "pktinfo_t *",
70     "struct tcpcb *", "csinfo_t *",
71     "struct mbuf *", "ipinfo_t *",
72     "struct tcpcb *", "tcpsinfo_t *" ,
73     "struct tcphdr *", "tcpinfoh_t *");
74 
75 SDT_PROBE_DEFINE5_XLATE(tcp, , , connect__refused,
76     "void *", "pktinfo_t *",
77     "struct tcpcb *", "csinfo_t *",
78     "struct mbuf *", "ipinfo_t *",
79     "struct tcpcb *", "tcpsinfo_t *" ,
80     "struct tcphdr *", "tcpinfoh_t *");
81 
82 SDT_PROBE_DEFINE5_XLATE(tcp, , , connect__request,
83     "void *", "pktinfo_t *",
84     "struct tcpcb *", "csinfo_t *",
85     "uint8_t *", "ipinfo_t *",
86     "struct tcpcb *", "tcpsinfo_t *" ,
87     "struct tcphdr *", "tcpinfo_t *");
88 
89 SDT_PROBE_DEFINE5_XLATE(tcp, , , receive,
90     "void *", "pktinfo_t *",
91     "struct tcpcb *", "csinfo_t *",
92     "struct mbuf *", "ipinfo_t *",
93     "struct tcpcb *", "tcpsinfo_t *" ,
94     "struct tcphdr *", "tcpinfoh_t *");
95 
96 SDT_PROBE_DEFINE5_XLATE(tcp, , , send,
97     "void *", "pktinfo_t *",
98     "struct tcpcb *", "csinfo_t *",
99     "uint8_t *", "ipinfo_t *",
100     "struct tcpcb *", "tcpsinfo_t *" ,
101     "struct tcphdr *", "tcpinfo_t *");
102 
103 SDT_PROBE_DEFINE1_XLATE(tcp, , , siftr,
104     "struct pkt_node *", "siftrinfo_t *");
105 
106 SDT_PROBE_DEFINE3_XLATE(tcp, , , debug__input,
107     "struct tcpcb *", "tcpsinfo_t *" ,
108     "struct tcphdr *", "tcpinfoh_t *",
109     "struct mbuf *", "ipinfo_t *");
110 
111 SDT_PROBE_DEFINE3_XLATE(tcp, , , debug__output,
112     "struct tcpcb *", "tcpsinfo_t *" ,
113     "struct tcphdr *", "tcpinfo_t *",
114     "struct mbuf *", "ipinfo_t *");
115 
116 SDT_PROBE_DEFINE2_XLATE(tcp, , , debug__user,
117     "struct tcpcb *", "tcpsinfo_t *" ,
118     "int", "int");
119 
120 SDT_PROBE_DEFINE3_XLATE(tcp, , , debug__drop,
121     "struct tcpcb *", "tcpsinfo_t *" ,
122     "struct tcphdr *", "tcpinfoh_t *",
123     "struct mbuf *", "ipinfo_t *");
124 
125 SDT_PROBE_DEFINE6_XLATE(tcp, , , state__change,
126     "void *", "void *",
127     "struct tcpcb *", "csinfo_t *",
128     "void *", "void *",
129     "struct tcpcb *", "tcpsinfo_t *",
130     "void *", "void *",
131     "int", "tcplsinfo_t *");
132 
133 SDT_PROBE_DEFINE6_XLATE(tcp, , , receive__autoresize,
134     "void *", "void *",
135     "struct tcpcb *", "csinfo_t *",
136     "struct mbuf *", "ipinfo_t *",
137     "struct tcpcb *", "tcpsinfo_t *" ,
138     "struct tcphdr *", "tcpinfoh_t *",
139     "int", "int");
140 
141 SDT_PROBE_DEFINE5_XLATE(udp, , , receive,
142     "void *", "pktinfo_t *",
143     "struct inpcb *", "csinfo_t *",
144     "uint8_t *", "ipinfo_t *",
145     "struct inpcb *", "udpsinfo_t *",
146     "struct udphdr *", "udpinfo_t *");
147 
148 SDT_PROBE_DEFINE5_XLATE(udp, , , send,
149     "void *", "pktinfo_t *",
150     "struct inpcb *", "csinfo_t *",
151     "uint8_t *", "ipinfo_t *",
152     "struct inpcb *", "udpsinfo_t *",
153     "struct udphdr *", "udpinfo_t *");
154 
155 SDT_PROBE_DEFINE5_XLATE(udplite, , , receive,
156     "void *", "pktinfo_t *",
157     "struct inpcb *", "csinfo_t *",
158     "uint8_t *", "ipinfo_t *",
159     "struct inpcb *", "udplitesinfo_t *",
160     "struct udphdr *", "udpliteinfo_t *");
161 
162 SDT_PROBE_DEFINE5_XLATE(udplite, , , send,
163     "void *", "pktinfo_t *",
164     "struct inpcb *", "csinfo_t *",
165     "uint8_t *", "ipinfo_t *",
166     "struct inpcb *", "udplitesinfo_t *",
167     "struct udphdr *", "udpliteinfo_t *");
168