xref: /freebsd/sys/netinet/in_kdtrace.c (revision b3e7694832e81d7a904a10f525f8797b753bf0d3)
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/cdefs.h>
30 __FBSDID("$FreeBSD$");
31 
32 #include <sys/param.h>
33 #include <sys/systm.h>
34 #include <sys/sdt.h>
35 
36 SDT_PROVIDER_DEFINE(ip);
37 SDT_PROVIDER_DEFINE(tcp);
38 SDT_PROVIDER_DEFINE(udp);
39 SDT_PROVIDER_DEFINE(udplite);
40 
41 SDT_PROBE_DEFINE6_XLATE(ip, , , receive,
42     "void *", "pktinfo_t *",
43     "void *", "csinfo_t *",
44     "uint8_t *", "ipinfo_t *",
45     "struct ifnet *", "ifinfo_t *",
46     "struct ip *", "ipv4info_t *",
47     "struct ip6_hdr *", "ipv6info_t *");
48 
49 SDT_PROBE_DEFINE6_XLATE(ip, , , send,
50     "void *", "pktinfo_t *",
51     "void *", "csinfo_t *",
52     "uint8_t *", "ipinfo_t *",
53     "struct ifnet *", "ifinfo_t *",
54     "struct ip *", "ipv4info_t *",
55     "struct ip6_hdr *", "ipv6info_t *");
56 
57 SDT_PROBE_DEFINE5_XLATE(tcp, , , accept__established,
58     "void *", "pktinfo_t *",
59     "struct tcpcb *", "csinfo_t *",
60     "struct mbuf *", "ipinfo_t *",
61     "struct tcpcb *", "tcpsinfo_t *" ,
62     "struct tcphdr *", "tcpinfoh_t *");
63 
64 SDT_PROBE_DEFINE5_XLATE(tcp, , , accept__refused,
65     "void *", "pktinfo_t *",
66     "struct tcpcb *", "csinfo_t *",
67     "struct mbuf *", "ipinfo_t *",
68     "struct tcpcb *", "tcpsinfo_t *" ,
69     "struct tcphdr *", "tcpinfo_t *");
70 
71 SDT_PROBE_DEFINE5_XLATE(tcp, , , connect__established,
72     "void *", "pktinfo_t *",
73     "struct tcpcb *", "csinfo_t *",
74     "struct mbuf *", "ipinfo_t *",
75     "struct tcpcb *", "tcpsinfo_t *" ,
76     "struct tcphdr *", "tcpinfoh_t *");
77 
78 SDT_PROBE_DEFINE5_XLATE(tcp, , , connect__refused,
79     "void *", "pktinfo_t *",
80     "struct tcpcb *", "csinfo_t *",
81     "struct mbuf *", "ipinfo_t *",
82     "struct tcpcb *", "tcpsinfo_t *" ,
83     "struct tcphdr *", "tcpinfoh_t *");
84 
85 SDT_PROBE_DEFINE5_XLATE(tcp, , , connect__request,
86     "void *", "pktinfo_t *",
87     "struct tcpcb *", "csinfo_t *",
88     "uint8_t *", "ipinfo_t *",
89     "struct tcpcb *", "tcpsinfo_t *" ,
90     "struct tcphdr *", "tcpinfo_t *");
91 
92 SDT_PROBE_DEFINE5_XLATE(tcp, , , receive,
93     "void *", "pktinfo_t *",
94     "struct tcpcb *", "csinfo_t *",
95     "struct mbuf *", "ipinfo_t *",
96     "struct tcpcb *", "tcpsinfo_t *" ,
97     "struct tcphdr *", "tcpinfoh_t *");
98 
99 SDT_PROBE_DEFINE5_XLATE(tcp, , , send,
100     "void *", "pktinfo_t *",
101     "struct tcpcb *", "csinfo_t *",
102     "uint8_t *", "ipinfo_t *",
103     "struct tcpcb *", "tcpsinfo_t *" ,
104     "struct tcphdr *", "tcpinfo_t *");
105 
106 SDT_PROBE_DEFINE1_XLATE(tcp, , , siftr,
107     "struct pkt_node *", "siftrinfo_t *");
108 
109 SDT_PROBE_DEFINE3_XLATE(tcp, , , debug__input,
110     "struct tcpcb *", "tcpsinfo_t *" ,
111     "struct tcphdr *", "tcpinfoh_t *",
112     "struct mbuf *", "ipinfo_t *");
113 
114 SDT_PROBE_DEFINE3_XLATE(tcp, , , debug__output,
115     "struct tcpcb *", "tcpsinfo_t *" ,
116     "struct tcphdr *", "tcpinfo_t *",
117     "struct mbuf *", "ipinfo_t *");
118 
119 SDT_PROBE_DEFINE2_XLATE(tcp, , , debug__user,
120     "struct tcpcb *", "tcpsinfo_t *" ,
121     "int", "int");
122 
123 SDT_PROBE_DEFINE3_XLATE(tcp, , , debug__drop,
124     "struct tcpcb *", "tcpsinfo_t *" ,
125     "struct tcphdr *", "tcpinfoh_t *",
126     "struct mbuf *", "ipinfo_t *");
127 
128 SDT_PROBE_DEFINE6_XLATE(tcp, , , state__change,
129     "void *", "void *",
130     "struct tcpcb *", "csinfo_t *",
131     "void *", "void *",
132     "struct tcpcb *", "tcpsinfo_t *",
133     "void *", "void *",
134     "int", "tcplsinfo_t *");
135 
136 SDT_PROBE_DEFINE6_XLATE(tcp, , , receive__autoresize,
137     "void *", "void *",
138     "struct tcpcb *", "csinfo_t *",
139     "struct mbuf *", "ipinfo_t *",
140     "struct tcpcb *", "tcpsinfo_t *" ,
141     "struct tcphdr *", "tcpinfoh_t *",
142     "int", "int");
143 
144 SDT_PROBE_DEFINE5_XLATE(udp, , , receive,
145     "void *", "pktinfo_t *",
146     "struct inpcb *", "csinfo_t *",
147     "uint8_t *", "ipinfo_t *",
148     "struct inpcb *", "udpsinfo_t *",
149     "struct udphdr *", "udpinfo_t *");
150 
151 SDT_PROBE_DEFINE5_XLATE(udp, , , send,
152     "void *", "pktinfo_t *",
153     "struct inpcb *", "csinfo_t *",
154     "uint8_t *", "ipinfo_t *",
155     "struct inpcb *", "udpsinfo_t *",
156     "struct udphdr *", "udpinfo_t *");
157 
158 SDT_PROBE_DEFINE5_XLATE(udplite, , , receive,
159     "void *", "pktinfo_t *",
160     "struct inpcb *", "csinfo_t *",
161     "uint8_t *", "ipinfo_t *",
162     "struct inpcb *", "udplitesinfo_t *",
163     "struct udphdr *", "udpliteinfo_t *");
164 
165 SDT_PROBE_DEFINE5_XLATE(udplite, , , send,
166     "void *", "pktinfo_t *",
167     "struct inpcb *", "csinfo_t *",
168     "uint8_t *", "ipinfo_t *",
169     "struct inpcb *", "udplitesinfo_t *",
170     "struct udphdr *", "udpliteinfo_t *");
171