xref: /freebsd/sys/netinet/in_kdtrace.c (revision 5557762b725956e395bce8d1d25b511b02403f2a)
157f60867SMark Johnston /*-
2fe267a55SPedro F. Giffuni  * SPDX-License-Identifier: BSD-2-Clause-FreeBSD
3fe267a55SPedro F. Giffuni  *
457f60867SMark Johnston  * Copyright (c) 2013 Mark Johnston <markj@FreeBSD.org>
557f60867SMark Johnston  *
657f60867SMark Johnston  * Redistribution and use in source and binary forms, with or without
757f60867SMark Johnston  * modification, are permitted provided that the following conditions are
857f60867SMark Johnston  * met:
957f60867SMark Johnston  * 1. Redistributions of source code must retain the above copyright
1057f60867SMark Johnston  *    notice, this list of conditions and the following disclaimer.
1157f60867SMark Johnston  * 2. Redistributions in binary form must reproduce the above copyright
1257f60867SMark Johnston  *    notice, this list of conditions and the following disclaimer in
1357f60867SMark Johnston  *    the documentation and/or other materials provided with the
1457f60867SMark Johnston  *    distribution.
1557f60867SMark Johnston  *
1657f60867SMark Johnston  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
1757f60867SMark Johnston  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
1857f60867SMark Johnston  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
1957f60867SMark Johnston  * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
2057f60867SMark Johnston  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
2157f60867SMark Johnston  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
2257f60867SMark Johnston  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
2357f60867SMark Johnston  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
2457f60867SMark Johnston  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
2557f60867SMark Johnston  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
2657f60867SMark Johnston  * SUCH DAMAGE.
2757f60867SMark Johnston  *
2857f60867SMark Johnston  * $FreeBSD$
2957f60867SMark Johnston  */
3057f60867SMark Johnston 
3157f60867SMark Johnston #include <sys/cdefs.h>
3257f60867SMark Johnston __FBSDID("$FreeBSD$");
3357f60867SMark Johnston 
3457f60867SMark Johnston #include <sys/param.h>
3557f60867SMark Johnston #include <sys/systm.h>
3657f60867SMark Johnston #include <sys/sdt.h>
3757f60867SMark Johnston 
3857f60867SMark Johnston SDT_PROVIDER_DEFINE(ip);
3957f60867SMark Johnston SDT_PROVIDER_DEFINE(tcp);
4057f60867SMark Johnston SDT_PROVIDER_DEFINE(udp);
4157f60867SMark Johnston 
42d9fae5abSAndriy Gapon SDT_PROBE_DEFINE6_XLATE(ip, , , receive,
4357f60867SMark Johnston     "void *", "pktinfo_t *",
4457f60867SMark Johnston     "void *", "csinfo_t *",
4557f60867SMark Johnston     "uint8_t *", "ipinfo_t *",
4657f60867SMark Johnston     "struct ifnet *", "ifinfo_t *",
4757f60867SMark Johnston     "struct ip *", "ipv4info_t *",
4857f60867SMark Johnston     "struct ip6_hdr *", "ipv6info_t *");
4957f60867SMark Johnston 
50d9fae5abSAndriy Gapon SDT_PROBE_DEFINE6_XLATE(ip, , , send,
5157f60867SMark Johnston     "void *", "pktinfo_t *",
5257f60867SMark Johnston     "void *", "csinfo_t *",
5357f60867SMark Johnston     "uint8_t *", "ipinfo_t *",
5457f60867SMark Johnston     "struct ifnet *", "ifinfo_t *",
5557f60867SMark Johnston     "struct ip *", "ipv4info_t *",
5657f60867SMark Johnston     "struct ip6_hdr *", "ipv6info_t *");
5757f60867SMark Johnston 
58d9fae5abSAndriy Gapon SDT_PROBE_DEFINE5_XLATE(tcp, , , accept__established,
5957f60867SMark Johnston     "void *", "pktinfo_t *",
6057f60867SMark Johnston     "struct tcpcb *", "csinfo_t *",
6182988b50SGeorge V. Neville-Neil     "struct mbuf *", "ipinfo_t *",
6257f60867SMark Johnston     "struct tcpcb *", "tcpsinfo_t *" ,
638298c17cSMark Johnston     "struct tcphdr *", "tcpinfoh_t *");
6457f60867SMark Johnston 
65d9fae5abSAndriy Gapon SDT_PROBE_DEFINE5_XLATE(tcp, , , accept__refused,
6657f60867SMark Johnston     "void *", "pktinfo_t *",
6757f60867SMark Johnston     "struct tcpcb *", "csinfo_t *",
6882988b50SGeorge V. Neville-Neil     "struct mbuf *", "ipinfo_t *",
6957f60867SMark Johnston     "struct tcpcb *", "tcpsinfo_t *" ,
7057f60867SMark Johnston     "struct tcphdr *", "tcpinfo_t *");
7157f60867SMark Johnston 
72d9fae5abSAndriy Gapon SDT_PROBE_DEFINE5_XLATE(tcp, , , connect__established,
7357f60867SMark Johnston     "void *", "pktinfo_t *",
7457f60867SMark Johnston     "struct tcpcb *", "csinfo_t *",
7582988b50SGeorge V. Neville-Neil     "struct mbuf *", "ipinfo_t *",
7657f60867SMark Johnston     "struct tcpcb *", "tcpsinfo_t *" ,
778298c17cSMark Johnston     "struct tcphdr *", "tcpinfoh_t *");
7857f60867SMark Johnston 
79d9fae5abSAndriy Gapon SDT_PROBE_DEFINE5_XLATE(tcp, , , connect__refused,
8057f60867SMark Johnston     "void *", "pktinfo_t *",
8157f60867SMark Johnston     "struct tcpcb *", "csinfo_t *",
8282988b50SGeorge V. Neville-Neil     "struct mbuf *", "ipinfo_t *",
8357f60867SMark Johnston     "struct tcpcb *", "tcpsinfo_t *" ,
848298c17cSMark Johnston     "struct tcphdr *", "tcpinfoh_t *");
8557f60867SMark Johnston 
86d9fae5abSAndriy Gapon SDT_PROBE_DEFINE5_XLATE(tcp, , , connect__request,
8757f60867SMark Johnston     "void *", "pktinfo_t *",
8857f60867SMark Johnston     "struct tcpcb *", "csinfo_t *",
8957f60867SMark Johnston     "uint8_t *", "ipinfo_t *",
9057f60867SMark Johnston     "struct tcpcb *", "tcpsinfo_t *" ,
9157f60867SMark Johnston     "struct tcphdr *", "tcpinfo_t *");
9257f60867SMark Johnston 
93d9fae5abSAndriy Gapon SDT_PROBE_DEFINE5_XLATE(tcp, , , receive,
9457f60867SMark Johnston     "void *", "pktinfo_t *",
9557f60867SMark Johnston     "struct tcpcb *", "csinfo_t *",
9682988b50SGeorge V. Neville-Neil     "struct mbuf *", "ipinfo_t *",
9757f60867SMark Johnston     "struct tcpcb *", "tcpsinfo_t *" ,
988298c17cSMark Johnston     "struct tcphdr *", "tcpinfoh_t *");
9957f60867SMark Johnston 
100d9fae5abSAndriy Gapon SDT_PROBE_DEFINE5_XLATE(tcp, , , send,
10157f60867SMark Johnston     "void *", "pktinfo_t *",
10257f60867SMark Johnston     "struct tcpcb *", "csinfo_t *",
10357f60867SMark Johnston     "uint8_t *", "ipinfo_t *",
10457f60867SMark Johnston     "struct tcpcb *", "tcpsinfo_t *" ,
10557f60867SMark Johnston     "struct tcphdr *", "tcpinfo_t *");
10657f60867SMark Johnston 
107981ad3ecSGeorge V. Neville-Neil SDT_PROBE_DEFINE1_XLATE(tcp, , , siftr,
108981ad3ecSGeorge V. Neville-Neil     "struct pkt_node *", "siftrinfo_t *");
109981ad3ecSGeorge V. Neville-Neil 
1105d06879aSGeorge V. Neville-Neil SDT_PROBE_DEFINE3_XLATE(tcp, , , debug__input,
1115d06879aSGeorge V. Neville-Neil     "struct tcpcb *", "tcpsinfo_t *" ,
112*5557762bSMark Johnston     "struct tcphdr *", "tcpinfoh_t *",
1135d06879aSGeorge V. Neville-Neil     "uint8_t *", "ipinfo_t *");
1145d06879aSGeorge V. Neville-Neil 
1155d06879aSGeorge V. Neville-Neil SDT_PROBE_DEFINE3_XLATE(tcp, , , debug__output,
1165d06879aSGeorge V. Neville-Neil     "struct tcpcb *", "tcpsinfo_t *" ,
1175d06879aSGeorge V. Neville-Neil     "struct tcphdr *", "tcpinfo_t *",
11882988b50SGeorge V. Neville-Neil     "struct mbuf *", "ipinfo_t *");
1195d06879aSGeorge V. Neville-Neil 
1205d06879aSGeorge V. Neville-Neil SDT_PROBE_DEFINE2_XLATE(tcp, , , debug__user,
1215d06879aSGeorge V. Neville-Neil     "struct tcpcb *", "tcpsinfo_t *" ,
1225d06879aSGeorge V. Neville-Neil     "int", "int");
1235d06879aSGeorge V. Neville-Neil 
1245d06879aSGeorge V. Neville-Neil SDT_PROBE_DEFINE3_XLATE(tcp, , , debug__drop,
1255d06879aSGeorge V. Neville-Neil     "struct tcpcb *", "tcpsinfo_t *" ,
126*5557762bSMark Johnston     "struct tcphdr *", "tcpinfoh_t *",
12782988b50SGeorge V. Neville-Neil     "struct mbuf *", "ipinfo_t *");
1285d06879aSGeorge V. Neville-Neil 
129d9fae5abSAndriy Gapon SDT_PROBE_DEFINE6_XLATE(tcp, , , state__change,
13057f60867SMark Johnston     "void *", "void *",
13157f60867SMark Johnston     "struct tcpcb *", "csinfo_t *",
13257f60867SMark Johnston     "void *", "void *",
13357f60867SMark Johnston     "struct tcpcb *", "tcpsinfo_t *",
13457f60867SMark Johnston     "void *", "void *",
13557f60867SMark Johnston     "int", "tcplsinfo_t *");
13657f60867SMark Johnston 
137e44c1887SSteven Hartland SDT_PROBE_DEFINE6_XLATE(tcp, , , receive__autoresize,
138e44c1887SSteven Hartland     "void *", "void *",
139e44c1887SSteven Hartland     "struct tcpcb *", "csinfo_t *",
140e44c1887SSteven Hartland     "struct mbuf *", "ipinfo_t *",
141e44c1887SSteven Hartland     "struct tcpcb *", "tcpsinfo_t *" ,
142e44c1887SSteven Hartland     "struct tcphdr *", "tcpinfoh_t *",
143e44c1887SSteven Hartland     "int", "int");
144e44c1887SSteven Hartland 
145d9fae5abSAndriy Gapon SDT_PROBE_DEFINE5_XLATE(udp, , , receive,
14657f60867SMark Johnston     "void *", "pktinfo_t *",
14757f60867SMark Johnston     "struct inpcb *", "csinfo_t *",
14857f60867SMark Johnston     "uint8_t *", "ipinfo_t *",
14957f60867SMark Johnston     "struct inpcb *", "udpsinfo_t *",
15057f60867SMark Johnston     "struct udphdr *", "udpinfo_t *");
15157f60867SMark Johnston 
152d9fae5abSAndriy Gapon SDT_PROBE_DEFINE5_XLATE(udp, , , send,
15357f60867SMark Johnston     "void *", "pktinfo_t *",
15457f60867SMark Johnston     "struct inpcb *", "csinfo_t *",
15557f60867SMark Johnston     "uint8_t *", "ipinfo_t *",
15657f60867SMark Johnston     "struct inpcb *", "udpsinfo_t *",
15757f60867SMark Johnston     "struct udphdr *", "udpinfo_t *");
158