1254889Smarkj/*-
2254889Smarkj * Copyright (c) 2013 Mark Johnston <markj@FreeBSD.org>
3254889Smarkj *
4254889Smarkj * Redistribution and use in source and binary forms, with or without
5254889Smarkj * modification, are permitted provided that the following conditions are
6254889Smarkj * met:
7254889Smarkj * 1. Redistributions of source code must retain the above copyright
8254889Smarkj *    notice, this list of conditions and the following disclaimer.
9254889Smarkj * 2. Redistributions in binary form must reproduce the above copyright
10254889Smarkj *    notice, this list of conditions and the following disclaimer in
11254889Smarkj *    the documentation and/or other materials provided with the
12254889Smarkj *    distribution.
13254889Smarkj *
14254889Smarkj * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
15254889Smarkj * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
16254889Smarkj * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
17254889Smarkj * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
18254889Smarkj * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
19254889Smarkj * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
20254889Smarkj * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
21254889Smarkj * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
22254889Smarkj * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
23254889Smarkj * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
24254889Smarkj * SUCH DAMAGE.
25254889Smarkj *
26254889Smarkj * $FreeBSD: stable/10/sys/netinet/in_kdtrace.c 318438 2017-05-18 03:32:01Z smh $
27254889Smarkj */
28254889Smarkj
29254889Smarkj#include <sys/cdefs.h>
30254889Smarkj__FBSDID("$FreeBSD: stable/10/sys/netinet/in_kdtrace.c 318438 2017-05-18 03:32:01Z smh $");
31254889Smarkj
32254889Smarkj#include "opt_kdtrace.h"
33254889Smarkj
34254889Smarkj#include <sys/param.h>
35254889Smarkj#include <sys/systm.h>
36254889Smarkj#include <sys/sdt.h>
37254889Smarkj
38254889SmarkjSDT_PROVIDER_DEFINE(ip);
39254889SmarkjSDT_PROVIDER_DEFINE(tcp);
40254889SmarkjSDT_PROVIDER_DEFINE(udp);
41254889Smarkj
42260817SavgSDT_PROBE_DEFINE6_XLATE(ip, , , receive,
43254889Smarkj    "void *", "pktinfo_t *",
44254889Smarkj    "void *", "csinfo_t *",
45254889Smarkj    "uint8_t *", "ipinfo_t *",
46254889Smarkj    "struct ifnet *", "ifinfo_t *",
47254889Smarkj    "struct ip *", "ipv4info_t *",
48254889Smarkj    "struct ip6_hdr *", "ipv6info_t *");
49254889Smarkj
50260817SavgSDT_PROBE_DEFINE6_XLATE(ip, , , send,
51254889Smarkj    "void *", "pktinfo_t *",
52254889Smarkj    "void *", "csinfo_t *",
53254889Smarkj    "uint8_t *", "ipinfo_t *",
54254889Smarkj    "struct ifnet *", "ifinfo_t *",
55254889Smarkj    "struct ip *", "ipv4info_t *",
56254889Smarkj    "struct ip6_hdr *", "ipv6info_t *");
57254889Smarkj
58260817SavgSDT_PROBE_DEFINE5_XLATE(tcp, , , accept__established,
59254889Smarkj    "void *", "pktinfo_t *",
60254889Smarkj    "struct tcpcb *", "csinfo_t *",
61318438Ssmh    "uint8_t *", "ipinfo_t *",
62254889Smarkj    "struct tcpcb *", "tcpsinfo_t *" ,
63255993Smarkj    "struct tcphdr *", "tcpinfoh_t *");
64254889Smarkj
65260817SavgSDT_PROBE_DEFINE5_XLATE(tcp, , , accept__refused,
66254889Smarkj    "void *", "pktinfo_t *",
67254889Smarkj    "struct tcpcb *", "csinfo_t *",
68318438Ssmh    "uint8_t *", "ipinfo_t *",
69254889Smarkj    "struct tcpcb *", "tcpsinfo_t *" ,
70254889Smarkj    "struct tcphdr *", "tcpinfo_t *");
71254889Smarkj
72260817SavgSDT_PROBE_DEFINE5_XLATE(tcp, , , connect__established,
73254889Smarkj    "void *", "pktinfo_t *",
74254889Smarkj    "struct tcpcb *", "csinfo_t *",
75318438Ssmh    "uint8_t *", "ipinfo_t *",
76254889Smarkj    "struct tcpcb *", "tcpsinfo_t *" ,
77255993Smarkj    "struct tcphdr *", "tcpinfoh_t *");
78254889Smarkj
79260817SavgSDT_PROBE_DEFINE5_XLATE(tcp, , , connect__refused,
80254889Smarkj    "void *", "pktinfo_t *",
81254889Smarkj    "struct tcpcb *", "csinfo_t *",
82318438Ssmh    "uint8_t *", "ipinfo_t *",
83254889Smarkj    "struct tcpcb *", "tcpsinfo_t *" ,
84255993Smarkj    "struct tcphdr *", "tcpinfoh_t *");
85254889Smarkj
86260817SavgSDT_PROBE_DEFINE5_XLATE(tcp, , , connect__request,
87254889Smarkj    "void *", "pktinfo_t *",
88254889Smarkj    "struct tcpcb *", "csinfo_t *",
89254889Smarkj    "uint8_t *", "ipinfo_t *",
90254889Smarkj    "struct tcpcb *", "tcpsinfo_t *" ,
91254889Smarkj    "struct tcphdr *", "tcpinfo_t *");
92254889Smarkj
93260817SavgSDT_PROBE_DEFINE5_XLATE(tcp, , , receive,
94254889Smarkj    "void *", "pktinfo_t *",
95254889Smarkj    "struct tcpcb *", "csinfo_t *",
96318438Ssmh    "uint8_t *", "ipinfo_t *",
97254889Smarkj    "struct tcpcb *", "tcpsinfo_t *" ,
98255993Smarkj    "struct tcphdr *", "tcpinfoh_t *");
99254889Smarkj
100260817SavgSDT_PROBE_DEFINE5_XLATE(tcp, , , send,
101254889Smarkj    "void *", "pktinfo_t *",
102254889Smarkj    "struct tcpcb *", "csinfo_t *",
103254889Smarkj    "uint8_t *", "ipinfo_t *",
104254889Smarkj    "struct tcpcb *", "tcpsinfo_t *" ,
105254889Smarkj    "struct tcphdr *", "tcpinfo_t *");
106254889Smarkj
107260817SavgSDT_PROBE_DEFINE6_XLATE(tcp, , , state__change,
108254889Smarkj    "void *", "void *",
109254889Smarkj    "struct tcpcb *", "csinfo_t *",
110254889Smarkj    "void *", "void *",
111254889Smarkj    "struct tcpcb *", "tcpsinfo_t *",
112254889Smarkj    "void *", "void *",
113254889Smarkj    "int", "tcplsinfo_t *");
114254889Smarkj
115317375SsmhSDT_PROBE_DEFINE6_XLATE(tcp, , , receive__autoresize,
116317375Ssmh    "void *", "void *",
117317375Ssmh    "struct tcpcb *", "csinfo_t *",
118318438Ssmh    "uint8_t *", "ipinfo_t *",
119317375Ssmh    "struct tcpcb *", "tcpsinfo_t *" ,
120317375Ssmh    "struct tcphdr *", "tcpinfoh_t *",
121317375Ssmh    "int", "int");
122317375Ssmh
123260817SavgSDT_PROBE_DEFINE5_XLATE(udp, , , receive,
124254889Smarkj    "void *", "pktinfo_t *",
125254889Smarkj    "struct inpcb *", "csinfo_t *",
126254889Smarkj    "uint8_t *", "ipinfo_t *",
127254889Smarkj    "struct inpcb *", "udpsinfo_t *",
128254889Smarkj    "struct udphdr *", "udpinfo_t *");
129254889Smarkj
130260817SavgSDT_PROBE_DEFINE5_XLATE(udp, , , send,
131254889Smarkj    "void *", "pktinfo_t *",
132254889Smarkj    "struct inpcb *", "csinfo_t *",
133254889Smarkj    "uint8_t *", "ipinfo_t *",
134254889Smarkj    "struct inpcb *", "udpsinfo_t *",
135254889Smarkj    "struct udphdr *", "udpinfo_t *");
136