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: stable/11/sys/netinet/in_kdtrace.c 328660 2018-02-01 14:36:24Z markj $
27 */
28
29#include <sys/cdefs.h>
30__FBSDID("$FreeBSD: stable/11/sys/netinet/in_kdtrace.c 328660 2018-02-01 14:36:24Z markj $");
31
32#include <sys/param.h>
33#include <sys/systm.h>
34#include <sys/sdt.h>
35
36SDT_PROVIDER_DEFINE(ip);
37SDT_PROVIDER_DEFINE(tcp);
38SDT_PROVIDER_DEFINE(udp);
39
40SDT_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
48SDT_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
56SDT_PROBE_DEFINE5_XLATE(tcp, , , accept__established,
57    "void *", "pktinfo_t *",
58    "struct tcpcb *", "csinfo_t *",
59    "struct mbuf *", "ipinfo_t *",
60    "struct tcpcb *", "tcpsinfo_t *" ,
61    "struct tcphdr *", "tcpinfoh_t *");
62
63SDT_PROBE_DEFINE5_XLATE(tcp, , , accept__refused,
64    "void *", "pktinfo_t *",
65    "struct tcpcb *", "csinfo_t *",
66    "struct mbuf *", "ipinfo_t *",
67    "struct tcpcb *", "tcpsinfo_t *" ,
68    "struct tcphdr *", "tcpinfo_t *");
69
70SDT_PROBE_DEFINE5_XLATE(tcp, , , connect__established,
71    "void *", "pktinfo_t *",
72    "struct tcpcb *", "csinfo_t *",
73    "struct mbuf *", "ipinfo_t *",
74    "struct tcpcb *", "tcpsinfo_t *" ,
75    "struct tcphdr *", "tcpinfoh_t *");
76
77SDT_PROBE_DEFINE5_XLATE(tcp, , , connect__refused,
78    "void *", "pktinfo_t *",
79    "struct tcpcb *", "csinfo_t *",
80    "struct mbuf *", "ipinfo_t *",
81    "struct tcpcb *", "tcpsinfo_t *" ,
82    "struct tcphdr *", "tcpinfoh_t *");
83
84SDT_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
91SDT_PROBE_DEFINE5_XLATE(tcp, , , receive,
92    "void *", "pktinfo_t *",
93    "struct tcpcb *", "csinfo_t *",
94    "struct mbuf *", "ipinfo_t *",
95    "struct tcpcb *", "tcpsinfo_t *" ,
96    "struct tcphdr *", "tcpinfoh_t *");
97
98SDT_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
105SDT_PROBE_DEFINE1_XLATE(tcp, , , siftr,
106    "struct pkt_node *", "siftrinfo_t *");
107
108SDT_PROBE_DEFINE3_XLATE(tcp, , , debug__input,
109    "struct tcpcb *", "tcpsinfo_t *" ,
110    "struct tcphdr *", "tcpinfoh_t *",
111    "uint8_t *", "ipinfo_t *");
112
113SDT_PROBE_DEFINE3_XLATE(tcp, , , debug__output,
114    "struct tcpcb *", "tcpsinfo_t *" ,
115    "struct tcphdr *", "tcpinfo_t *",
116    "struct mbuf *", "ipinfo_t *");
117
118SDT_PROBE_DEFINE2_XLATE(tcp, , , debug__user,
119    "struct tcpcb *", "tcpsinfo_t *" ,
120    "int", "int");
121
122SDT_PROBE_DEFINE3_XLATE(tcp, , , debug__drop,
123    "struct tcpcb *", "tcpsinfo_t *" ,
124    "struct tcphdr *", "tcpinfoh_t *",
125    "struct mbuf *", "ipinfo_t *");
126
127SDT_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
135SDT_PROBE_DEFINE6_XLATE(tcp, , , receive__autoresize,
136    "void *", "void *",
137    "struct tcpcb *", "csinfo_t *",
138    "struct mbuf *", "ipinfo_t *",
139    "struct tcpcb *", "tcpsinfo_t *" ,
140    "struct tcphdr *", "tcpinfoh_t *",
141    "int", "int");
142
143SDT_PROBE_DEFINE5_XLATE(udp, , , receive,
144    "void *", "pktinfo_t *",
145    "struct inpcb *", "csinfo_t *",
146    "uint8_t *", "ipinfo_t *",
147    "struct inpcb *", "udpsinfo_t *",
148    "struct udphdr *", "udpinfo_t *");
149
150SDT_PROBE_DEFINE5_XLATE(udp, , , send,
151    "void *", "pktinfo_t *",
152    "struct inpcb *", "csinfo_t *",
153    "uint8_t *", "ipinfo_t *",
154    "struct inpcb *", "udpsinfo_t *",
155    "struct udphdr *", "udpinfo_t *");
156