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