13a42a33dSDevin Teske.\" Copyright (c) 2018 Devin Teske <dteske@FreeBSD.org> 23a42a33dSDevin Teske.\" 33a42a33dSDevin Teske.\" Redistribution and use in source and binary forms, with or without 43a42a33dSDevin Teske.\" modification, are permitted provided that the following conditions 53a42a33dSDevin Teske.\" are met: 63a42a33dSDevin Teske.\" 1. Redistributions of source code must retain the above copyright 73a42a33dSDevin Teske.\" notice, this list of conditions and the following disclaimer. 83a42a33dSDevin Teske.\" 2. Redistributions in binary form must reproduce the above copyright 93a42a33dSDevin Teske.\" notice, this list of conditions and the following disclaimer in the 103a42a33dSDevin Teske.\" documentation and/or other materials provided with the distribution. 113a42a33dSDevin Teske.\" 123a42a33dSDevin Teske.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND 133a42a33dSDevin Teske.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 143a42a33dSDevin Teske.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 153a42a33dSDevin Teske.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE 163a42a33dSDevin Teske.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 173a42a33dSDevin Teske.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 183a42a33dSDevin Teske.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 193a42a33dSDevin Teske.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 203a42a33dSDevin Teske.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 213a42a33dSDevin Teske.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 223a42a33dSDevin Teske.\" SUCH DAMAGE. 233a42a33dSDevin Teske.\" 24*81b4bf08SMichael Tuexen.Dd June 29, 2023 253a42a33dSDevin Teske.Dt DTRACE_SCTP 4 263a42a33dSDevin Teske.Os 273a42a33dSDevin Teske.Sh NAME 283a42a33dSDevin Teske.Nm dtrace_sctp 293a42a33dSDevin Teske.Nd a DTrace provider for tracing events related to the 303a42a33dSDevin Teske.Xr sctp 4 313a42a33dSDevin Teskeprotocol 323a42a33dSDevin Teske.Sh SYNOPSIS 333a42a33dSDevin Teske.Fn sctp:cwnd::init uint32_t uint32_t uintptr_t int int 343a42a33dSDevin Teske.Fn sctp:cwnd::ack uint32_t uint32_t uintptr_t int int 353a42a33dSDevin Teske.Fn sctp:cwnd::rttvar uint64_t uint64_t uint64_t uint64_t uint64_t 363a42a33dSDevin Teske.Fn sctp:cwnd::rttstep uint64_t uint64_t uint64_t uint64_t uint64_t 373a42a33dSDevin Teske.Fn sctp:cwnd::fr uint32_t uint32_t uintptr_t int int 383a42a33dSDevin Teske.Fn sctp:cwnd::to uint32_t uint32_t uintptr_t int int 393a42a33dSDevin Teske.Fn sctp:cwnd::bl uint32_t uint32_t uintptr_t int int 403a42a33dSDevin Teske.Fn sctp:cwnd::ecn uint32_t uint32_t uintptr_t int int 413a42a33dSDevin Teske.Fn sctp:cwnd::pd uint32_t uint32_t uintptr_t int int 423a42a33dSDevin Teske.Fn sctp:rwnd:assoc:val uint32_t uint32_t int int 433a42a33dSDevin Teske.Fn sctp:flightsize:net:val uint32_t uint32_t uintptr_t int int 443a42a33dSDevin Teske.Fn sctp:flightsize:assoc:val uint32_t uint32_t int int 451e88cc8bSMichael Tuexen.Fn sctp:::receive "pktinfo_t *" "csinfo_t *" "ipinfo_t *" "sctpsinfo_t *" \ 461e88cc8bSMichael Tuexen "sctpinfo_t *" 471e88cc8bSMichael Tuexen.Fn sctp:::send "pktinfo_t *" "csinfo_t *" "ipinfo_t *" "sctpsinfo_t *" \ 481e88cc8bSMichael Tuexen "sctpinfo_t *" 491e88cc8bSMichael Tuexen.Fn sctp:::state-change "void *" "csinfo_t *" "void *" "sctpsinfo_t *" \ 501e88cc8bSMichael Tuexen "void *" "sctplsinfo_t *" 513a42a33dSDevin Teske.Sh DESCRIPTION 523a42a33dSDevin TeskeThe DTrace 533a42a33dSDevin Teske.Nm sctp 543a42a33dSDevin Teskeprovider allows users to trace events in the 553a42a33dSDevin Teske.Xr sctp 4 563a42a33dSDevin Teskeprotocol implementation. 573a42a33dSDevin TeskeThis provider is similar to the 583a42a33dSDevin Teske.Xr dtrace_ip 4 593a42a33dSDevin Teskeand 603a42a33dSDevin Teske.Xr dtrace_udp 4 613a42a33dSDevin Teskeproviders, 623a42a33dSDevin Teskebut additionally contains probes corresponding to protocol events at a level 633a42a33dSDevin Teskehigher than packet reception and transmission. 643a42a33dSDevin Teske.Pp 653a42a33dSDevin TeskeThe 663a42a33dSDevin Teske.Fn sctp:cwnd:: 673a42a33dSDevin Teskeprobes track changes in the congestion window on a netp. 683a42a33dSDevin TeskeThe 693a42a33dSDevin Teske.Fn sctp:rwnd:: 703a42a33dSDevin Teskeprobes track changes in the receiver window for an assoc. 713a42a33dSDevin TeskeThe 723a42a33dSDevin Teske.Fn sctp:flightsize:net:val 733a42a33dSDevin Teskeprobe tracks changes in the flight size on a net or assoc and the 743a42a33dSDevin Teske.Fn sctp:flightsize:assoc:val 753a42a33dSDevin Teskeprobe provides the total flight version. 763a42a33dSDevin Teske.Pp 773a42a33dSDevin TeskeThe arguments of all 783a42a33dSDevin Teske.Nm sctp 793a42a33dSDevin Teskeprobes except for 803a42a33dSDevin Teske.Fn sctp:cwnd::rtt* 813a42a33dSDevin Teskeand 823a42a33dSDevin Teske.Fn sctp::assoc:val 833a42a33dSDevin Teskeare the Vtag for this end, 843a42a33dSDevin Teskethe port number of the local side, 853a42a33dSDevin Teskethe pointer to 863a42a33dSDevin Teske.Dv struct sctp_nets *changing , 873a42a33dSDevin Teskethe old value of the cwnd, 883a42a33dSDevin Teskeand the new value of the cwnd. 893a42a33dSDevin Teske.Pp 903a42a33dSDevin TeskeThe arguments of 913a42a33dSDevin Teske.Fn sctp:::val 923a42a33dSDevin Teskeare similar to the above except the fourth argument is the up/down amount. 933a42a33dSDevin Teske.Pp 943a42a33dSDevin TeskeThe 953a42a33dSDevin Teske.Fn sctp:cwnd::rtt* 963a42a33dSDevin Teskeprobe arguments are a bitmap of 973a42a33dSDevin Teske.Dv Vtag << 32 | localport << 16 | remoteport , 983a42a33dSDevin Teskea bitmap of 993a42a33dSDevin Teske.Dv obw | nbw , 1003a42a33dSDevin Teskea bitmap of 1013a42a33dSDevin Teske.Dv bwrtt | newrtt , 1023a42a33dSDevin Teske.Dv flight , 1033a42a33dSDevin Teskeand a bitmap of 1043a42a33dSDevin Teske.Dv (cwnd << 32) | point << 16 | retval(0/1) . 1053a42a33dSDevin Teske.Pp 1063a42a33dSDevin TeskeThe 1073a42a33dSDevin Teske.Fn sctp:cwnd::init 1083a42a33dSDevin Teskeprobe fires when a remotely-initiated active SCTP open succeeds. 1093a42a33dSDevin TeskeAt this point the new connection is in the ESTABLISHED state, and the probe 1103a42a33dSDevin Teskearguments expose the headers associated with the final ACK of the four-way 1113a42a33dSDevin Teskehandshake. 1121e88cc8bSMichael Tuexen.Pp 1131e88cc8bSMichael TuexenThe 1141e88cc8bSMichael Tuexen.Fn sctp:::send 1151e88cc8bSMichael Tuexenand 1161e88cc8bSMichael Tuexen.Fn sctp:::receive 1171e88cc8bSMichael Tuexenprobes fire when the host sends or receives an SCTP packet, respectively. 1181e88cc8bSMichael TuexenAs with the 1191e88cc8bSMichael Tuexen.Xr dtrace_udp 4 1201e88cc8bSMichael Tuexenprovider, 1211e88cc8bSMichael Tuexen.Nm sctp 1221e88cc8bSMichael Tuexenprobes fire only for packets sent by or to the local host; forwarded packets are 1231e88cc8bSMichael Tuexenhandled in the IP layer and are only visible to the 1241e88cc8bSMichael Tuexen.Xr dtrace_ip 4 1251e88cc8bSMichael Tuexenprovider. 1261e88cc8bSMichael Tuexen.Pp 1271e88cc8bSMichael TuexenThe 1281e88cc8bSMichael Tuexen.Fn sctp:::state-change 1291e88cc8bSMichael Tuexenprobe fires upon local SCTP association state transitions. 1301e88cc8bSMichael TuexenIts first, third and fifth arguments are currently always 1311e88cc8bSMichael Tuexen.Dv NULL . 1321e88cc8bSMichael TuexenIts last argument describes the from-state in the transition, and the to-state 1331e88cc8bSMichael Tuexencan be obtained from 1341e88cc8bSMichael Tuexen.Dv args[3]->sctps_state . 1353a42a33dSDevin Teske.\" .Sh ARGUMENTS 1361e88cc8bSMichael Tuexen.Sh FILES 1371e88cc8bSMichael Tuexen.Bl -tag -width "/usr/lib/dtrace/sctp.d" -compact 1381e88cc8bSMichael Tuexen.It Pa /usr/lib/dtrace/sctp.d 1391e88cc8bSMichael TuexenDTrace type and translator definitions for the 1401e88cc8bSMichael Tuexen.Nm sctp 1411e88cc8bSMichael Tuexenprovider. 1421e88cc8bSMichael Tuexen.El 1431e88cc8bSMichael Tuexen.Sh EXAMPLES 1441e88cc8bSMichael TuexenA script that logs SCTP packets in real time: 1451e88cc8bSMichael Tuexen.Bd -literal -offset indent 1461e88cc8bSMichael Tuexen#pragma D option quiet 1471e88cc8bSMichael Tuexen#pragma D option switchrate=10hz 1481e88cc8bSMichael Tuexen 1491e88cc8bSMichael Tuexendtrace:::BEGIN 1501e88cc8bSMichael Tuexen{ 151*81b4bf08SMichael Tuexen printf(" %3s %15s:%-5s %15s:%-5s\\n", "CPU", 1521e88cc8bSMichael Tuexen "LADDR", "LPORT", "RADDR", "RPORT"); 1531e88cc8bSMichael Tuexen} 1541e88cc8bSMichael Tuexen 1551e88cc8bSMichael Tuexensctp:::send 1561e88cc8bSMichael Tuexen{ 157*81b4bf08SMichael Tuexen printf(" %3d %16s:%-5d -> %16s:%-5d\\n", cpu, 1581e88cc8bSMichael Tuexen args[2]->ip_saddr, args[4]->sctp_sport, 1591e88cc8bSMichael Tuexen args[2]->ip_daddr, args[4]->sctp_dport); 1601e88cc8bSMichael Tuexen} 1611e88cc8bSMichael Tuexen 1621e88cc8bSMichael Tuexensctp:::receive 1631e88cc8bSMichael Tuexen{ 164*81b4bf08SMichael Tuexen printf(" %3d %16s:%-5d <- %16s:%-5d\\n", cpu, 1651e88cc8bSMichael Tuexen args[2]->ip_daddr, args[4]->sctp_dport, 1661e88cc8bSMichael Tuexen args[2]->ip_saddr, args[4]->sctp_sport); 1671e88cc8bSMichael Tuexen} 1681e88cc8bSMichael Tuexen.Ed 1691e88cc8bSMichael TuexenA script that logs SCTP association state changes as they occur: 1701e88cc8bSMichael Tuexen.Bd -literal -offset indent 1711e88cc8bSMichael Tuexen#pragma D option quiet 1721e88cc8bSMichael Tuexen#pragma D option switchrate=10 1731e88cc8bSMichael Tuexen 1741e88cc8bSMichael Tuexenint last[int]; 1751e88cc8bSMichael Tuexen 1761e88cc8bSMichael Tuexendtrace:::BEGIN 1771e88cc8bSMichael Tuexen{ 178*81b4bf08SMichael Tuexen printf(" %3s %12s %-25s %-25s\\n", 1791e88cc8bSMichael Tuexen "CPU", "DELTA(us)", "OLD", "NEW"); 1801e88cc8bSMichael Tuexen} 1811e88cc8bSMichael Tuexen 1821e88cc8bSMichael Tuexensctp:::state-change 1831e88cc8bSMichael Tuexen/ last[args[1]->cs_cid] / 1841e88cc8bSMichael Tuexen{ 1851e88cc8bSMichael Tuexen this->elapsed = (timestamp - last[args[1]->cs_cid]) / 1000; 186*81b4bf08SMichael Tuexen printf(" %3d %12d %-25s -> %-25s\\n", cpu, this->elapsed, 1871e88cc8bSMichael Tuexen sctp_state_string[args[5]->sctps_state], 1881e88cc8bSMichael Tuexen sctp_state_string[args[3]->sctps_state]); 1891e88cc8bSMichael Tuexen last[args[1]->cs_cid] = timestamp; 1901e88cc8bSMichael Tuexen} 1911e88cc8bSMichael Tuexen 1921e88cc8bSMichael Tuexensctp:::state-change 1931e88cc8bSMichael Tuexen/ last[args[1]->cs_cid] == 0 / 1941e88cc8bSMichael Tuexen{ 195*81b4bf08SMichael Tuexen printf(" %3d %12s %-25s -> %-25s\\n", cpu, "-", 1961e88cc8bSMichael Tuexen sctp_state_string[args[5]->sctps_state], 1971e88cc8bSMichael Tuexen sctp_state_string[args[3]->sctps_state]); 1981e88cc8bSMichael Tuexen last[args[1]->cs_cid] = timestamp; 1991e88cc8bSMichael Tuexen} 2001e88cc8bSMichael Tuexen.Ed 2011e88cc8bSMichael Tuexen.Sh COMPATIBILITY 2021e88cc8bSMichael TuexenThe 2031e88cc8bSMichael Tuexen.Fn sctp:::send , 2041e88cc8bSMichael Tuexen.Fn sctp:::receive , 2051e88cc8bSMichael Tuexenand 2061e88cc8bSMichael Tuexen.Fn sctp:::state-change 2071e88cc8bSMichael Tuexenprobes are compatible with the 2081e88cc8bSMichael Tuexen.Nm sctp 2091e88cc8bSMichael Tuexenprovider in Solaris. 2101e88cc8bSMichael TuexenAll other probes are only available in FreeBSD. 2113a42a33dSDevin Teske.Sh SEE ALSO 2123a42a33dSDevin Teske.Xr dtrace 1 , 2133a42a33dSDevin Teske.Xr dtrace_ip 4 , 2143a42a33dSDevin Teske.Xr dtrace_udp 4 , 2157bda9663SMichael Tuexen.Xr dtrace_udplite 4 , 2163a42a33dSDevin Teske.Xr sctp 4 , 2173a42a33dSDevin Teske.Xr SDT 9 2183a42a33dSDevin Teske.\" .Sh HISTORY 2193a42a33dSDevin Teske.\" The 2203a42a33dSDevin Teske.\" .Nm sctp 2213a42a33dSDevin Teske.\" provider first appeared in 2223a42a33dSDevin Teske.\" .Fx 2233a42a33dSDevin Teske.\" UNKNOWN. 2243a42a33dSDevin Teske.Sh AUTHORS 2253a42a33dSDevin TeskeThis manual page was written by 2263a42a33dSDevin Teske.An Devin Teske Aq Mt dteske@FreeBSD.org . 227