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 static const char *sctpstates[] = {
95 static LIST_HEAD(xladdr_list, xladdr_entry) xladdr_head;
97 struct xsctp_laddr *xladdr;
98 LIST_ENTRY(xladdr_entry) xladdr_entries;
101 static 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, sizeof buf1, "%u/%u",
473 xinpcb->qlen, xinpcb->maxqlen);
474 xo_emit("{:protocol/%-6.6s/%s} {:type/%-5.5s/%s} ",
476 xo_emit("{d:queues/%-8.8s}{e:queue-len/%hu}"
477 "{e:max-queue-len/%hu} ",
478 buf1, xinpcb->qlen, xinpcb->maxqlen);
481 offset_laddr = *offset;
484 xo_open_list("local-address");
486 while (*offset < buflen) {
487 xladdr = (struct xsctp_laddr *)(buf + *offset);
488 *offset += sizeof(struct xsctp_laddr);
490 if (aflag && !Lflag && (xladdr_total == 0) && process_closed) {
491 xo_open_instance("local-address");
493 xo_emit("{:protocol/%-6.6s/%s} "
494 "{:type/%-5.5s/%s} ", pname, tname);
496 xo_emit("{P:/%-91.91s/%s} "
497 "{:state/CLOSED}", " ");
499 xo_emit("{P:/%-45.45s/%s} "
500 "{:state/CLOSED}", " ");
502 xo_close_instance("local-address");
504 if (process_closed || is_listening) {
510 if (!Lflag && !is_listening && !process_closed)
513 xo_open_instance("local-address");
515 if (xladdr_total == 0) {
516 xo_emit("{:protocol/%-6.6s/%s} {:type/%-5.5s/%s} ",
520 xo_emit(Lflag ? "{P:/%-21.21s} " : "{P:/%-12.12s} ",
523 sctp_print_address("local", &(xladdr->address),
524 htons(xinpcb->local_port), numeric_port);
525 if (aflag && !Lflag && xladdr_total == 0) {
527 if (process_closed) {
528 xo_emit("{P:/%-45.45s} "
529 "{:state/CLOSED}", " ");
531 xo_emit("{P:/%-45.45s} "
532 "{:state:LISTEN}", " ");
535 if (process_closed) {
536 xo_emit("{P:/%-22.22s} "
537 "{:state/CLOSED}", " ");
539 xo_emit("{P:/%-22.22s} "
540 "{:state/LISTEN}", " ");
545 xo_close_instance("local-address");
548 xstcb = (struct xsctp_tcb *)(buf + *offset);
549 *offset += sizeof(struct xsctp_tcb);
550 if (aflag && (xladdr_total == 0) && xstcb->last && !process_closed) {
552 *offset = offset_laddr;
555 while (xstcb->last == 0 && *offset < buflen) {
556 xo_emit("{:protocol/%-6.6s/%s} {:type/%-5.5s/%s} ",
558 sctp_process_tcb(xstcb, buf, buflen, offset, &indent);
560 xstcb = (struct xsctp_tcb *)(buf + *offset);
561 *offset += sizeof(struct xsctp_tcb);
564 xo_close_list("local-address");
568 * Print a summary of SCTP connections related to an Internet
572 sctp_protopr(u_long off __unused,
573 const char *name __unused, int af1 __unused, int proto)
576 const char *mibvar = "net.inet.sctp.assoclist";
579 struct xsctp_inpcb *xinpcb;
581 if (proto != IPPROTO_SCTP)
584 if (sysctlbyname(mibvar, 0, &len, 0, 0) < 0) {
586 xo_warn("sysctl: %s", mibvar);
589 if ((buf = malloc(len)) == 0) {
590 xo_warnx("malloc %lu bytes", (u_long)len);
593 if (sysctlbyname(mibvar, buf, &len, 0, 0) < 0) {
594 xo_warn("sysctl: %s", mibvar);
599 xinpcb = (struct xsctp_inpcb *)(buf + offset);
600 offset += sizeof(struct xsctp_inpcb);
601 while (xinpcb->last == 0 && offset < len) {
602 sctp_process_inpcb(xinpcb, buf, (const size_t)len,
605 xinpcb = (struct xsctp_inpcb *)(buf + offset);
606 offset += sizeof(struct xsctp_inpcb);
613 sctp_statesprint(uint32_t state)
619 idx = NETSTAT_SCTP_STATES_CLOSED;
622 idx = NETSTAT_SCTP_STATES_BOUND;
625 idx = NETSTAT_SCTP_STATES_LISTEN;
627 case SCTP_COOKIE_WAIT:
628 idx = NETSTAT_SCTP_STATES_COOKIE_WAIT;
630 case SCTP_COOKIE_ECHOED:
631 idx = NETSTAT_SCTP_STATES_COOKIE_ECHOED;
633 case SCTP_ESTABLISHED:
634 idx = NETSTAT_SCTP_STATES_ESTABLISHED;
636 case SCTP_SHUTDOWN_SENT:
637 idx = NETSTAT_SCTP_STATES_SHUTDOWN_SENT;
639 case SCTP_SHUTDOWN_RECEIVED:
640 idx = NETSTAT_SCTP_STATES_SHUTDOWN_RECEIVED;
642 case SCTP_SHUTDOWN_ACK_SENT:
643 idx = NETSTAT_SCTP_STATES_SHUTDOWN_ACK_SENT;
645 case SCTP_SHUTDOWN_PENDING:
646 idx = NETSTAT_SCTP_STATES_SHUTDOWN_PENDING;
649 xo_emit("UNKNOWN {:state/0x%08x}", state);
653 xo_emit("{:state/%s}", sctpstates[idx]);
657 * Dump SCTP statistics structure.
660 sctp_stats(u_long off, const char *name, int af1 __unused, int proto __unused)
662 struct sctpstat sctpstat;
664 if (fetch_stats("net.inet.sctp.stats", off, &sctpstat,
665 sizeof(sctpstat), kread) != 0)
668 xo_open_container(name);
669 xo_emit("{T:/%s}:\n", name);
671 #define p(f, m) if (sctpstat.f || sflag <= 1) \
672 xo_emit(m, (uintmax_t)sctpstat.f, plural(sctpstat.f))
673 #define p1a(f, m) if (sctpstat.f || sflag <= 1) \
674 xo_emit(m, (uintmax_t)sctpstat.f)
679 p(sctps_recvpackets, "\t{:received-packets/%ju} "
680 "{N:/input packet%s}\n");
681 p(sctps_recvdatagrams, "\t\t{:received-datagrams/%ju} "
682 "{N:/datagram%s}\n");
683 p(sctps_recvpktwithdata, "\t\t{:received-with-data/%ju} "
684 "{N:/packet%s that had data}\n");
685 p(sctps_recvsacks, "\t\t{:received-sack-chunks/%ju} "
686 "{N:/input SACK chunk%s}\n");
687 p(sctps_recvdata, "\t\t{:received-data-chunks/%ju} "
688 "{N:/input DATA chunk%s}\n");
689 p(sctps_recvdupdata, "\t\t{:received-duplicate-data-chunks/%ju} "
690 "{N:/duplicate DATA chunk%s}\n");
691 p(sctps_recvheartbeat, "\t\t{:received-hb-chunks/%ju} "
692 "{N:/input HB chunk%s}\n");
693 p(sctps_recvheartbeatack, "\t\t{:received-hb-ack-chunks/%ju} "
694 "{N:/HB-ACK chunk%s}\n");
695 p(sctps_recvecne, "\t\t{:received-ecne-chunks/%ju} "
696 "{N:/input ECNE chunk%s}\n");
697 p(sctps_recvauth, "\t\t{:received-auth-chunks/%ju} "
698 "{N:/input AUTH chunk%s}\n");
699 p(sctps_recvauthmissing, "\t\t{:dropped-missing-auth/%ju} "
700 "{N:/chunk%s missing AUTH}\n");
701 p(sctps_recvivalhmacid, "\t\t{:dropped-invalid-hmac/%ju} "
702 "{N:/invalid HMAC id%s received}\n");
703 p(sctps_recvivalkeyid, "\t\t{:dropped-invalid-secret/%ju} "
704 "{N:/invalid secret id%s received}\n");
705 p1a(sctps_recvauthfailed, "\t\t{:dropped-auth-failed/%ju} "
706 "{N:/auth failed}\n");
707 p1a(sctps_recvexpress, "\t\t{:received-fast-path/%ju} "
708 "{N:/fast path receives all one chunk}\n");
709 p1a(sctps_recvexpressm, "\t\t{:receives-fast-path-multipart/%ju} "
710 "{N:/fast path multi-part data}\n");
715 p(sctps_sendpackets, "\t{:sent-packets/%ju} "
716 "{N:/output packet%s}\n");
717 p(sctps_sendsacks, "\t\t{:sent-sacks/%ju} "
718 "{N:/output SACK%s}\n");
719 p(sctps_senddata, "\t\t{:sent-data-chunks/%ju} "
720 "{N:/output DATA chunk%s}\n");
721 p(sctps_sendretransdata, "\t\t{:sent-retransmitted-data-chunks/%ju} "
722 "{N:/retransmitted DATA chunk%s}\n");
723 p(sctps_sendfastretrans, "\t\t"
724 "{:sent-fast-retransmitted-data-chunks/%ju} "
725 "{N:/fast retransmitted DATA chunk%s}\n");
726 p(sctps_sendmultfastretrans, "\t\t"
727 "{:sent-fast-retransmitted-data-chunk-multiple-times/%ju} "
728 "{N:/FR'%s that happened more than once to same chunk}\n");
729 p(sctps_sendheartbeat, "\t\t{:sent-hb-chunks/%ju} "
730 "{N:/output HB chunk%s}\n");
731 p(sctps_sendecne, "\t\t{:sent-ecne-chunks/%ju} "
732 "{N:/output ECNE chunk%s}\n");
733 p(sctps_sendauth, "\t\t{:sent-auth-chunks/%ju} "
734 "{N:/output AUTH chunk%s}\n");
735 p1a(sctps_senderrors, "\t\t{:send-errors/%ju} "
736 "{N:/ip_output error counter}\n");
739 * PCKDROPREP statistics
741 xo_emit("\t{T:Packet drop statistics}:\n");
742 xo_open_container("drop-statistics");
743 p1a(sctps_pdrpfmbox, "\t\t{:middle-box/%ju} "
744 "{N:/from middle box}\n");
745 p1a(sctps_pdrpfehos, "\t\t{:end-host/%ju} "
746 "{N:/from end host}\n");
747 p1a(sctps_pdrpmbda, "\t\t{:with-data/%ju} "
749 p1a(sctps_pdrpmbct, "\t\t{:non-data/%ju} "
750 "{N:/non-data, non-endhost}\n");
751 p1a(sctps_pdrpbwrpt, "\t\t{:non-endhost/%ju} "
752 "{N:/non-endhost, bandwidth rep only}\n");
753 p1a(sctps_pdrpcrupt, "\t\t{:short-header/%ju} "
754 "{N:/not enough for chunk header}\n");
755 p1a(sctps_pdrpnedat, "\t\t{:short-data/%ju} "
756 "{N:/not enough data to confirm}\n");
757 p1a(sctps_pdrppdbrk, "\t\t{:chunk-break/%ju} "
758 "{N:/where process_chunk_drop said break}\n");
759 p1a(sctps_pdrptsnnf, "\t\t{:tsn-not-found/%ju} "
760 "{N:/failed to find TSN}\n");
761 p1a(sctps_pdrpdnfnd, "\t\t{:reverse-tsn/%ju} "
762 "{N:/attempt reverse TSN lookup}\n");
763 p1a(sctps_pdrpdiwnp, "\t\t{:confirmed-zero-window/%ju} "
764 "{N:/e-host confirms zero-rwnd}\n");
765 p1a(sctps_pdrpdizrw, "\t\t{:middle-box-no-space/%ju} "
766 "{N:/midbox confirms no space}\n");
767 p1a(sctps_pdrpbadd, "\t\t{:bad-data/%ju} "
768 "{N:/data did not match TSN}\n");
769 p(sctps_pdrpmark, "\t\t{:tsn-marked-fast-retransmission/%ju} "
770 "{N:/TSN'%s marked for Fast Retran}\n");
771 xo_close_container("drop-statistics");
776 xo_emit("\t{T:Timeouts}:\n");
777 xo_open_container("timeouts");
778 p(sctps_timoiterator, "\t\t{:iterator/%ju} "
779 "{N:/iterator timer%s fired}\n");
780 p(sctps_timodata, "\t\t{:t3-data/%ju} "
781 "{N:/T3 data time out%s}\n");
782 p(sctps_timowindowprobe, "\t\t{:window-probe/%ju} "
783 "{N:/window probe (T3) timer%s fired}\n");
784 p(sctps_timoinit, "\t\t{:init-timer/%ju} "
785 "{N:/INIT timer%s fired}\n");
786 p(sctps_timosack, "\t\t{:sack-timer/%ju} "
787 "{N:/sack timer%s fired}\n");
788 p(sctps_timoshutdown, "\t\t{:shutdown-timer/%ju} "
789 "{N:/shutdown timer%s fired}\n");
790 p(sctps_timoheartbeat, "\t\t{:heartbeat-timer/%ju} "
791 "{N:/heartbeat timer%s fired}\n");
792 p1a(sctps_timocookie, "\t\t{:cookie-timer/%ju} "
793 "{N:/a cookie timeout fired}\n");
794 p1a(sctps_timosecret, "\t\t{:endpoint-changed-cookie/%ju} "
795 "{N:/an endpoint changed its cook}ie"
797 p(sctps_timopathmtu, "\t\t{:pmtu-timer/%ju} "
798 "{N:/PMTU timer%s fired}\n");
799 p(sctps_timoshutdownack, "\t\t{:shutdown-timer/%ju} "
800 "{N:/shutdown ack timer%s fired}\n");
801 p(sctps_timoshutdownguard, "\t\t{:shutdown-guard-timer/%ju} "
802 "{N:/shutdown guard timer%s fired}\n");
803 p(sctps_timostrmrst, "\t\t{:stream-reset-timer/%ju} "
804 "{N:/stream reset timer%s fired}\n");
805 p(sctps_timoearlyfr, "\t\t{:early-fast-retransmission-timer/%ju} "
806 "{N:/early FR timer%s fired}\n");
807 p1a(sctps_timoasconf, "\t\t{:asconf-timer/%ju} "
808 "{N:/an asconf timer fired}\n");
809 p1a(sctps_timoautoclose, "\t\t{:auto-close-timer/%ju} "
810 "{N:/auto close timer fired}\n");
811 p(sctps_timoassockill, "\t\t{:asoc-free-timer/%ju} "
812 "{N:/asoc free timer%s expired}\n");
813 p(sctps_timoinpkill, "\t\t{:input-free-timer/%ju} "
814 "{N:/inp free timer%s expired}\n");
815 xo_close_container("timeouts");
819 * Early fast retransmission counters
821 p(sctps_earlyfrstart, "\t%ju TODO:sctps_earlyfrstart\n");
822 p(sctps_earlyfrstop, "\t%ju TODO:sctps_earlyfrstop\n");
823 p(sctps_earlyfrmrkretrans, "\t%ju TODO:sctps_earlyfrmrkretrans\n");
824 p(sctps_earlyfrstpout, "\t%ju TODO:sctps_earlyfrstpout\n");
825 p(sctps_earlyfrstpidsck1, "\t%ju TODO:sctps_earlyfrstpidsck1\n");
826 p(sctps_earlyfrstpidsck2, "\t%ju TODO:sctps_earlyfrstpidsck2\n");
827 p(sctps_earlyfrstpidsck3, "\t%ju TODO:sctps_earlyfrstpidsck3\n");
828 p(sctps_earlyfrstpidsck4, "\t%ju TODO:sctps_earlyfrstpidsck4\n");
829 p(sctps_earlyfrstrid, "\t%ju TODO:sctps_earlyfrstrid\n");
830 p(sctps_earlyfrstrout, "\t%ju TODO:sctps_earlyfrstrout\n");
831 p(sctps_earlyfrstrtmr, "\t%ju TODO:sctps_earlyfrstrtmr\n");
837 p1a(sctps_hdrops, "\t{:dropped-too-short/%ju} "
838 "{N:/packet shorter than header}\n");
839 p1a(sctps_badsum, "\t{:dropped-bad-checksum/%ju} "
840 "{N:/checksum error}\n");
841 p1a(sctps_noport, "\t{:dropped-no-endpoint/%ju} "
842 "{N:/no endpoint for port}\n");
843 p1a(sctps_badvtag, "\t{:dropped-bad-v-tag/%ju} "
845 p1a(sctps_badsid, "\t{:dropped-bad-sid/%ju} "
847 p1a(sctps_nomem, "\t{:dropped-no-memory/%ju} "
849 p1a(sctps_fastretransinrtt, "\t{:multiple-fast-retransmits-in-rtt/%ju} "
850 "{N:/number of multiple FR in a RT}T window\n");
852 p(sctps_markedretrans, "\t%ju TODO:sctps_markedretrans\n");
854 p1a(sctps_naglesent, "\t{:rfc813-sent/%ju} "
855 "{N:/RFC813 allowed sending}\n");
856 p1a(sctps_naglequeued, "\t{:rfc813-queued/%ju} "
857 "{N:/RFC813 does not allow sending}\n");
858 p1a(sctps_maxburstqueued, "\t{:max-burst-queued/%ju} "
859 "{N:/times max burst prohibited sending}\n");
860 p1a(sctps_ifnomemqueued, "\t{:no-memory-in-interface/%ju} "
861 "{N:/look ahead tells us no memory in interface}\n");
862 p(sctps_windowprobed, "\t{:sent-window-probes/%ju} "
863 "{N:/number%s of window probes sent}\n");
864 p(sctps_lowlevelerr, "\t{:low-level-err/%ju} "
865 "{N:/time%s an output error to clamp down on next user send}\n");
866 p(sctps_lowlevelerrusr, "\t{:low-level-user-error/%ju} "
867 "{N:/time%s sctp_senderrors were caused from a user}\n");
868 p(sctps_datadropchklmt, "\t{:dropped-chunk-limit/%ju} "
869 "{N:/number of in data drop%s due to chunk limit reached}\n");
870 p(sctps_datadroprwnd, "\t{:dropped-rwnd-limit/%ju} "
871 "{N:/number of in data drop%s due to rwnd limit reached}\n");
872 p(sctps_ecnereducedcwnd, "\t{:ecn-reduced-cwnd/%ju} "
873 "{N:/time%s a ECN reduced the cwnd}\n");
874 p1a(sctps_vtagexpress, "\t{:v-tag-express-lookup/%ju} "
875 "{N:/used express lookup via vtag}\n");
876 p1a(sctps_vtagbogus, "\t{:v-tag-collision/%ju} "
877 "{N:/collision in express lookup}\n");
878 p(sctps_primary_randry, "\t{:sender-ran-dry/%ju} "
879 "{N:/time%s the sender ran dry of user data on primary}\n");
880 p1a(sctps_cmt_randry, "\t{:cmt-ran-dry/%ju} "
881 "{N:/same for above}\n");
882 p(sctps_slowpath_sack, "\t{:slow-path-sack/%ju} "
883 "{N:/sack%s the slow way}\n");
884 p(sctps_wu_sacks_sent, "\t{:sent-window-update-only-sack/%ju} "
885 "{N:/window update only sack%s sent}\n");
886 p(sctps_sends_with_flags, "\t{:sent-with-sinfo/%ju} "
887 "{N:/send%s with sinfo_flags !=0}\n");
888 p(sctps_sends_with_unord, "\t{:sent-with-unordered/%ju} "
889 "{N:/unordered send%s}\n");
890 p(sctps_sends_with_eof, "\t{:sent-with-eof/%ju} "
891 "{N:/send%s with EOF flag set}\n");
892 p(sctps_sends_with_abort, "\t{:sent-with-abort/%ju} "
893 "{N:/send%s with ABORT flag set}\n");
894 p(sctps_protocol_drain_calls, "\t{:protocol-drain-called/%ju} "
895 "{N:/time%s protocol drain called}\n");
896 p(sctps_protocol_drains_done, "\t{:protocol-drain/%ju} "
897 "{N:/time%s we did a protocol drain}\n");
898 p(sctps_read_peeks, "\t{:read-with-peek/%ju} "
899 "{N:/time%s recv was called with peek}\n");
900 p(sctps_cached_chk, "\t{:cached-chunks/%ju} "
901 "{N:/cached chunk%s used}\n");
902 p1a(sctps_cached_strmoq, "\t{:cached-output-queue-used/%ju} "
903 "{N:/cached stream oq's used}\n");
904 p(sctps_left_abandon, "\t{:messages-abandoned/%ju} "
905 "{N:/unread message%s abandonded by close}\n");
906 p1a(sctps_send_burst_avoid, "\t{:send-burst-avoidance/%ju} "
907 "{N:/send burst avoidance, already max burst inflight to net}\n");
908 p1a(sctps_send_cwnd_avoid, "\t{:send-cwnd-avoidance/%ju} "
909 "{N:/send cwnd full avoidance, already max burst inflight "
911 p(sctps_fwdtsn_map_over, "\t{:tsn-map-overruns/%ju} "
912 "{N:/number of map array over-run%s via fwd-tsn's}\n");
916 xo_close_container(name);