1 /*- 2 * SPDX-License-Identifier: BSD-2-Clause-FreeBSD 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 * $FreeBSD$ 29 */ 30 31 #include <sys/cdefs.h> 32 __FBSDID("$FreeBSD$"); 33 34 #include "opt_sctp.h" 35 36 #include <sys/param.h> 37 #include <sys/systm.h> 38 #include <sys/sdt.h> 39 40 SDT_PROVIDER_DEFINE(ip); 41 #ifdef SCTP 42 SDT_PROVIDER_DEFINE(sctp); 43 #endif 44 SDT_PROVIDER_DEFINE(tcp); 45 SDT_PROVIDER_DEFINE(udp); 46 SDT_PROVIDER_DEFINE(udplite); 47 48 SDT_PROBE_DEFINE6_XLATE(ip, , , receive, 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 56 SDT_PROBE_DEFINE6_XLATE(ip, , , send, 57 "void *", "pktinfo_t *", 58 "void *", "csinfo_t *", 59 "uint8_t *", "ipinfo_t *", 60 "struct ifnet *", "ifinfo_t *", 61 "struct ip *", "ipv4info_t *", 62 "struct ip6_hdr *", "ipv6info_t *"); 63 64 #ifdef SCTP 65 SDT_PROBE_DEFINE5_XLATE(sctp, , , receive, 66 "void *", "pktinfo_t *", 67 "struct sctp_tcb *", "csinfo_t *", 68 "struct mbuf *", "ipinfo_t *", 69 "struct sctp_tcb *", "sctpsinfo_t *" , 70 "struct sctphdr *", "sctpinfo_t *"); 71 72 SDT_PROBE_DEFINE5_XLATE(sctp, , , send, 73 "void *", "pktinfo_t *", 74 "struct sctp_tcb *", "csinfo_t *", 75 "uint8_t *", "ipinfo_t *", 76 "struct sctp_tcb *", "sctpsinfo_t *" , 77 "struct sctphdr *", "sctpinfo_t *"); 78 79 SDT_PROBE_DEFINE6_XLATE(sctp, , , state__change, 80 "void *", "void *", 81 "struct sctp_tcb *", "csinfo_t *", 82 "void *", "void *", 83 "struct sctp_tcb *", "sctpsinfo_t *", 84 "void *", "void *", 85 "int", "sctplsinfo_t *"); 86 #endif 87 88 SDT_PROBE_DEFINE5_XLATE(tcp, , , accept__established, 89 "void *", "pktinfo_t *", 90 "struct tcpcb *", "csinfo_t *", 91 "struct mbuf *", "ipinfo_t *", 92 "struct tcpcb *", "tcpsinfo_t *" , 93 "struct tcphdr *", "tcpinfoh_t *"); 94 95 SDT_PROBE_DEFINE5_XLATE(tcp, , , accept__refused, 96 "void *", "pktinfo_t *", 97 "struct tcpcb *", "csinfo_t *", 98 "struct mbuf *", "ipinfo_t *", 99 "struct tcpcb *", "tcpsinfo_t *" , 100 "struct tcphdr *", "tcpinfo_t *"); 101 102 SDT_PROBE_DEFINE5_XLATE(tcp, , , connect__established, 103 "void *", "pktinfo_t *", 104 "struct tcpcb *", "csinfo_t *", 105 "struct mbuf *", "ipinfo_t *", 106 "struct tcpcb *", "tcpsinfo_t *" , 107 "struct tcphdr *", "tcpinfoh_t *"); 108 109 SDT_PROBE_DEFINE5_XLATE(tcp, , , connect__refused, 110 "void *", "pktinfo_t *", 111 "struct tcpcb *", "csinfo_t *", 112 "struct mbuf *", "ipinfo_t *", 113 "struct tcpcb *", "tcpsinfo_t *" , 114 "struct tcphdr *", "tcpinfoh_t *"); 115 116 SDT_PROBE_DEFINE5_XLATE(tcp, , , connect__request, 117 "void *", "pktinfo_t *", 118 "struct tcpcb *", "csinfo_t *", 119 "uint8_t *", "ipinfo_t *", 120 "struct tcpcb *", "tcpsinfo_t *" , 121 "struct tcphdr *", "tcpinfo_t *"); 122 123 SDT_PROBE_DEFINE5_XLATE(tcp, , , receive, 124 "void *", "pktinfo_t *", 125 "struct tcpcb *", "csinfo_t *", 126 "struct mbuf *", "ipinfo_t *", 127 "struct tcpcb *", "tcpsinfo_t *" , 128 "struct tcphdr *", "tcpinfoh_t *"); 129 130 SDT_PROBE_DEFINE5_XLATE(tcp, , , send, 131 "void *", "pktinfo_t *", 132 "struct tcpcb *", "csinfo_t *", 133 "uint8_t *", "ipinfo_t *", 134 "struct tcpcb *", "tcpsinfo_t *" , 135 "struct tcphdr *", "tcpinfo_t *"); 136 137 SDT_PROBE_DEFINE1_XLATE(tcp, , , siftr, 138 "struct pkt_node *", "siftrinfo_t *"); 139 140 SDT_PROBE_DEFINE3_XLATE(tcp, , , debug__input, 141 "struct tcpcb *", "tcpsinfo_t *" , 142 "struct tcphdr *", "tcpinfoh_t *", 143 "uint8_t *", "ipinfo_t *"); 144 145 SDT_PROBE_DEFINE3_XLATE(tcp, , , debug__output, 146 "struct tcpcb *", "tcpsinfo_t *" , 147 "struct tcphdr *", "tcpinfo_t *", 148 "struct mbuf *", "ipinfo_t *"); 149 150 SDT_PROBE_DEFINE2_XLATE(tcp, , , debug__user, 151 "struct tcpcb *", "tcpsinfo_t *" , 152 "int", "int"); 153 154 SDT_PROBE_DEFINE3_XLATE(tcp, , , debug__drop, 155 "struct tcpcb *", "tcpsinfo_t *" , 156 "struct tcphdr *", "tcpinfoh_t *", 157 "struct mbuf *", "ipinfo_t *"); 158 159 SDT_PROBE_DEFINE6_XLATE(tcp, , , state__change, 160 "void *", "void *", 161 "struct tcpcb *", "csinfo_t *", 162 "void *", "void *", 163 "struct tcpcb *", "tcpsinfo_t *", 164 "void *", "void *", 165 "int", "tcplsinfo_t *"); 166 167 SDT_PROBE_DEFINE6_XLATE(tcp, , , receive__autoresize, 168 "void *", "void *", 169 "struct tcpcb *", "csinfo_t *", 170 "struct mbuf *", "ipinfo_t *", 171 "struct tcpcb *", "tcpsinfo_t *" , 172 "struct tcphdr *", "tcpinfoh_t *", 173 "int", "int"); 174 175 SDT_PROBE_DEFINE5_XLATE(udp, , , receive, 176 "void *", "pktinfo_t *", 177 "struct inpcb *", "csinfo_t *", 178 "uint8_t *", "ipinfo_t *", 179 "struct inpcb *", "udpsinfo_t *", 180 "struct udphdr *", "udpinfo_t *"); 181 182 SDT_PROBE_DEFINE5_XLATE(udp, , , send, 183 "void *", "pktinfo_t *", 184 "struct inpcb *", "csinfo_t *", 185 "uint8_t *", "ipinfo_t *", 186 "struct inpcb *", "udpsinfo_t *", 187 "struct udphdr *", "udpinfo_t *"); 188 189 SDT_PROBE_DEFINE5_XLATE(udplite, , , receive, 190 "void *", "pktinfo_t *", 191 "struct inpcb *", "csinfo_t *", 192 "uint8_t *", "ipinfo_t *", 193 "struct inpcb *", "udplitesinfo_t *", 194 "struct udphdr *", "udpliteinfo_t *"); 195 196 SDT_PROBE_DEFINE5_XLATE(udplite, , , send, 197 "void *", "pktinfo_t *", 198 "struct inpcb *", "csinfo_t *", 199 "uint8_t *", "ipinfo_t *", 200 "struct inpcb *", "udplitesinfo_t *", 201 "struct udphdr *", "udpliteinfo_t *"); 202