xref: /freebsd/sys/netinet/in_kdtrace.c (revision 5d06879adb95ac922703072a28fc11048d809a4b)
157f60867SMark Johnston /*-
257f60867SMark Johnston  * Copyright (c) 2013 Mark Johnston <markj@FreeBSD.org>
357f60867SMark Johnston  *
457f60867SMark Johnston  * Redistribution and use in source and binary forms, with or without
557f60867SMark Johnston  * modification, are permitted provided that the following conditions are
657f60867SMark Johnston  * met:
757f60867SMark Johnston  * 1. Redistributions of source code must retain the above copyright
857f60867SMark Johnston  *    notice, this list of conditions and the following disclaimer.
957f60867SMark Johnston  * 2. Redistributions in binary form must reproduce the above copyright
1057f60867SMark Johnston  *    notice, this list of conditions and the following disclaimer in
1157f60867SMark Johnston  *    the documentation and/or other materials provided with the
1257f60867SMark Johnston  *    distribution.
1357f60867SMark Johnston  *
1457f60867SMark Johnston  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
1557f60867SMark Johnston  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
1657f60867SMark Johnston  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
1757f60867SMark Johnston  * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
1857f60867SMark Johnston  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
1957f60867SMark Johnston  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
2057f60867SMark Johnston  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
2157f60867SMark Johnston  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
2257f60867SMark Johnston  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
2357f60867SMark Johnston  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
2457f60867SMark Johnston  * SUCH DAMAGE.
2557f60867SMark Johnston  *
2657f60867SMark Johnston  * $FreeBSD$
2757f60867SMark Johnston  */
2857f60867SMark Johnston 
2957f60867SMark Johnston #include <sys/cdefs.h>
3057f60867SMark Johnston __FBSDID("$FreeBSD$");
3157f60867SMark Johnston 
3257f60867SMark Johnston #include <sys/param.h>
3357f60867SMark Johnston #include <sys/systm.h>
3457f60867SMark Johnston #include <sys/sdt.h>
3557f60867SMark Johnston 
3657f60867SMark Johnston SDT_PROVIDER_DEFINE(ip);
3757f60867SMark Johnston SDT_PROVIDER_DEFINE(tcp);
3857f60867SMark Johnston SDT_PROVIDER_DEFINE(udp);
3957f60867SMark Johnston 
40d9fae5abSAndriy Gapon SDT_PROBE_DEFINE6_XLATE(ip, , , receive,
4157f60867SMark Johnston     "void *", "pktinfo_t *",
4257f60867SMark Johnston     "void *", "csinfo_t *",
4357f60867SMark Johnston     "uint8_t *", "ipinfo_t *",
4457f60867SMark Johnston     "struct ifnet *", "ifinfo_t *",
4557f60867SMark Johnston     "struct ip *", "ipv4info_t *",
4657f60867SMark Johnston     "struct ip6_hdr *", "ipv6info_t *");
4757f60867SMark Johnston 
48d9fae5abSAndriy Gapon SDT_PROBE_DEFINE6_XLATE(ip, , , send,
4957f60867SMark Johnston     "void *", "pktinfo_t *",
5057f60867SMark Johnston     "void *", "csinfo_t *",
5157f60867SMark Johnston     "uint8_t *", "ipinfo_t *",
5257f60867SMark Johnston     "struct ifnet *", "ifinfo_t *",
5357f60867SMark Johnston     "struct ip *", "ipv4info_t *",
5457f60867SMark Johnston     "struct ip6_hdr *", "ipv6info_t *");
5557f60867SMark Johnston 
56d9fae5abSAndriy Gapon SDT_PROBE_DEFINE5_XLATE(tcp, , , accept__established,
5757f60867SMark Johnston     "void *", "pktinfo_t *",
5857f60867SMark Johnston     "struct tcpcb *", "csinfo_t *",
5957f60867SMark Johnston     "uint8_t *", "ipinfo_t *",
6057f60867SMark Johnston     "struct tcpcb *", "tcpsinfo_t *" ,
618298c17cSMark Johnston     "struct tcphdr *", "tcpinfoh_t *");
6257f60867SMark Johnston 
63d9fae5abSAndriy Gapon SDT_PROBE_DEFINE5_XLATE(tcp, , , accept__refused,
6457f60867SMark Johnston     "void *", "pktinfo_t *",
6557f60867SMark Johnston     "struct tcpcb *", "csinfo_t *",
6657f60867SMark Johnston     "uint8_t *", "ipinfo_t *",
6757f60867SMark Johnston     "struct tcpcb *", "tcpsinfo_t *" ,
6857f60867SMark Johnston     "struct tcphdr *", "tcpinfo_t *");
6957f60867SMark Johnston 
70d9fae5abSAndriy Gapon SDT_PROBE_DEFINE5_XLATE(tcp, , , connect__established,
7157f60867SMark Johnston     "void *", "pktinfo_t *",
7257f60867SMark Johnston     "struct tcpcb *", "csinfo_t *",
7357f60867SMark Johnston     "uint8_t *", "ipinfo_t *",
7457f60867SMark Johnston     "struct tcpcb *", "tcpsinfo_t *" ,
758298c17cSMark Johnston     "struct tcphdr *", "tcpinfoh_t *");
7657f60867SMark Johnston 
77d9fae5abSAndriy Gapon SDT_PROBE_DEFINE5_XLATE(tcp, , , connect__refused,
7857f60867SMark Johnston     "void *", "pktinfo_t *",
7957f60867SMark Johnston     "struct tcpcb *", "csinfo_t *",
8057f60867SMark Johnston     "uint8_t *", "ipinfo_t *",
8157f60867SMark Johnston     "struct tcpcb *", "tcpsinfo_t *" ,
828298c17cSMark Johnston     "struct tcphdr *", "tcpinfoh_t *");
8357f60867SMark Johnston 
84d9fae5abSAndriy Gapon SDT_PROBE_DEFINE5_XLATE(tcp, , , connect__request,
8557f60867SMark Johnston     "void *", "pktinfo_t *",
8657f60867SMark Johnston     "struct tcpcb *", "csinfo_t *",
8757f60867SMark Johnston     "uint8_t *", "ipinfo_t *",
8857f60867SMark Johnston     "struct tcpcb *", "tcpsinfo_t *" ,
8957f60867SMark Johnston     "struct tcphdr *", "tcpinfo_t *");
9057f60867SMark Johnston 
91d9fae5abSAndriy Gapon SDT_PROBE_DEFINE5_XLATE(tcp, , , receive,
9257f60867SMark Johnston     "void *", "pktinfo_t *",
9357f60867SMark Johnston     "struct tcpcb *", "csinfo_t *",
9457f60867SMark Johnston     "uint8_t *", "ipinfo_t *",
9557f60867SMark Johnston     "struct tcpcb *", "tcpsinfo_t *" ,
968298c17cSMark Johnston     "struct tcphdr *", "tcpinfoh_t *");
9757f60867SMark Johnston 
98d9fae5abSAndriy Gapon SDT_PROBE_DEFINE5_XLATE(tcp, , , send,
9957f60867SMark Johnston     "void *", "pktinfo_t *",
10057f60867SMark Johnston     "struct tcpcb *", "csinfo_t *",
10157f60867SMark Johnston     "uint8_t *", "ipinfo_t *",
10257f60867SMark Johnston     "struct tcpcb *", "tcpsinfo_t *" ,
10357f60867SMark Johnston     "struct tcphdr *", "tcpinfo_t *");
10457f60867SMark Johnston 
105981ad3ecSGeorge V. Neville-Neil SDT_PROBE_DEFINE1_XLATE(tcp, , , siftr,
106981ad3ecSGeorge V. Neville-Neil     "struct pkt_node *", "siftrinfo_t *");
107981ad3ecSGeorge V. Neville-Neil 
108*5d06879aSGeorge V. Neville-Neil SDT_PROBE_DEFINE3_XLATE(tcp, , , debug__input,
109*5d06879aSGeorge V. Neville-Neil     "struct tcpcb *", "tcpsinfo_t *" ,
110*5d06879aSGeorge V. Neville-Neil     "struct tcphdr *", "tcpinfo_t *",
111*5d06879aSGeorge V. Neville-Neil     "uint8_t *", "ipinfo_t *");
112*5d06879aSGeorge V. Neville-Neil 
113*5d06879aSGeorge V. Neville-Neil SDT_PROBE_DEFINE3_XLATE(tcp, , , debug__output,
114*5d06879aSGeorge V. Neville-Neil     "struct tcpcb *", "tcpsinfo_t *" ,
115*5d06879aSGeorge V. Neville-Neil     "struct tcphdr *", "tcpinfo_t *",
116*5d06879aSGeorge V. Neville-Neil     "uint8_t *", "ipinfo_t *");
117*5d06879aSGeorge V. Neville-Neil 
118*5d06879aSGeorge V. Neville-Neil SDT_PROBE_DEFINE2_XLATE(tcp, , , debug__user,
119*5d06879aSGeorge V. Neville-Neil     "struct tcpcb *", "tcpsinfo_t *" ,
120*5d06879aSGeorge V. Neville-Neil     "int", "int");
121*5d06879aSGeorge V. Neville-Neil 
122*5d06879aSGeorge V. Neville-Neil SDT_PROBE_DEFINE3_XLATE(tcp, , , debug__drop,
123*5d06879aSGeorge V. Neville-Neil     "struct tcpcb *", "tcpsinfo_t *" ,
124*5d06879aSGeorge V. Neville-Neil     "struct tcphdr *", "tcpinfo_t *",
125*5d06879aSGeorge V. Neville-Neil     "uint8_t *", "ipinfo_t *")
126*5d06879aSGeorge V. Neville-Neil 
127d9fae5abSAndriy Gapon SDT_PROBE_DEFINE6_XLATE(tcp, , , state__change,
12857f60867SMark Johnston     "void *", "void *",
12957f60867SMark Johnston     "struct tcpcb *", "csinfo_t *",
13057f60867SMark Johnston     "void *", "void *",
13157f60867SMark Johnston     "struct tcpcb *", "tcpsinfo_t *",
13257f60867SMark Johnston     "void *", "void *",
13357f60867SMark Johnston     "int", "tcplsinfo_t *");
13457f60867SMark Johnston 
135d9fae5abSAndriy Gapon SDT_PROBE_DEFINE5_XLATE(udp, , , receive,
13657f60867SMark Johnston     "void *", "pktinfo_t *",
13757f60867SMark Johnston     "struct inpcb *", "csinfo_t *",
13857f60867SMark Johnston     "uint8_t *", "ipinfo_t *",
13957f60867SMark Johnston     "struct inpcb *", "udpsinfo_t *",
14057f60867SMark Johnston     "struct udphdr *", "udpinfo_t *");
14157f60867SMark Johnston 
142d9fae5abSAndriy Gapon SDT_PROBE_DEFINE5_XLATE(udp, , , send,
14357f60867SMark Johnston     "void *", "pktinfo_t *",
14457f60867SMark Johnston     "struct inpcb *", "csinfo_t *",
14557f60867SMark Johnston     "uint8_t *", "ipinfo_t *",
14657f60867SMark Johnston     "struct inpcb *", "udpsinfo_t *",
14757f60867SMark Johnston     "struct udphdr *", "udpinfo_t *");
148