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