2 * Copyright (c) 2001-2007, by Weongyo Jeong. All rights reserved.
3 * Copyright (c) 2011, by Michael Tuexen. All rights reserved.
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions are met:
8 * a) Redistributions of source code must retain the above copyright notice,
9 * this list of conditions and the following disclaimer.
11 * b) 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 distribution.
15 * c) Neither the name of Cisco Systems, Inc. nor the names of its
16 * contributors may be used to endorse or promote products derived
17 * from this software without specific prior written permission.
19 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
20 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
21 * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
22 * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
23 * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
24 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
25 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
26 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
27 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
28 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
29 * THE POSSIBILITY OF SUCH DAMAGE.
34 static char sccsid[] = "@(#)sctp.c 0.1 (Berkeley) 4/18/2007";
38 #include <sys/cdefs.h>
39 __FBSDID("$FreeBSD$");
41 #include <sys/param.h>
42 #include <sys/queue.h>
43 #include <sys/types.h>
44 #include <sys/socket.h>
45 #include <sys/socketvar.h>
46 #include <sys/sysctl.h>
47 #include <sys/protosw.h>
49 #include <netinet/in.h>
50 #include <netinet/sctp.h>
51 #include <netinet/sctp_constants.h>
52 #include <arpa/inet.h>
69 static void sctp_statesprint(uint32_t state);
71 #define NETSTAT_SCTP_STATES_CLOSED 0x0
72 #define NETSTAT_SCTP_STATES_BOUND 0x1
73 #define NETSTAT_SCTP_STATES_LISTEN 0x2
74 #define NETSTAT_SCTP_STATES_COOKIE_WAIT 0x3
75 #define NETSTAT_SCTP_STATES_COOKIE_ECHOED 0x4
76 #define NETSTAT_SCTP_STATES_ESTABLISHED 0x5
77 #define NETSTAT_SCTP_STATES_SHUTDOWN_SENT 0x6
78 #define NETSTAT_SCTP_STATES_SHUTDOWN_RECEIVED 0x7
79 #define NETSTAT_SCTP_STATES_SHUTDOWN_ACK_SENT 0x8
80 #define NETSTAT_SCTP_STATES_SHUTDOWN_PENDING 0x9
82 const char *sctpstates[] = {
95 LIST_HEAD(xladdr_list, xladdr_entry) xladdr_head;
97 struct xsctp_laddr *xladdr;
98 LIST_ENTRY(xladdr_entry) xladdr_entries;
101 LIST_HEAD(xraddr_list, xraddr_entry) xraddr_head;
102 struct xraddr_entry {
103 struct xsctp_raddr *xraddr;
104 LIST_ENTRY(xraddr_entry) xraddr_entries;
108 * Construct an Internet address representation.
109 * If numeric_addr has been supplied, give
110 * numeric value, otherwise try for symbolic name.
114 inetname(struct in_addr *inp)
117 static char line[MAXHOSTNAMELEN];
122 if (!numeric_addr && inp->s_addr != INADDR_ANY) {
123 int net = inet_netof(*inp);
124 int lna = inet_lnaof(*inp);
126 if (lna == INADDR_ANY) {
127 np = getnetbyaddr(net, AF_INET);
132 hp = gethostbyaddr((char *)inp, sizeof (*inp), AF_INET);
135 trimdomain(cp, strlen(cp));
139 if (inp->s_addr == INADDR_ANY)
142 strlcpy(line, cp, sizeof(line));
144 inp->s_addr = ntohl(inp->s_addr);
145 #define C(x) ((u_int)((x) & 0xff))
146 sprintf(line, "%u.%u.%u.%u", C(inp->s_addr >> 24),
147 C(inp->s_addr >> 16), C(inp->s_addr >> 8), C(inp->s_addr));
148 inp->s_addr = htonl(inp->s_addr);
155 static char ntop_buf[INET6_ADDRSTRLEN];
158 inet6name(struct in6_addr *in6p)
161 static char line[50];
163 static char domain[MAXHOSTNAMELEN];
164 static int first = 1;
166 if (first && !numeric_addr) {
168 if (gethostname(domain, MAXHOSTNAMELEN) == 0 &&
169 (cp = strchr(domain, '.')))
170 (void) strcpy(domain, cp + 1);
175 if (!numeric_addr && !IN6_IS_ADDR_UNSPECIFIED(in6p)) {
176 hp = gethostbyaddr((char *)in6p, sizeof(*in6p), AF_INET6);
178 if ((cp = strchr(hp->h_name, '.')) &&
179 !strcmp(cp + 1, domain))
184 if (IN6_IS_ADDR_UNSPECIFIED(in6p))
190 inet_ntop(AF_INET6, (void *)in6p, ntop_buf,
197 sctp_print_address(const char *container, union sctp_sockstore *address,
198 int port, int num_port)
200 struct servent *sp = 0;
205 xo_open_container(container);
207 switch (address->sa.sa_family) {
210 sprintf(line, "%.*s.", Wflag ? 39 : 16, inetname(&address->sin.sin_addr));
215 sprintf(line, "%.*s.", Wflag ? 39 : 16, inet6name(&address->sin6.sin6_addr));
219 sprintf(line, "%.*s.", Wflag ? 39 : 16, "");
222 cp = strchr(line, '\0');
223 if (!num_port && port)
224 sp = getservbyport((int)port, "sctp");
226 sprintf(cp, "%.15s ", sp ? sp->s_name : "*");
228 sprintf(cp, "%d ", ntohs((u_short)port));
229 width = Wflag ? 45 : 22;
230 xo_emit("{d:target/%-*.*s} ", width, width, line);
232 int alen = cp - line - 1, plen = strlen(cp) - 1;
233 xo_emit("{e:address/%*.*s}{e:port/%*.*s}", alen, alen, line, plen,
237 xo_close_container(container);
241 sctp_skip_xinpcb_ifneed(char *buf, const size_t buflen, size_t *offset)
244 struct xsctp_tcb *xstcb;
245 struct xsctp_raddr *xraddr;
246 struct xsctp_laddr *xladdr;
248 while (*offset < buflen) {
249 xladdr = (struct xsctp_laddr *)(buf + *offset);
250 *offset += sizeof(struct xsctp_laddr);
251 if (xladdr->last == 1)
255 while (*offset < buflen) {
256 xstcb = (struct xsctp_tcb *)(buf + *offset);
257 *offset += sizeof(struct xsctp_tcb);
258 if (xstcb->last == 1)
263 while (*offset < buflen) {
264 xladdr = (struct xsctp_laddr *)(buf + *offset);
265 *offset += sizeof(struct xsctp_laddr);
266 if (xladdr->last == 1)
270 while (*offset < buflen) {
271 xraddr = (struct xsctp_raddr *)(buf + *offset);
272 *offset += sizeof(struct xsctp_raddr);
273 if (xraddr->last == 1)
279 * If Lflag is set, we don't care about the return value.
288 sctp_process_tcb(struct xsctp_tcb *xstcb,
289 char *buf, const size_t buflen, size_t *offset, int *indent)
291 int i, xl_total = 0, xr_total = 0, x_max;
292 struct xsctp_raddr *xraddr;
293 struct xsctp_laddr *xladdr;
294 struct xladdr_entry *prev_xl = NULL, *xl = NULL, *xl_tmp;
295 struct xraddr_entry *prev_xr = NULL, *xr = NULL, *xr_tmp;
297 LIST_INIT(&xladdr_head);
298 LIST_INIT(&xraddr_head);
301 * Make `struct xladdr_list' list and `struct xraddr_list' list
302 * to handle the address flexibly.
304 while (*offset < buflen) {
305 xladdr = (struct xsctp_laddr *)(buf + *offset);
306 *offset += sizeof(struct xsctp_laddr);
307 if (xladdr->last == 1)
311 xl = malloc(sizeof(struct xladdr_entry));
313 xo_warnx("malloc %lu bytes",
314 (u_long)sizeof(struct xladdr_entry));
319 LIST_INSERT_HEAD(&xladdr_head, xl, xladdr_entries);
321 LIST_INSERT_AFTER(prev_xl, xl, xladdr_entries);
325 while (*offset < buflen) {
326 xraddr = (struct xsctp_raddr *)(buf + *offset);
327 *offset += sizeof(struct xsctp_raddr);
328 if (xraddr->last == 1)
332 xr = malloc(sizeof(struct xraddr_entry));
334 xo_warnx("malloc %lu bytes",
335 (u_long)sizeof(struct xraddr_entry));
340 LIST_INSERT_HEAD(&xraddr_head, xr, xraddr_entries);
342 LIST_INSERT_AFTER(prev_xr, xr, xraddr_entries);
347 * Let's print the address infos.
349 xo_open_list("address");
350 xl = LIST_FIRST(&xladdr_head);
351 xr = LIST_FIRST(&xraddr_head);
352 x_max = (xl_total > xr_total) ? xl_total : xr_total;
353 for (i = 0; i < x_max; i++) {
354 xo_open_instance("address");
356 if (((*indent == 0) && i > 0) || *indent > 0)
357 xo_emit("{P:/%-12s} ", " ");
360 sctp_print_address("local", &(xl->xladdr->address),
361 htons(xstcb->local_port), numeric_port);
364 xo_emit("{P:/%-45s} ", " ");
366 xo_emit("{P:/%-22s} ", " ");
370 if (xr != NULL && !Lflag) {
371 sctp_print_address("remote", &(xr->xraddr->address),
372 htons(xstcb->remote_port), numeric_port);
376 xl = LIST_NEXT(xl, xladdr_entries);
378 xr = LIST_NEXT(xr, xraddr_entries);
380 if (i == 0 && !Lflag)
381 sctp_statesprint(xstcb->state);
385 xo_close_instance("address");
390 * Free the list which be used to handle the address.
392 xl = LIST_FIRST(&xladdr_head);
394 xl_tmp = LIST_NEXT(xl, xladdr_entries);
399 xr = LIST_FIRST(&xraddr_head);
401 xr_tmp = LIST_NEXT(xr, xraddr_entries);
408 sctp_process_inpcb(struct xsctp_inpcb *xinpcb,
409 char *buf, const size_t buflen, size_t *offset)
411 int indent = 0, xladdr_total = 0, is_listening = 0;
412 static int first = 1;
413 const char *tname, *pname;
414 struct xsctp_tcb *xstcb;
415 struct xsctp_laddr *xladdr;
419 if (xinpcb->maxqlen > 0)
424 xo_emit("Active SCTP associations");
426 xo_emit(" (including servers)");
428 xo_emit("Current listen queue sizes (qlen/maxqlen)");
431 xo_emit("{T:/%-6.6s} {T:/%-5.5s} {T:/%-8.8s} "
433 "Proto", "Type", "Listen", "Local Address");
436 xo_emit("{T:/%-6.6s} {T:/%-5.5s} {T:/%-45.45s} "
437 "{T:/%-45.45s} {T:/%s}\n",
439 "Local Address", "Foreign Address",
442 xo_emit("{T:/%-6.6s} {T:/%-5.5s} {T:/%-22.22s} "
443 "{T:/%-22.22s} {T:/%s}\n",
445 "Local Address", "Foreign Address",
449 xladdr = (struct xsctp_laddr *)(buf + *offset);
450 if (Lflag && !is_listening) {
451 sctp_skip_xinpcb_ifneed(buf, buflen, offset);
455 if (xinpcb->flags & SCTP_PCB_FLAGS_BOUND_V6) {
456 /* Can't distinguish between sctp46 and sctp6 */
462 if (xinpcb->flags & SCTP_PCB_FLAGS_TCPTYPE)
464 else if (xinpcb->flags & SCTP_PCB_FLAGS_UDPTYPE)
472 snprintf(buf1, 9, "%hu/%hu", xinpcb->qlen, xinpcb->maxqlen);
473 xo_emit("{:protocol/%-6.6s/%s} {:type/%-5.5s/%s} ",
475 xo_emit("{d:queues/%-8.8s}{e:queue-len/%hu}"
476 "{e:max-queue-len/%hu} ",
477 buf1, xinpcb->qlen, xinpcb->maxqlen);
480 offset_laddr = *offset;
483 xo_open_list("local-address");
485 while (*offset < buflen) {
486 xladdr = (struct xsctp_laddr *)(buf + *offset);
487 *offset += sizeof(struct xsctp_laddr);
489 if (aflag && !Lflag && (xladdr_total == 0) && process_closed) {
490 xo_open_instance("local-address");
492 xo_emit("{:protocol/%-6.6s/%s} "
493 "{:type/%-5.5s/%s} ", pname, tname);
495 xo_emit("{P:/%-91.91s/%s} "
496 "{:state/CLOSED}", " ");
498 xo_emit("{P:/%-45.45s/%s} "
499 "{:state/CLOSED}", " ");
501 xo_close_instance("local-address");
503 if (process_closed || is_listening) {
509 if (!Lflag && !is_listening && !process_closed)
512 xo_open_instance("local-address");
514 if (xladdr_total == 0) {
515 xo_emit("{:protocol/%-6.6s/%s} {:type/%-5.5s/%s} ",
519 xo_emit(Lflag ? "{P:/%-21.21s} " : "{P:/%-12.12s} ",
522 sctp_print_address("local", &(xladdr->address),
523 htons(xinpcb->local_port), numeric_port);
524 if (aflag && !Lflag && xladdr_total == 0) {
526 if (process_closed) {
527 xo_emit("{P:/%-45.45s} "
528 "{:state/CLOSED}", " ");
530 xo_emit("{P:/%-45.45s} "
531 "{:state:LISTEN}", " ");
534 if (process_closed) {
535 xo_emit("{P:/%-22.22s} "
536 "{:state/CLOSED}", " ");
538 xo_emit("{P:/%-22.22s} "
539 "{:state/LISTEN}", " ");
544 xo_close_instance("local-address");
547 xstcb = (struct xsctp_tcb *)(buf + *offset);
548 *offset += sizeof(struct xsctp_tcb);
549 if (aflag && (xladdr_total == 0) && xstcb->last && !process_closed) {
551 *offset = offset_laddr;
554 while (xstcb->last == 0 && *offset < buflen) {
555 xo_emit("{:protocol/%-6.6s/%s} {:type/%-5.5s/%s} ",
557 sctp_process_tcb(xstcb, buf, buflen, offset, &indent);
559 xstcb = (struct xsctp_tcb *)(buf + *offset);
560 *offset += sizeof(struct xsctp_tcb);
563 xo_close_list("local-address");
567 * Print a summary of SCTP connections related to an Internet
571 sctp_protopr(u_long off __unused,
572 const char *name __unused, int af1 __unused, int proto)
575 const char *mibvar = "net.inet.sctp.assoclist";
578 struct xsctp_inpcb *xinpcb;
580 if (proto != IPPROTO_SCTP)
583 if (sysctlbyname(mibvar, 0, &len, 0, 0) < 0) {
585 xo_warn("sysctl: %s", mibvar);
588 if ((buf = malloc(len)) == 0) {
589 xo_warnx("malloc %lu bytes", (u_long)len);
592 if (sysctlbyname(mibvar, buf, &len, 0, 0) < 0) {
593 xo_warn("sysctl: %s", mibvar);
598 xinpcb = (struct xsctp_inpcb *)(buf + offset);
599 offset += sizeof(struct xsctp_inpcb);
600 while (xinpcb->last == 0 && offset < len) {
601 sctp_process_inpcb(xinpcb, buf, (const size_t)len,
604 xinpcb = (struct xsctp_inpcb *)(buf + offset);
605 offset += sizeof(struct xsctp_inpcb);
612 sctp_statesprint(uint32_t state)
617 case SCTP_STATE_COOKIE_WAIT:
618 idx = NETSTAT_SCTP_STATES_COOKIE_WAIT;
620 case SCTP_STATE_COOKIE_ECHOED:
621 idx = NETSTAT_SCTP_STATES_COOKIE_ECHOED;
623 case SCTP_STATE_OPEN:
624 idx = NETSTAT_SCTP_STATES_ESTABLISHED;
626 case SCTP_STATE_SHUTDOWN_SENT:
627 idx = NETSTAT_SCTP_STATES_SHUTDOWN_SENT;
629 case SCTP_STATE_SHUTDOWN_RECEIVED:
630 idx = NETSTAT_SCTP_STATES_SHUTDOWN_RECEIVED;
632 case SCTP_STATE_SHUTDOWN_ACK_SENT:
633 idx = NETSTAT_SCTP_STATES_SHUTDOWN_ACK_SENT;
635 case SCTP_STATE_SHUTDOWN_PENDING:
636 idx = NETSTAT_SCTP_STATES_SHUTDOWN_PENDING;
639 xo_emit("UNKNOWN {:state/0x%08x}", state);
643 xo_emit("{:state/%s}", sctpstates[idx]);
647 * Dump SCTP statistics structure.
650 sctp_stats(u_long off, const char *name, int af1 __unused, int proto __unused)
652 struct sctpstat sctpstat, zerostat;
653 size_t len = sizeof(sctpstat);
657 memset(&zerostat, 0, len);
658 if (sysctlbyname("net.inet.sctp.stats", &sctpstat, &len,
659 zflag ? &zerostat : NULL, zflag ? len : 0) < 0) {
661 xo_warn("sysctl: net.inet.sctp.stats");
665 kread(off, &sctpstat, len);
667 xo_open_container(name);
668 xo_emit("{T:/%s}:\n", name);
670 #define p(f, m) if (sctpstat.f || sflag <= 1) \
671 xo_emit(m, (uintmax_t)sctpstat.f, plural(sctpstat.f))
672 #define p1a(f, m) if (sctpstat.f || sflag <= 1) \
673 xo_emit(m, (uintmax_t)sctpstat.f)
678 p(sctps_recvpackets, "\t{:received-packets/%ju} "
679 "{N:/input packet%s}\n");
680 p(sctps_recvdatagrams, "\t\t{:received-datagrams/%ju} "
681 "{N:/datagram%s}\n");
682 p(sctps_recvpktwithdata, "\t\t{:received-with-data/%ju} "
683 "{N:/packet%s that had data}\n");
684 p(sctps_recvsacks, "\t\t{:received-sack-chunks/%ju} "
685 "{N:/input SACK chunk%s}\n");
686 p(sctps_recvdata, "\t\t{:received-data-chunks/%ju} "
687 "{N:/input DATA chunk%s}\n");
688 p(sctps_recvdupdata, "\t\t{:received-duplicate-data-chunks/%ju} "
689 "{N:/duplicate DATA chunk%s}\n");
690 p(sctps_recvheartbeat, "\t\t{:received-hb-chunks/%ju} "
691 "{N:/input HB chunk%s}\n");
692 p(sctps_recvheartbeatack, "\t\t{:received-hb-ack-chunks/%ju} "
693 "{N:/HB-ACK chunk%s}\n");
694 p(sctps_recvecne, "\t\t{:received-ecne-chunks/%ju} "
695 "{N:/input ECNE chunk%s}\n");
696 p(sctps_recvauth, "\t\t{:received-auth-chunks/%ju} "
697 "{N:/input AUTH chunk%s}\n");
698 p(sctps_recvauthmissing, "\t\t{:dropped-missing-auth/%ju} "
699 "{N:/chunk%s missing AUTH}\n");
700 p(sctps_recvivalhmacid, "\t\t{:dropped-invalid-hmac/%ju} "
701 "{N:/invalid HMAC id%s received}\n");
702 p(sctps_recvivalkeyid, "\t\t{:dropped-invalid-secret/%ju} "
703 "{N:/invalid secret id%s received}\n");
704 p1a(sctps_recvauthfailed, "\t\t{:dropped-auth-failed/%ju} "
705 "{N:/auth failed}\n");
706 p1a(sctps_recvexpress, "\t\t{:received-fast-path/%ju} "
707 "{N:/fast path receives all one chunk}\n");
708 p1a(sctps_recvexpressm, "\t\t{:receives-fast-path-multipart/%ju} "
709 "{N:/fast path multi-part data}\n");
714 p(sctps_sendpackets, "\t{:sent-packets/%ju} "
715 "{N:/output packet%s}\n");
716 p(sctps_sendsacks, "\t\t{:sent-sacks/%ju} "
717 "{N:/output SACK%s}\n");
718 p(sctps_senddata, "\t\t{:sent-data-chunks/%ju} "
719 "{N:/output DATA chunk%s}\n");
720 p(sctps_sendretransdata, "\t\t{:sent-retransmitted-data-chunks/%ju} "
721 "{N:/retransmitted DATA chunk%s}\n");
722 p(sctps_sendfastretrans, "\t\t"
723 "{:sent-fast-retransmitted-data-chunks/%ju} "
724 "{N:/fast retransmitted DATA chunk%s}\n");
725 p(sctps_sendmultfastretrans, "\t\t"
726 "{:sent-fast-retransmitted-data-chunk-multiple-times/%ju} "
727 "{N:/FR'%s that happened more than once to same chunk}\n");
728 p(sctps_sendheartbeat, "\t\t{:sent-hb-chunks/%ju} "
729 "{N:/output HB chunk%s}\n");
730 p(sctps_sendecne, "\t\t{:sent-ecne-chunks/%ju} "
731 "{N:/output ECNE chunk%s}\n");
732 p(sctps_sendauth, "\t\t{:sent-auth-chunks/%ju} "
733 "{N:/output AUTH chunk%s}\n");
734 p1a(sctps_senderrors, "\t\t{:send-errors/%ju} "
735 "{N:/ip_output error counter}\n");
738 * PCKDROPREP statistics
740 xo_emit("\t{T:Packet drop statistics}:\n");
741 xo_open_container("drop-statistics");
742 p1a(sctps_pdrpfmbox, "\t\t{:middle-box/%ju} "
743 "{N:/from middle box}\n");
744 p1a(sctps_pdrpfehos, "\t\t{:end-host/%ju} "
745 "{N:/from end host}\n");
746 p1a(sctps_pdrpmbda, "\t\t{:with-data/%ju} "
748 p1a(sctps_pdrpmbct, "\t\t{:non-data/%ju} "
749 "{N:/non-data, non-endhost}\n");
750 p1a(sctps_pdrpbwrpt, "\t\t{:non-endhost/%ju} "
751 "{N:/non-endhost, bandwidth rep only}\n");
752 p1a(sctps_pdrpcrupt, "\t\t{:short-header/%ju} "
753 "{N:/not enough for chunk header}\n");
754 p1a(sctps_pdrpnedat, "\t\t{:short-data/%ju} "
755 "{N:/not enough data to confirm}\n");
756 p1a(sctps_pdrppdbrk, "\t\t{:chunk-break/%ju} "
757 "{N:/where process_chunk_drop said break}\n");
758 p1a(sctps_pdrptsnnf, "\t\t{:tsn-not-found/%ju} "
759 "{N:/failed to find TSN}\n");
760 p1a(sctps_pdrpdnfnd, "\t\t{:reverse-tsn/%ju} "
761 "{N:/attempt reverse TSN lookup}\n");
762 p1a(sctps_pdrpdiwnp, "\t\t{:confirmed-zero-window/%ju} "
763 "{N:/e-host confirms zero-rwnd}\n");
764 p1a(sctps_pdrpdizrw, "\t\t{:middle-box-no-space/%ju} "
765 "{N:/midbox confirms no space}\n");
766 p1a(sctps_pdrpbadd, "\t\t{:bad-data/%ju} "
767 "{N:/data did not match TSN}\n");
768 p(sctps_pdrpmark, "\t\t{:tsn-marked-fast-retransmission/%ju} "
769 "{N:/TSN'%s marked for Fast Retran}\n");
770 xo_close_container("drop-statistics");
775 xo_emit("\t{T:Timeouts}:\n");
776 xo_open_container("timeouts");
777 p(sctps_timoiterator, "\t\t{:iterator/%ju} "
778 "{N:/iterator timer%s fired}\n");
779 p(sctps_timodata, "\t\t{:t3-data/%ju} "
780 "{N:/T3 data time out%s}\n");
781 p(sctps_timowindowprobe, "\t\t{:window-probe/%ju} "
782 "{N:/window probe (T3) timer%s fired}\n");
783 p(sctps_timoinit, "\t\t{:init-timer/%ju} "
784 "{N:/INIT timer%s fired}\n");
785 p(sctps_timosack, "\t\t{:sack-timer/%ju} "
786 "{N:/sack timer%s fired}\n");
787 p(sctps_timoshutdown, "\t\t{:shutdown-timer/%ju} "
788 "{N:/shutdown timer%s fired}\n");
789 p(sctps_timoheartbeat, "\t\t{:heartbeat-timer/%ju} "
790 "{N:/heartbeat timer%s fired}\n");
791 p1a(sctps_timocookie, "\t\t{:cookie-timer/%ju} "
792 "{N:/a cookie timeout fired}\n");
793 p1a(sctps_timosecret, "\t\t{:endpoint-changed-cookie/%ju} "
794 "{N:/an endpoint changed its cook}ie"
796 p(sctps_timopathmtu, "\t\t{:pmtu-timer/%ju} "
797 "{N:/PMTU timer%s fired}\n");
798 p(sctps_timoshutdownack, "\t\t{:shutdown-timer/%ju} "
799 "{N:/shutdown ack timer%s fired}\n");
800 p(sctps_timoshutdownguard, "\t\t{:shutdown-guard-timer/%ju} "
801 "{N:/shutdown guard timer%s fired}\n");
802 p(sctps_timostrmrst, "\t\t{:stream-reset-timer/%ju} "
803 "{N:/stream reset timer%s fired}\n");
804 p(sctps_timoearlyfr, "\t\t{:early-fast-retransmission-timer/%ju} "
805 "{N:/early FR timer%s fired}\n");
806 p1a(sctps_timoasconf, "\t\t{:asconf-timer/%ju} "
807 "{N:/an asconf timer fired}\n");
808 p1a(sctps_timoautoclose, "\t\t{:auto-close-timer/%ju} "
809 "{N:/auto close timer fired}\n");
810 p(sctps_timoassockill, "\t\t{:asoc-free-timer/%ju} "
811 "{N:/asoc free timer%s expired}\n");
812 p(sctps_timoinpkill, "\t\t{:input-free-timer/%ju} "
813 "{N:/inp free timer%s expired}\n");
814 xo_close_container("timeouts");
818 * Early fast retransmission counters
820 p(sctps_earlyfrstart, "\t%ju TODO:sctps_earlyfrstart\n");
821 p(sctps_earlyfrstop, "\t%ju TODO:sctps_earlyfrstop\n");
822 p(sctps_earlyfrmrkretrans, "\t%ju TODO:sctps_earlyfrmrkretrans\n");
823 p(sctps_earlyfrstpout, "\t%ju TODO:sctps_earlyfrstpout\n");
824 p(sctps_earlyfrstpidsck1, "\t%ju TODO:sctps_earlyfrstpidsck1\n");
825 p(sctps_earlyfrstpidsck2, "\t%ju TODO:sctps_earlyfrstpidsck2\n");
826 p(sctps_earlyfrstpidsck3, "\t%ju TODO:sctps_earlyfrstpidsck3\n");
827 p(sctps_earlyfrstpidsck4, "\t%ju TODO:sctps_earlyfrstpidsck4\n");
828 p(sctps_earlyfrstrid, "\t%ju TODO:sctps_earlyfrstrid\n");
829 p(sctps_earlyfrstrout, "\t%ju TODO:sctps_earlyfrstrout\n");
830 p(sctps_earlyfrstrtmr, "\t%ju TODO:sctps_earlyfrstrtmr\n");
836 p1a(sctps_hdrops, "\t{:dropped-too-short/%ju} "
837 "{N:/packet shorter than header}\n");
838 p1a(sctps_badsum, "\t{:dropped-bad-checksum/%ju} "
839 "{N:/checksum error}\n");
840 p1a(sctps_noport, "\t{:dropped-no-endpoint/%ju} "
841 "{N:/no endpoint for port}\n");
842 p1a(sctps_badvtag, "\t{:dropped-bad-v-tag/%ju} "
844 p1a(sctps_badsid, "\t{:dropped-bad-sid/%ju} "
846 p1a(sctps_nomem, "\t{:dropped-no-memory/%ju} "
848 p1a(sctps_fastretransinrtt, "\t{:multiple-fast-retransmits-in-rtt/%ju} "
849 "{N:/number of multiple FR in a RT}T window\n");
851 p(sctps_markedretrans, "\t%ju TODO:sctps_markedretrans\n");
853 p1a(sctps_naglesent, "\t{:rfc813-sent/%ju} "
854 "{N:/RFC813 allowed sending}\n");
855 p1a(sctps_naglequeued, "\t{:rfc813-queued/%ju} "
856 "{N:/RFC813 does not allow sending}\n");
857 p1a(sctps_maxburstqueued, "\t{:max-burst-queued/%ju} "
858 "{N:/times max burst prohibited sending}\n");
859 p1a(sctps_ifnomemqueued, "\t{:no-memory-in-interface/%ju} "
860 "{N:/look ahead tells us no memory in interface}\n");
861 p(sctps_windowprobed, "\t{:sent-window-probes/%ju} "
862 "{N:/number%s of window probes sent}\n");
863 p(sctps_lowlevelerr, "\t{:low-level-err/%ju} "
864 "{N:/time%s an output error to clamp down on next user send}\n");
865 p(sctps_lowlevelerrusr, "\t{:low-level-user-error/%ju} "
866 "{N:/time%s sctp_senderrors were caused from a user}\n");
867 p(sctps_datadropchklmt, "\t{:dropped-chunk-limit/%ju} "
868 "{N:/number of in data drop%s due to chunk limit reached}\n");
869 p(sctps_datadroprwnd, "\t{:dropped-rwnd-limit/%ju} "
870 "{N:/number of in data drop%s due to rwnd limit reached}\n");
871 p(sctps_ecnereducedcwnd, "\t{:ecn-reduced-cwnd/%ju} "
872 "{N:/time%s a ECN reduced the cwnd}\n");
873 p1a(sctps_vtagexpress, "\t{:v-tag-express-lookup/%ju} "
874 "{N:/used express lookup via vtag}\n");
875 p1a(sctps_vtagbogus, "\t{:v-tag-collision/%ju} "
876 "{N:/collision in express lookup}\n");
877 p(sctps_primary_randry, "\t{:sender-ran-dry/%ju} "
878 "{N:/time%s the sender ran dry of user data on primary}\n");
879 p1a(sctps_cmt_randry, "\t{:cmt-ran-dry/%ju} "
880 "{N:/same for above}\n");
881 p(sctps_slowpath_sack, "\t{:slow-path-sack/%ju} "
882 "{N:/sack%s the slow way}\n");
883 p(sctps_wu_sacks_sent, "\t{:sent-window-update-only-sack/%ju} "
884 "{N:/window update only sack%s sent}\n");
885 p(sctps_sends_with_flags, "\t{:sent-with-sinfo/%ju} "
886 "{N:/send%s with sinfo_flags !=0}\n");
887 p(sctps_sends_with_unord, "\t{:sent-with-unordered/%ju} "
888 "{N:/unordered send%s}\n");
889 p(sctps_sends_with_eof, "\t{:sent-with-eof/%ju} "
890 "{N:/send%s with EOF flag set}\n");
891 p(sctps_sends_with_abort, "\t{:sent-with-abort/%ju} "
892 "{N:/send%s with ABORT flag set}\n");
893 p(sctps_protocol_drain_calls, "\t{:protocol-drain-called/%ju} "
894 "{N:/time%s protocol drain called}\n");
895 p(sctps_protocol_drains_done, "\t{:protocol-drain/%ju} "
896 "{N:/time%s we did a protocol drain}\n");
897 p(sctps_read_peeks, "\t{:read-with-peek/%ju} "
898 "{N:/time%s recv was called with peek}\n");
899 p(sctps_cached_chk, "\t{:cached-chunks/%ju} "
900 "{N:/cached chunk%s used}\n");
901 p1a(sctps_cached_strmoq, "\t{:cached-output-queue-used/%ju} "
902 "{N:/cached stream oq's used}\n");
903 p(sctps_left_abandon, "\t{:messages-abandoned/%ju} "
904 "{N:/unread message%s abandonded by close}\n");
905 p1a(sctps_send_burst_avoid, "\t{:send-burst-avoidance/%ju} "
906 "{N:/send burst avoidance, already max burst inflight to net}\n");
907 p1a(sctps_send_cwnd_avoid, "\t{:send-cwnd-avoidance/%ju} "
908 "{N:/send cwnd full avoidance, already max burst inflight "
910 p(sctps_fwdtsn_map_over, "\t{:tsn-map-overruns/%ju} "
911 "{N:/number of map array over-run%s via fwd-tsn's}\n");
915 xo_close_container(name);