174fd40c9SRandall Stewart /*- 274fd40c9SRandall Stewart * Copyright (c) 2001-2007, by Weongyo Jeong. All rights reserved. 374fd40c9SRandall Stewart * 474fd40c9SRandall Stewart * Redistribution and use in source and binary forms, with or without 574fd40c9SRandall Stewart * modification, are permitted provided that the following conditions are met: 674fd40c9SRandall Stewart * 774fd40c9SRandall Stewart * a) Redistributions of source code must retain the above copyright notice, 874fd40c9SRandall Stewart * this list of conditions and the following disclaimer. 974fd40c9SRandall Stewart * 1074fd40c9SRandall Stewart * b) Redistributions in binary form must reproduce the above copyright 1174fd40c9SRandall Stewart * notice, this list of conditions and the following disclaimer in 1274fd40c9SRandall Stewart * the documentation and/or other materials provided with the distribution. 1374fd40c9SRandall Stewart * 1474fd40c9SRandall Stewart * c) Neither the name of Cisco Systems, Inc. nor the names of its 1574fd40c9SRandall Stewart * contributors may be used to endorse or promote products derived 1674fd40c9SRandall Stewart * from this software without specific prior written permission. 1774fd40c9SRandall Stewart * 1874fd40c9SRandall Stewart * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 1974fd40c9SRandall Stewart * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, 2074fd40c9SRandall Stewart * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 2174fd40c9SRandall Stewart * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE 2274fd40c9SRandall Stewart * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 2374fd40c9SRandall Stewart * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 2474fd40c9SRandall Stewart * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 2574fd40c9SRandall Stewart * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 2674fd40c9SRandall Stewart * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 2774fd40c9SRandall Stewart * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF 2874fd40c9SRandall Stewart * THE POSSIBILITY OF SUCH DAMAGE. 2974fd40c9SRandall Stewart */ 3074fd40c9SRandall Stewart 3174fd40c9SRandall Stewart #if 0 3274fd40c9SRandall Stewart #ifndef lint 3374fd40c9SRandall Stewart static char sccsid[] = "@(#)sctp.c 0.1 (Berkeley) 4/18/2007"; 3474fd40c9SRandall Stewart #endif /* not lint */ 3574fd40c9SRandall Stewart #endif 3674fd40c9SRandall Stewart 3774fd40c9SRandall Stewart #include <sys/cdefs.h> 3874fd40c9SRandall Stewart __FBSDID("$FreeBSD$"); 3974fd40c9SRandall Stewart 4074fd40c9SRandall Stewart #include <sys/param.h> 4174fd40c9SRandall Stewart #include <sys/queue.h> 4274fd40c9SRandall Stewart #include <sys/types.h> 4374fd40c9SRandall Stewart #include <sys/socket.h> 4474fd40c9SRandall Stewart #include <sys/socketvar.h> 4574fd40c9SRandall Stewart #include <sys/sysctl.h> 4674fd40c9SRandall Stewart #include <sys/protosw.h> 4774fd40c9SRandall Stewart 4874fd40c9SRandall Stewart #include <netinet/in.h> 4974fd40c9SRandall Stewart #include <netinet/sctp.h> 5074fd40c9SRandall Stewart #include <netinet/sctp_constants.h> 5174fd40c9SRandall Stewart #include <arpa/inet.h> 5274fd40c9SRandall Stewart 5374fd40c9SRandall Stewart #include <err.h> 5474fd40c9SRandall Stewart #include <errno.h> 5574fd40c9SRandall Stewart #include <libutil.h> 5674fd40c9SRandall Stewart #include <netdb.h> 5774fd40c9SRandall Stewart #include <stdint.h> 5874fd40c9SRandall Stewart #include <stdio.h> 5974fd40c9SRandall Stewart #include <stdlib.h> 6074fd40c9SRandall Stewart #include <string.h> 6174fd40c9SRandall Stewart #include <unistd.h> 6274fd40c9SRandall Stewart #include "netstat.h" 6374fd40c9SRandall Stewart 6474fd40c9SRandall Stewart #ifdef SCTP 6574fd40c9SRandall Stewart 6674fd40c9SRandall Stewart void inetprint (struct in_addr *, int, const char *, int); 6774fd40c9SRandall Stewart static void sctp_statesprint(uint32_t state); 6874fd40c9SRandall Stewart 6974fd40c9SRandall Stewart #define NETSTAT_SCTP_STATES_CLOSED 0x0 7074fd40c9SRandall Stewart #define NETSTAT_SCTP_STATES_BOUND 0x1 7174fd40c9SRandall Stewart #define NETSTAT_SCTP_STATES_LISTEN 0x2 7274fd40c9SRandall Stewart #define NETSTAT_SCTP_STATES_COOKIE_WAIT 0x3 7374fd40c9SRandall Stewart #define NETSTAT_SCTP_STATES_COOKIE_ECHOED 0x4 7474fd40c9SRandall Stewart #define NETSTAT_SCTP_STATES_ESTABLISHED 0x5 7574fd40c9SRandall Stewart #define NETSTAT_SCTP_STATES_SHUTDOWN_SENT 0x6 7674fd40c9SRandall Stewart #define NETSTAT_SCTP_STATES_SHUTDOWN_RECEIVED 0x7 7774fd40c9SRandall Stewart #define NETSTAT_SCTP_STATES_SHUTDOWN_ACK_SENT 0x8 7874fd40c9SRandall Stewart #define NETSTAT_SCTP_STATES_SHUTDOWN_PENDING 0x9 7974fd40c9SRandall Stewart 8074fd40c9SRandall Stewart char *sctpstates[] = { 8174fd40c9SRandall Stewart "CLOSED", 8274fd40c9SRandall Stewart "BOUND", 8374fd40c9SRandall Stewart "LISTEN", 8474fd40c9SRandall Stewart "COOKIE_WAIT", 8574fd40c9SRandall Stewart "COOKIE_ECHOED", 8674fd40c9SRandall Stewart "ESTABLISHED", 8774fd40c9SRandall Stewart "SHUTDOWN_SENT", 8874fd40c9SRandall Stewart "SHUTDOWN_RECEIVED", 8974fd40c9SRandall Stewart "SHUTDOWN_ACK_SENT", 9074fd40c9SRandall Stewart "SHUTDOWN_PENDING" 9174fd40c9SRandall Stewart }; 9274fd40c9SRandall Stewart 9374fd40c9SRandall Stewart LIST_HEAD(xladdr_list, xladdr_entry) xladdr_head; 9474fd40c9SRandall Stewart struct xladdr_entry { 9574fd40c9SRandall Stewart struct xsctp_laddr *xladdr; 9674fd40c9SRandall Stewart LIST_ENTRY(xladdr_entry) xladdr_entries; 9774fd40c9SRandall Stewart }; 9874fd40c9SRandall Stewart 9974fd40c9SRandall Stewart LIST_HEAD(xraddr_list, xraddr_entry) xraddr_head; 10074fd40c9SRandall Stewart struct xraddr_entry { 10174fd40c9SRandall Stewart struct xsctp_raddr *xraddr; 10274fd40c9SRandall Stewart LIST_ENTRY(xraddr_entry) xraddr_entries; 10374fd40c9SRandall Stewart }; 10474fd40c9SRandall Stewart 10574fd40c9SRandall Stewart static int 10674fd40c9SRandall Stewart sctp_skip_xinpcb_ifneed(char *buf, const size_t buflen, size_t *offset) 10774fd40c9SRandall Stewart { 10874fd40c9SRandall Stewart int exist_tcb = 0; 10974fd40c9SRandall Stewart struct xsctp_tcb *xstcb; 11074fd40c9SRandall Stewart struct xsctp_raddr *xraddr; 11174fd40c9SRandall Stewart struct xsctp_laddr *xladdr; 11274fd40c9SRandall Stewart 11374fd40c9SRandall Stewart while (*offset < buflen) { 11474fd40c9SRandall Stewart xladdr = (struct xsctp_laddr *)(buf + *offset); 11574fd40c9SRandall Stewart *offset += sizeof(struct xsctp_laddr); 11674fd40c9SRandall Stewart if (xladdr->last == 1) 11774fd40c9SRandall Stewart break; 11874fd40c9SRandall Stewart } 11974fd40c9SRandall Stewart 12074fd40c9SRandall Stewart while (*offset < buflen) { 12174fd40c9SRandall Stewart xstcb = (struct xsctp_tcb *)(buf + *offset); 12274fd40c9SRandall Stewart *offset += sizeof(struct xsctp_tcb); 12374fd40c9SRandall Stewart if (xstcb->last == 1) 12474fd40c9SRandall Stewart break; 12574fd40c9SRandall Stewart 12674fd40c9SRandall Stewart exist_tcb = 1; 12774fd40c9SRandall Stewart 12874fd40c9SRandall Stewart while (*offset < buflen) { 12974fd40c9SRandall Stewart xladdr = (struct xsctp_laddr *)(buf + *offset); 13074fd40c9SRandall Stewart *offset += sizeof(struct xsctp_laddr); 13174fd40c9SRandall Stewart if (xladdr->last == 1) 13274fd40c9SRandall Stewart break; 13374fd40c9SRandall Stewart } 13474fd40c9SRandall Stewart 13574fd40c9SRandall Stewart while (*offset < buflen) { 13674fd40c9SRandall Stewart xraddr = (struct xsctp_raddr *)(buf + *offset); 13774fd40c9SRandall Stewart *offset += sizeof(struct xsctp_raddr); 13874fd40c9SRandall Stewart if (xraddr->last == 1) 13974fd40c9SRandall Stewart break; 14074fd40c9SRandall Stewart } 14174fd40c9SRandall Stewart } 14274fd40c9SRandall Stewart 14374fd40c9SRandall Stewart /* 14474fd40c9SRandall Stewart * If Lflag is set, we don't care about the return value. 14574fd40c9SRandall Stewart */ 14674fd40c9SRandall Stewart if (Lflag) 14774fd40c9SRandall Stewart return 0; 14874fd40c9SRandall Stewart 14974fd40c9SRandall Stewart return exist_tcb; 15074fd40c9SRandall Stewart } 15174fd40c9SRandall Stewart 15274fd40c9SRandall Stewart static void 15374fd40c9SRandall Stewart sctp_process_tcb(struct xsctp_tcb *xstcb, const char *name, 15474fd40c9SRandall Stewart char *buf, const size_t buflen, size_t *offset, int *indent) 15574fd40c9SRandall Stewart { 15674fd40c9SRandall Stewart int i, xl_total = 0, xr_total = 0, x_max; 15774fd40c9SRandall Stewart struct sockaddr *sa; 15874fd40c9SRandall Stewart struct xsctp_raddr *xraddr; 15974fd40c9SRandall Stewart struct xsctp_laddr *xladdr; 16074fd40c9SRandall Stewart struct xladdr_entry *prev_xl = NULL, *xl = NULL, *xl_tmp; 16174fd40c9SRandall Stewart struct xraddr_entry *prev_xr = NULL, *xr = NULL, *xr_tmp; 16274fd40c9SRandall Stewart #ifdef INET6 16374fd40c9SRandall Stewart struct sockaddr_in6 *in6; 16474fd40c9SRandall Stewart #endif 16574fd40c9SRandall Stewart 16674fd40c9SRandall Stewart LIST_INIT(&xladdr_head); 16774fd40c9SRandall Stewart LIST_INIT(&xraddr_head); 16874fd40c9SRandall Stewart 16974fd40c9SRandall Stewart /* 17074fd40c9SRandall Stewart * Make `struct xladdr_list' list and `struct xraddr_list' list 17174fd40c9SRandall Stewart * to handle the address flexibly. 17274fd40c9SRandall Stewart */ 17374fd40c9SRandall Stewart while (*offset < buflen) { 17474fd40c9SRandall Stewart xladdr = (struct xsctp_laddr *)(buf + *offset); 17574fd40c9SRandall Stewart *offset += sizeof(struct xsctp_laddr); 17674fd40c9SRandall Stewart if (xladdr->last == 1) 17774fd40c9SRandall Stewart break; 17874fd40c9SRandall Stewart 17974fd40c9SRandall Stewart prev_xl = xl; 18074fd40c9SRandall Stewart xl = malloc(sizeof(struct xladdr_entry)); 18174fd40c9SRandall Stewart if (xl == NULL) { 18274fd40c9SRandall Stewart warnx("malloc %lu bytes", 18374fd40c9SRandall Stewart (u_long)sizeof(struct xladdr_entry)); 18474fd40c9SRandall Stewart goto out; 18574fd40c9SRandall Stewart } 18674fd40c9SRandall Stewart xl->xladdr = xladdr; 18774fd40c9SRandall Stewart if (prev_xl == NULL) 18874fd40c9SRandall Stewart LIST_INSERT_HEAD(&xladdr_head, xl, xladdr_entries); 18974fd40c9SRandall Stewart else 19074fd40c9SRandall Stewart LIST_INSERT_AFTER(prev_xl, xl, xladdr_entries); 19174fd40c9SRandall Stewart xl_total++; 19274fd40c9SRandall Stewart } 19374fd40c9SRandall Stewart 19474fd40c9SRandall Stewart while (*offset < buflen) { 19574fd40c9SRandall Stewart xraddr = (struct xsctp_raddr *)(buf + *offset); 19674fd40c9SRandall Stewart *offset += sizeof(struct xsctp_raddr); 19774fd40c9SRandall Stewart if (xraddr->last == 1) 19874fd40c9SRandall Stewart break; 19974fd40c9SRandall Stewart 20074fd40c9SRandall Stewart prev_xr = xr; 20174fd40c9SRandall Stewart xr = malloc(sizeof(struct xraddr_entry)); 20274fd40c9SRandall Stewart if (xr == NULL) { 20374fd40c9SRandall Stewart warnx("malloc %lu bytes", 20474fd40c9SRandall Stewart (u_long)sizeof(struct xraddr_entry)); 20574fd40c9SRandall Stewart goto out; 20674fd40c9SRandall Stewart } 20774fd40c9SRandall Stewart xr->xraddr = xraddr; 20874fd40c9SRandall Stewart if (prev_xr == NULL) 20974fd40c9SRandall Stewart LIST_INSERT_HEAD(&xraddr_head, xr, xraddr_entries); 21074fd40c9SRandall Stewart else 21174fd40c9SRandall Stewart LIST_INSERT_AFTER(prev_xr, xr, xraddr_entries); 21274fd40c9SRandall Stewart xr_total++; 21374fd40c9SRandall Stewart } 21474fd40c9SRandall Stewart 21574fd40c9SRandall Stewart /* 21674fd40c9SRandall Stewart * Let's print the address infos. 21774fd40c9SRandall Stewart */ 21874fd40c9SRandall Stewart xl = LIST_FIRST(&xladdr_head); 21974fd40c9SRandall Stewart xr = LIST_FIRST(&xraddr_head); 22074fd40c9SRandall Stewart x_max = (xl_total > xr_total) ? xl_total : xr_total; 22174fd40c9SRandall Stewart for (i = 0; i < x_max; i++) { 22274fd40c9SRandall Stewart if (((*indent == 0) && i > 0) || *indent > 0) 22374fd40c9SRandall Stewart printf("%-11s ", " "); 22474fd40c9SRandall Stewart 22574fd40c9SRandall Stewart if (xl != NULL) { 22674fd40c9SRandall Stewart sa = &(xl->xladdr->address.sa); 22774fd40c9SRandall Stewart if ((sa->sa_family) == AF_INET) 22874fd40c9SRandall Stewart inetprint(&((struct sockaddr_in *)sa)->sin_addr, 22974fd40c9SRandall Stewart htons(xstcb->local_port), 23074fd40c9SRandall Stewart name, numeric_port); 23174fd40c9SRandall Stewart #ifdef INET6 23274fd40c9SRandall Stewart else { 23374fd40c9SRandall Stewart in6 = (struct sockaddr_in6 *)sa; 23474fd40c9SRandall Stewart inet6print(&in6->sin6_addr, 23574fd40c9SRandall Stewart htons(xstcb->local_port), 23674fd40c9SRandall Stewart name, numeric_port); 23774fd40c9SRandall Stewart } 23874fd40c9SRandall Stewart #endif 23974fd40c9SRandall Stewart } 24074fd40c9SRandall Stewart 24174fd40c9SRandall Stewart if (xr != NULL && !Lflag) { 24274fd40c9SRandall Stewart sa = &(xr->xraddr->address.sa); 24374fd40c9SRandall Stewart if ((sa->sa_family) == AF_INET) 24474fd40c9SRandall Stewart inetprint(&((struct sockaddr_in *)sa)->sin_addr, 24574fd40c9SRandall Stewart htons(xstcb->remote_port), 24674fd40c9SRandall Stewart name, numeric_port); 24774fd40c9SRandall Stewart #ifdef INET6 24874fd40c9SRandall Stewart else { 24974fd40c9SRandall Stewart in6 = (struct sockaddr_in6 *)sa; 25074fd40c9SRandall Stewart inet6print(&in6->sin6_addr, 25174fd40c9SRandall Stewart htons(xstcb->remote_port), 25274fd40c9SRandall Stewart name, numeric_port); 25374fd40c9SRandall Stewart } 25474fd40c9SRandall Stewart #endif 25574fd40c9SRandall Stewart } 25674fd40c9SRandall Stewart 25774fd40c9SRandall Stewart if (xl != NULL) 25874fd40c9SRandall Stewart xl = LIST_NEXT(xl, xladdr_entries); 25974fd40c9SRandall Stewart if (xr != NULL) 26074fd40c9SRandall Stewart xr = LIST_NEXT(xr, xraddr_entries); 26174fd40c9SRandall Stewart 26274fd40c9SRandall Stewart if (i == 0 && !Lflag) 26374fd40c9SRandall Stewart sctp_statesprint(xstcb->state); 26474fd40c9SRandall Stewart 26574fd40c9SRandall Stewart if (i < x_max) 26674fd40c9SRandall Stewart putchar('\n'); 26774fd40c9SRandall Stewart } 26874fd40c9SRandall Stewart 26974fd40c9SRandall Stewart out: 27074fd40c9SRandall Stewart /* 27174fd40c9SRandall Stewart * Free the list which be used to handle the address. 27274fd40c9SRandall Stewart */ 27374fd40c9SRandall Stewart xl = LIST_FIRST(&xladdr_head); 27474fd40c9SRandall Stewart while (xl != NULL) { 27574fd40c9SRandall Stewart xl_tmp = LIST_NEXT(xl, xladdr_entries); 27674fd40c9SRandall Stewart free(xl); 27774fd40c9SRandall Stewart xl = xl_tmp; 27874fd40c9SRandall Stewart } 27974fd40c9SRandall Stewart 28074fd40c9SRandall Stewart xr = LIST_FIRST(&xraddr_head); 28174fd40c9SRandall Stewart while (xr != NULL) { 28274fd40c9SRandall Stewart xr_tmp = LIST_NEXT(xr, xraddr_entries); 28374fd40c9SRandall Stewart free(xr); 28474fd40c9SRandall Stewart xr = xr_tmp; 28574fd40c9SRandall Stewart } 28674fd40c9SRandall Stewart } 28774fd40c9SRandall Stewart 28874fd40c9SRandall Stewart #ifdef SCTP_DEBUG 28974fd40c9SRandall Stewart uint32_t sctp_pdup[64]; 29074fd40c9SRandall Stewart int sctp_pcnt = 0; 29174fd40c9SRandall Stewart #endif 29274fd40c9SRandall Stewart 29374fd40c9SRandall Stewart static void 29474fd40c9SRandall Stewart sctp_process_inpcb(struct xsctp_inpcb *xinpcb, const char *name, 29574fd40c9SRandall Stewart char *buf, const size_t buflen, size_t *offset) 29674fd40c9SRandall Stewart { 29774fd40c9SRandall Stewart int offset_backup, indent = 0, xladdr_total = 0, is_listening = 0; 29874fd40c9SRandall Stewart static int first = 1; 29974fd40c9SRandall Stewart char *tname; 30074fd40c9SRandall Stewart struct xsctp_tcb *xstcb; 30174fd40c9SRandall Stewart struct xsctp_laddr *xladdr; 30274fd40c9SRandall Stewart struct sockaddr *sa; 30374fd40c9SRandall Stewart #ifdef INET6 30474fd40c9SRandall Stewart struct sockaddr_in6 *in6; 30574fd40c9SRandall Stewart #endif 30674fd40c9SRandall Stewart 30774fd40c9SRandall Stewart if ((xinpcb->flags & SCTP_PCB_FLAGS_TCPTYPE) == 30874fd40c9SRandall Stewart SCTP_PCB_FLAGS_TCPTYPE && xinpcb->maxqlen > 0) 30974fd40c9SRandall Stewart is_listening = 1; 31074fd40c9SRandall Stewart 31174fd40c9SRandall Stewart if (!Lflag && !is_listening && 31274fd40c9SRandall Stewart !(xinpcb->flags & SCTP_PCB_FLAGS_CONNECTED)) { 31374fd40c9SRandall Stewart #ifdef SCTP_DEBUG 31474fd40c9SRandall Stewart int i, found = 0; 31574fd40c9SRandall Stewart 31674fd40c9SRandall Stewart for (i = 0; i < sctp_pcnt; i++) { 31774fd40c9SRandall Stewart if (sctp_pdup[i] == xinpcb->flags) { 31874fd40c9SRandall Stewart found = 1; 31974fd40c9SRandall Stewart break; 32074fd40c9SRandall Stewart } 32174fd40c9SRandall Stewart } 32274fd40c9SRandall Stewart if (!found) { 32374fd40c9SRandall Stewart sctp_pdup[sctp_pcnt++] = xinpcb->flags; 32474fd40c9SRandall Stewart if (sctp_pcnt >= 64) 32574fd40c9SRandall Stewart sctp_pcnt = 0; 32674fd40c9SRandall Stewart printf("[0x%08x]", xinpcb->flags); 32774fd40c9SRandall Stewart } 32874fd40c9SRandall Stewart #endif 32974fd40c9SRandall Stewart offset_backup = *offset; 33074fd40c9SRandall Stewart if (!sctp_skip_xinpcb_ifneed(buf, buflen, offset)) 33174fd40c9SRandall Stewart return; 33274fd40c9SRandall Stewart *offset = offset_backup; 33374fd40c9SRandall Stewart } 33474fd40c9SRandall Stewart 33574fd40c9SRandall Stewart if (first) { 33674fd40c9SRandall Stewart if (!Lflag) { 33774fd40c9SRandall Stewart printf("Active SCTP associations"); 33874fd40c9SRandall Stewart if (aflag) 33974fd40c9SRandall Stewart printf(" (including servers)"); 34074fd40c9SRandall Stewart } else 34174fd40c9SRandall Stewart printf("Current listen queue sizes (qlen/maxqlen)"); 34274fd40c9SRandall Stewart putchar('\n'); 34374fd40c9SRandall Stewart if (Aflag) 34474fd40c9SRandall Stewart printf("%-8.8s ", "Socket"); 34574fd40c9SRandall Stewart if (Lflag) 34674fd40c9SRandall Stewart printf("%-5.5s %-5.5s %-8.8s %-22.22s\n", 34774fd40c9SRandall Stewart "Proto", "Type", "Listen", "Local Address"); 34874fd40c9SRandall Stewart else 34974fd40c9SRandall Stewart printf((Aflag && !Wflag) ? 35074fd40c9SRandall Stewart "%-5.5s %-5.5s %-18.18s %-18.18s %s\n" : 35174fd40c9SRandall Stewart "%-5.5s %-5.5s %-22.22s %-22.22s %s\n", 35274fd40c9SRandall Stewart "Proto", "Type", 35374fd40c9SRandall Stewart "Local Address", "Foreign Address", 35474fd40c9SRandall Stewart "(state)"); 35574fd40c9SRandall Stewart first = 0; 35674fd40c9SRandall Stewart } 35774fd40c9SRandall Stewart if (Lflag && xinpcb->maxqlen == 0) { 35874fd40c9SRandall Stewart (int)sctp_skip_xinpcb_ifneed(buf, buflen, offset); 35974fd40c9SRandall Stewart return; 36074fd40c9SRandall Stewart } 36174fd40c9SRandall Stewart if (Aflag) 36274fd40c9SRandall Stewart printf("%8lx ", (u_long)xinpcb); 36374fd40c9SRandall Stewart 36474fd40c9SRandall Stewart printf("%-5.5s ", name); 36574fd40c9SRandall Stewart 36674fd40c9SRandall Stewart if (xinpcb->flags & SCTP_PCB_FLAGS_TCPTYPE) 36774fd40c9SRandall Stewart tname = "1to1"; 36874fd40c9SRandall Stewart else if (xinpcb->flags & SCTP_PCB_FLAGS_UDPTYPE) 36974fd40c9SRandall Stewart tname = "1toN"; 37074fd40c9SRandall Stewart else 37174fd40c9SRandall Stewart return; 37274fd40c9SRandall Stewart 37374fd40c9SRandall Stewart printf("%-5.5s ", tname); 37474fd40c9SRandall Stewart 37574fd40c9SRandall Stewart if (Lflag) { 37674fd40c9SRandall Stewart char buf1[9]; 37774fd40c9SRandall Stewart 37874fd40c9SRandall Stewart snprintf(buf1, 9, "%hu/%hu", xinpcb->qlen, xinpcb->maxqlen); 37974fd40c9SRandall Stewart printf("%-8.8s ", buf1); 38074fd40c9SRandall Stewart } 38174fd40c9SRandall Stewart /* 38274fd40c9SRandall Stewart * process the local address. This routine are used for Lflag. 38374fd40c9SRandall Stewart */ 38474fd40c9SRandall Stewart while (*offset < buflen) { 38574fd40c9SRandall Stewart xladdr = (struct xsctp_laddr *)(buf + *offset); 38674fd40c9SRandall Stewart *offset += sizeof(struct xsctp_laddr); 38774fd40c9SRandall Stewart if (xladdr->last == 1) 38874fd40c9SRandall Stewart break; 38974fd40c9SRandall Stewart 39074fd40c9SRandall Stewart if (!Lflag && !is_listening) 39174fd40c9SRandall Stewart continue; 39274fd40c9SRandall Stewart 39374fd40c9SRandall Stewart if (xladdr_total != 0) 39474fd40c9SRandall Stewart putchar('\n'); 39574fd40c9SRandall Stewart if (xladdr_total > 0) 39674fd40c9SRandall Stewart printf((Lflag) ? 39774fd40c9SRandall Stewart "%-20.20s " : "%-11.11s ", " "); 39874fd40c9SRandall Stewart 39974fd40c9SRandall Stewart sa = &(xladdr->address.sa); 40074fd40c9SRandall Stewart if ((sa->sa_family) == AF_INET) 40174fd40c9SRandall Stewart inetprint(&((struct sockaddr_in *)sa)->sin_addr, 40274fd40c9SRandall Stewart htons(xinpcb->local_port), name, numeric_port); 40374fd40c9SRandall Stewart #ifdef INET6 40474fd40c9SRandall Stewart else { 40574fd40c9SRandall Stewart in6 = (struct sockaddr_in6 *)sa; 40674fd40c9SRandall Stewart inet6print(&in6->sin6_addr, 40774fd40c9SRandall Stewart htons(xinpcb->local_port), name, numeric_port); 40874fd40c9SRandall Stewart } 40974fd40c9SRandall Stewart #endif 41074fd40c9SRandall Stewart 41174fd40c9SRandall Stewart if (!Lflag && xladdr_total == 0 && is_listening == 1) 41274fd40c9SRandall Stewart printf("%-22.22s LISTEN", " "); 41374fd40c9SRandall Stewart 41474fd40c9SRandall Stewart xladdr_total++; 41574fd40c9SRandall Stewart } 41674fd40c9SRandall Stewart 41774fd40c9SRandall Stewart xstcb = (struct xsctp_tcb *)(buf + *offset); 41874fd40c9SRandall Stewart *offset += sizeof(struct xsctp_tcb); 41974fd40c9SRandall Stewart while (xstcb->last == 0 && *offset < buflen) { 42074fd40c9SRandall Stewart sctp_process_tcb(xstcb, name, buf, buflen, offset, &indent); 42174fd40c9SRandall Stewart indent++; 42274fd40c9SRandall Stewart xstcb = (struct xsctp_tcb *)(buf + *offset); 42374fd40c9SRandall Stewart *offset += sizeof(struct xsctp_tcb); 42474fd40c9SRandall Stewart } 42574fd40c9SRandall Stewart 42674fd40c9SRandall Stewart putchar('\n'); 42774fd40c9SRandall Stewart } 42874fd40c9SRandall Stewart 42974fd40c9SRandall Stewart /* 43074fd40c9SRandall Stewart * Print a summary of SCTP connections related to an Internet 43174fd40c9SRandall Stewart * protocol. 43274fd40c9SRandall Stewart */ 43374fd40c9SRandall Stewart void 43474fd40c9SRandall Stewart sctp_protopr(u_long proto, 43574fd40c9SRandall Stewart const char *name, int af1) 43674fd40c9SRandall Stewart { 43774fd40c9SRandall Stewart char *buf; 43874fd40c9SRandall Stewart const char *mibvar = "net.inet.sctp.assoclist"; 43904b764d8SXin LI size_t offset = 0; 44074fd40c9SRandall Stewart size_t len = 0; 44174fd40c9SRandall Stewart struct xsctp_inpcb *xinpcb; 44274fd40c9SRandall Stewart 44374fd40c9SRandall Stewart if (proto != IPPROTO_SCTP) 44474fd40c9SRandall Stewart return; 44574fd40c9SRandall Stewart 44674fd40c9SRandall Stewart if (sysctlbyname(mibvar, 0, &len, 0, 0) < 0) { 44774fd40c9SRandall Stewart if (errno != ENOENT) 44874fd40c9SRandall Stewart warn("sysctl: %s", mibvar); 44974fd40c9SRandall Stewart return; 45074fd40c9SRandall Stewart } 45174fd40c9SRandall Stewart if ((buf = malloc(len)) == 0) { 45274fd40c9SRandall Stewart warnx("malloc %lu bytes", (u_long)len); 45374fd40c9SRandall Stewart return; 45474fd40c9SRandall Stewart } 45574fd40c9SRandall Stewart if (sysctlbyname(mibvar, buf, &len, 0, 0) < 0) { 45674fd40c9SRandall Stewart warn("sysctl: %s", mibvar); 45774fd40c9SRandall Stewart free(buf); 45874fd40c9SRandall Stewart return; 45974fd40c9SRandall Stewart } 46074fd40c9SRandall Stewart 46174fd40c9SRandall Stewart xinpcb = (struct xsctp_inpcb *)(buf + offset); 46274fd40c9SRandall Stewart offset += sizeof(struct xsctp_inpcb); 46374fd40c9SRandall Stewart while (xinpcb->last == 0 && offset < len) { 46474fd40c9SRandall Stewart sctp_process_inpcb(xinpcb, name, buf, (const size_t)len, 46574fd40c9SRandall Stewart &offset); 46674fd40c9SRandall Stewart 46774fd40c9SRandall Stewart xinpcb = (struct xsctp_inpcb *)(buf + offset); 46874fd40c9SRandall Stewart offset += sizeof(struct xsctp_inpcb); 46974fd40c9SRandall Stewart } 47074fd40c9SRandall Stewart 47174fd40c9SRandall Stewart free(buf); 47274fd40c9SRandall Stewart } 47374fd40c9SRandall Stewart 47474fd40c9SRandall Stewart static void 47574fd40c9SRandall Stewart sctp_statesprint(uint32_t state) 47674fd40c9SRandall Stewart { 47774fd40c9SRandall Stewart int idx; 47874fd40c9SRandall Stewart 47974fd40c9SRandall Stewart switch (state) { 48074fd40c9SRandall Stewart case SCTP_STATE_COOKIE_WAIT: 48174fd40c9SRandall Stewart idx = NETSTAT_SCTP_STATES_COOKIE_WAIT; 48274fd40c9SRandall Stewart break; 48374fd40c9SRandall Stewart case SCTP_STATE_COOKIE_ECHOED: 48474fd40c9SRandall Stewart idx = NETSTAT_SCTP_STATES_COOKIE_ECHOED; 48574fd40c9SRandall Stewart break; 48674fd40c9SRandall Stewart case SCTP_STATE_OPEN: 48774fd40c9SRandall Stewart idx = NETSTAT_SCTP_STATES_ESTABLISHED; 48874fd40c9SRandall Stewart break; 48974fd40c9SRandall Stewart case SCTP_STATE_SHUTDOWN_SENT: 49074fd40c9SRandall Stewart idx = NETSTAT_SCTP_STATES_SHUTDOWN_SENT; 49174fd40c9SRandall Stewart break; 49274fd40c9SRandall Stewart case SCTP_STATE_SHUTDOWN_RECEIVED: 49374fd40c9SRandall Stewart idx = NETSTAT_SCTP_STATES_SHUTDOWN_RECEIVED; 49474fd40c9SRandall Stewart break; 49574fd40c9SRandall Stewart case SCTP_STATE_SHUTDOWN_ACK_SENT: 49674fd40c9SRandall Stewart idx = NETSTAT_SCTP_STATES_SHUTDOWN_ACK_SENT; 49774fd40c9SRandall Stewart break; 49874fd40c9SRandall Stewart case SCTP_STATE_SHUTDOWN_PENDING: 49974fd40c9SRandall Stewart idx = NETSTAT_SCTP_STATES_SHUTDOWN_PENDING; 50074fd40c9SRandall Stewart break; 50174fd40c9SRandall Stewart default: 50274fd40c9SRandall Stewart printf("UNKNOWN 0x%08x", state); 50374fd40c9SRandall Stewart return; 50474fd40c9SRandall Stewart } 50574fd40c9SRandall Stewart 50674fd40c9SRandall Stewart printf("%s", sctpstates[idx]); 50774fd40c9SRandall Stewart } 50874fd40c9SRandall Stewart 50974fd40c9SRandall Stewart /* 51074fd40c9SRandall Stewart * Dump SCTP statistics structure. 51174fd40c9SRandall Stewart */ 51274fd40c9SRandall Stewart void 51374fd40c9SRandall Stewart sctp_stats(u_long off __unused, const char *name, int af1 __unused) 51474fd40c9SRandall Stewart { 51574fd40c9SRandall Stewart struct sctpstat sctpstat, zerostat; 51674fd40c9SRandall Stewart size_t len = sizeof(sctpstat); 51774fd40c9SRandall Stewart 51874fd40c9SRandall Stewart if (zflag) 51974fd40c9SRandall Stewart memset(&zerostat, 0, len); 52074fd40c9SRandall Stewart if (sysctlbyname("net.inet.sctp.stats", &sctpstat, &len, 52174fd40c9SRandall Stewart zflag ? &zerostat : NULL, zflag ? len : 0) < 0) { 52274fd40c9SRandall Stewart warn("sysctl: net.inet.sctp.stats"); 52374fd40c9SRandall Stewart return; 52474fd40c9SRandall Stewart } 52574fd40c9SRandall Stewart 52674fd40c9SRandall Stewart printf ("%s:\n", name); 52774fd40c9SRandall Stewart 52874fd40c9SRandall Stewart #define p(f, m) if (sctpstat.f || sflag <= 1) \ 52974fd40c9SRandall Stewart printf(m, sctpstat.f, plural(sctpstat.f)) 53074fd40c9SRandall Stewart #define p1a(f, m) if (sctpstat.f || sflag <= 1) \ 53174fd40c9SRandall Stewart printf(m, sctpstat.f) 53274fd40c9SRandall Stewart #define p2(f1, f2, m) if (sctpstat.f1 || sctpstat.f2 || sflag <= 1) \ 53374fd40c9SRandall Stewart printf(m, sctpstat.f1, plural(sctpstat.f1), sctpstat.f2, plural(sctpstat.f2)) 53474fd40c9SRandall Stewart #define p2a(f1, f2, m) if (sctpstat.f1 || sctpstat.f2 || sflag <= 1) \ 53574fd40c9SRandall Stewart printf(m, sctpstat.f1, plural(sctpstat.f1), sctpstat.f2) 53674fd40c9SRandall Stewart #define p3(f, m) if (sctpstat.f || sflag <= 1) \ 53774fd40c9SRandall Stewart printf(m, sctpstat.f, plurales(sctpstat.f)) 53874fd40c9SRandall Stewart 53974fd40c9SRandall Stewart /* 54074fd40c9SRandall Stewart * input statistics 54174fd40c9SRandall Stewart */ 54274fd40c9SRandall Stewart p(sctps_recvpackets, "\t%lu total input packet%s\n"); 54374fd40c9SRandall Stewart p(sctps_recvdatagrams, "\t%lu total input datagram%s\n"); 54474fd40c9SRandall Stewart p(sctps_recvpktwithdata, "\t%lu total packet%s that had data\n"); 54574fd40c9SRandall Stewart p(sctps_recvsacks, "\t%lu total input SACK chunk%s\n"); 54674fd40c9SRandall Stewart p(sctps_recvdata, "\t%lu total input DATA chunk%s\n"); 54774fd40c9SRandall Stewart p(sctps_recvdupdata, "\t%lu total input duplicate DATA chunk%s\n"); 54874fd40c9SRandall Stewart p(sctps_recvheartbeat, "\t%lu total input HB chunk%s\n"); 54974fd40c9SRandall Stewart p(sctps_recvheartbeatack, "\t%lu total input HB-ACK chunk%s\n"); 55074fd40c9SRandall Stewart p(sctps_recvecne, "\t%lu total input ECNE chunk%s\n"); 55174fd40c9SRandall Stewart p(sctps_recvauth, "\t%lu total input AUTH chunk%s\n"); 55274fd40c9SRandall Stewart p(sctps_recvauthmissing, "\t%lu total input chunk%s missing AUTH\n"); 55374fd40c9SRandall Stewart p(sctps_recvivalhmacid, "\t%lu total number of invalid HMAC id%s " 55474fd40c9SRandall Stewart "received\n"); 55574fd40c9SRandall Stewart p(sctps_recvivalkeyid, "\t%lu total number of invalid %secret ids " 55674fd40c9SRandall Stewart "received\n"); 55774fd40c9SRandall Stewart p1a(sctps_recvauthfailed, "\t%lu total number of auth failed\n"); 55874fd40c9SRandall Stewart p(sctps_recvexpress, "\t%lu total fa%st path receives all one " 55974fd40c9SRandall Stewart "chunk\n"); 56074fd40c9SRandall Stewart p(sctps_recvexpressm, "\t%lu total fa%st path multi-part data\n"); 56174fd40c9SRandall Stewart 56274fd40c9SRandall Stewart /* 56374fd40c9SRandall Stewart * output statistics 56474fd40c9SRandall Stewart */ 56574fd40c9SRandall Stewart p(sctps_sendpackets, "\t%lu total output packet%s\n"); 56674fd40c9SRandall Stewart p(sctps_sendsacks, "\t%lu total output SACK%s\n"); 56774fd40c9SRandall Stewart p(sctps_senddata, "\t%lu total output DATA chunk%s\n"); 56874fd40c9SRandall Stewart p(sctps_sendretransdata, "\t%lu total output retran%smitted DATA " 56974fd40c9SRandall Stewart "chunks\n"); 57074fd40c9SRandall Stewart p(sctps_sendfastretrans, "\t%lu total output fa%st retransmitted " 57174fd40c9SRandall Stewart "DATA chunks\n"); 57274fd40c9SRandall Stewart p(sctps_sendmultfastretrans, "\t%lu total FR'%s that happened more " 57374fd40c9SRandall Stewart "than once to same chunk (u-del multi-fr algo).\n"); 57474fd40c9SRandall Stewart p(sctps_sendheartbeat, "\t%lu total output HB chunk%s\n"); 57574fd40c9SRandall Stewart p(sctps_sendecne, "\t%lu total output ECNE chunk%s\n"); 57674fd40c9SRandall Stewart p(sctps_sendauth, "\t%lu total output AUTH chunk%s\n"); 57774fd40c9SRandall Stewart p1a(sctps_senderrors, "\t%lu ip_output error counter\n"); 57874fd40c9SRandall Stewart 57974fd40c9SRandall Stewart /* 58074fd40c9SRandall Stewart * PCKDROPREP statistics 58174fd40c9SRandall Stewart */ 58274fd40c9SRandall Stewart p1a(sctps_pdrpfmbox, "\t%lu packet drop from middle box\n"); 58374fd40c9SRandall Stewart p(sctps_pdrpfehos, "\t%lu packet drop from end ho%st\n"); 58474fd40c9SRandall Stewart p(sctps_pdrpmbda, "\t%lu packet drop%s with data\n"); 58574fd40c9SRandall Stewart p(sctps_pdrpmbct, "\t%lu packet drop%s, non-data, non-endhost\n"); 58674fd40c9SRandall Stewart p(sctps_pdrpbwrpt, "\t%lu packet drop, non-endho%st, bandwidth " 58774fd40c9SRandall Stewart "rep only\n"); 58874fd40c9SRandall Stewart p1a(sctps_pdrpcrupt, "\t%lu packet drop, not enough for chunk " 58974fd40c9SRandall Stewart "header\n"); 59074fd40c9SRandall Stewart p1a(sctps_pdrpnedat, "\t%lu packet drop, not enough data to confirm\n"); 59174fd40c9SRandall Stewart p(sctps_pdrppdbrk, "\t%lu packet drop, where proce%ss_chunk_drop " 59274fd40c9SRandall Stewart "said break\n"); 59374fd40c9SRandall Stewart p1a(sctps_pdrptsnnf, "\t%lu packet drop, could not find TSN\n"); 59474fd40c9SRandall Stewart p(sctps_pdrpdnfnd, "\t%lu packet drop, attempt rever%se TSN lookup\n"); 59574fd40c9SRandall Stewart p(sctps_pdrpdiwnp, "\t%lu packet drop, e-ho%st confirms zero-rwnd\n"); 59674fd40c9SRandall Stewart p(sctps_pdrpdizrw, "\t%lu packet drop, midbox confirm%s no space\n"); 59774fd40c9SRandall Stewart p1a(sctps_pdrpbadd, "\t%lu packet drop, data did not match TSN\n"); 59874fd40c9SRandall Stewart p(sctps_pdrpmark, "\t%lu packet drop, TSN'%s marked for Fast Retran\n"); 59974fd40c9SRandall Stewart 60074fd40c9SRandall Stewart /* 60174fd40c9SRandall Stewart * Timeouts 60274fd40c9SRandall Stewart */ 60374fd40c9SRandall Stewart p(sctps_timoiterator, "\t%lu number of iterator timer%s that fired\n"); 60474fd40c9SRandall Stewart p(sctps_timodata, "\t%lu number of T3 data time out%s\n"); 60574fd40c9SRandall Stewart p(sctps_timowindowprobe, "\t%lu number of window probe (T3) timer%s " 60674fd40c9SRandall Stewart "that fired\n"); 60774fd40c9SRandall Stewart p(sctps_timoinit, "\t%lu number of INIT timer%s that fired\n"); 60874fd40c9SRandall Stewart p(sctps_timosack, "\t%lu number of %sack timers that fired\n"); 60974fd40c9SRandall Stewart p(sctps_timoshutdown, "\t%lu number of %shutdown timers that fired\n"); 61074fd40c9SRandall Stewart p(sctps_timoheartbeat, "\t%lu number of heartbeat timer%s that " 61174fd40c9SRandall Stewart "fired\n"); 61274fd40c9SRandall Stewart p(sctps_timocookie, "\t%lu number of time%s a cookie timeout fired\n"); 61374fd40c9SRandall Stewart p(sctps_timosecret, "\t%lu number of time%s an endpoint changed its " 61474fd40c9SRandall Stewart "cookie secret\n"); 61574fd40c9SRandall Stewart p(sctps_timopathmtu, "\t%lu number of PMTU timer%s that fired\n"); 61674fd40c9SRandall Stewart p(sctps_timoshutdownack, "\t%lu number of %shutdown ack timers that " 61774fd40c9SRandall Stewart "fired\n"); 61874fd40c9SRandall Stewart p(sctps_timoshutdownguard, "\t%lu number of %shutdown guard timers " 61974fd40c9SRandall Stewart "that fired\n"); 62074fd40c9SRandall Stewart p(sctps_timostrmrst, "\t%lu number of %stream reset timers that " 62174fd40c9SRandall Stewart "fired\n"); 62274fd40c9SRandall Stewart p(sctps_timoearlyfr, "\t%lu number of early FR timer%s that fired\n"); 62374fd40c9SRandall Stewart p(sctps_timoasconf, "\t%lu number of time%s an asconf timer fired\n"); 62474fd40c9SRandall Stewart p(sctps_timoautoclose, "\t%lu number of time%s auto close timer " 62574fd40c9SRandall Stewart "fired\n"); 62674fd40c9SRandall Stewart p(sctps_timoassockill, "\t%lu number of a%soc free timers expired\n"); 62774fd40c9SRandall Stewart p(sctps_timoinpkill, "\t%lu number of inp free timer%s expired\n"); 62874fd40c9SRandall Stewart 62974fd40c9SRandall Stewart #if 0 63074fd40c9SRandall Stewart /* 63174fd40c9SRandall Stewart * Early fast retransmission counters 63274fd40c9SRandall Stewart */ 63374fd40c9SRandall Stewart p(sctps_earlyfrstart, "\t%lu TODO:%sctps_earlyfrstart\n"); 63474fd40c9SRandall Stewart p(sctps_earlyfrstop, "\t%lu TODO:sctp%s_earlyfrstop\n"); 63574fd40c9SRandall Stewart p(sctps_earlyfrmrkretrans, "\t%lu TODO:%sctps_earlyfrmrkretrans\n"); 63674fd40c9SRandall Stewart p(sctps_earlyfrstpout, "\t%lu TODO:%sctps_earlyfrstpout\n"); 63774fd40c9SRandall Stewart p(sctps_earlyfrstpidsck1, "\t%lu TODO:%sctps_earlyfrstpidsck1\n"); 63874fd40c9SRandall Stewart p(sctps_earlyfrstpidsck2, "\t%lu TODO:%sctps_earlyfrstpidsck2\n"); 63974fd40c9SRandall Stewart p(sctps_earlyfrstpidsck3, "\t%lu TODO:%sctps_earlyfrstpidsck3\n"); 64074fd40c9SRandall Stewart p(sctps_earlyfrstpidsck4, "\t%lu TODO:%sctps_earlyfrstpidsck4\n"); 64174fd40c9SRandall Stewart p(sctps_earlyfrstrid, "\t%lu TODO:%sctps_earlyfrstrid\n"); 64274fd40c9SRandall Stewart p(sctps_earlyfrstrout, "\t%lu TODO:%sctps_earlyfrstrout\n"); 64374fd40c9SRandall Stewart p(sctps_earlyfrstrtmr, "\t%lu TODO:%sctps_earlyfrstrtmr\n"); 64474fd40c9SRandall Stewart #endif 64574fd40c9SRandall Stewart 64674fd40c9SRandall Stewart /* 64774fd40c9SRandall Stewart * Others 64874fd40c9SRandall Stewart */ 64974fd40c9SRandall Stewart p(sctps_hdrops, "\t%lu packet %shorter than header\n"); 65074fd40c9SRandall Stewart p(sctps_badsum, "\t%lu check%sum error\n"); 65174fd40c9SRandall Stewart p1a(sctps_noport, "\t%lu no endpoint for port\n"); 65274fd40c9SRandall Stewart p1a(sctps_badvtag, "\t%lu bad v-tag\n"); 65374fd40c9SRandall Stewart p1a(sctps_badsid, "\t%lu bad SID\n"); 65474fd40c9SRandall Stewart p1a(sctps_nomem, "\t%lu no memory\n"); 65574fd40c9SRandall Stewart p1a(sctps_fastretransinrtt, "\t%lu number of multiple FR in a RTT " 65674fd40c9SRandall Stewart "window\n"); 65774fd40c9SRandall Stewart #if 0 65874fd40c9SRandall Stewart p(sctps_markedretrans, "\t%lu TODO:%sctps_markedretrans\n"); 65974fd40c9SRandall Stewart #endif 66074fd40c9SRandall Stewart p(sctps_naglesent, "\t%lu nagle allowed %sending\n"); 66174fd40c9SRandall Stewart p(sctps_naglequeued, "\t%lu nagle doe%s't allow sending\n"); 66274fd40c9SRandall Stewart p(sctps_maxburstqueued, "\t%lu max bur%st dosn't allow sending\n"); 66374fd40c9SRandall Stewart p(sctps_ifnomemqueued, "\t%lu look ahead tell%s us no memory in " 66474fd40c9SRandall Stewart "interface ring buffer or we had a send error and are queuing " 66574fd40c9SRandall Stewart "one send.\n"); 66674fd40c9SRandall Stewart p(sctps_windowprobed, "\t%lu total number of window probe%s sent\n"); 66774fd40c9SRandall Stewart p(sctps_lowlevelerr, "\t%lu total time%s an output error causes us " 66874fd40c9SRandall Stewart "to clamp down on next user send.\n"); 66974fd40c9SRandall Stewart p(sctps_lowlevelerrusr, "\t%lu total time%s sctp_senderrors were " 67074fd40c9SRandall Stewart "caused from a user send from a user invoked send not a sack " 67174fd40c9SRandall Stewart "response\n"); 67274fd40c9SRandall Stewart p(sctps_datadropchklmt, "\t%lu number of in data drop%s due to " 67374fd40c9SRandall Stewart "chunk limit reached\n"); 67474fd40c9SRandall Stewart p(sctps_datadroprwnd, "\t%lu number of in data drop%s due to rwnd " 67574fd40c9SRandall Stewart "limit reached\n"); 67674fd40c9SRandall Stewart p(sctps_ecnereducedcwnd, "\t%lu number of time%s a ECN reduced " 67774fd40c9SRandall Stewart "the cwnd\n"); 67874fd40c9SRandall Stewart p(sctps_vtagexpress, "\t%lu u%sed express lookup via vtag\n"); 67974fd40c9SRandall Stewart p(sctps_vtagbogus, "\t%lu colli%sion in express lookup.\n"); 68074fd40c9SRandall Stewart p(sctps_primary_randry, "\t%lu number of time%s the sender ran dry " 68174fd40c9SRandall Stewart "of user data on primary\n"); 68274fd40c9SRandall Stewart p1a(sctps_cmt_randry, "\t%lu same for above\n"); 68374fd40c9SRandall Stewart p(sctps_slowpath_sack, "\t%lu sack%s the slow way\n"); 68474fd40c9SRandall Stewart p(sctps_wu_sacks_sent, "\t%lu window update only %sacks sent\n"); 68574fd40c9SRandall Stewart p(sctps_sends_with_flags, "\t%lu number of %sends with " 68674fd40c9SRandall Stewart "sinfo_flags !=0\n"); 68774fd40c9SRandall Stewart p(sctps_sends_with_unord, "\t%lu number of undordered %sends\n"); 68874fd40c9SRandall Stewart p(sctps_sends_with_eof, "\t%lu number of %sends with EOF flag set\n"); 68974fd40c9SRandall Stewart p(sctps_sends_with_abort, "\t%lu number of %sends with ABORT " 69074fd40c9SRandall Stewart "flag set\n"); 69174fd40c9SRandall Stewart p(sctps_protocol_drain_calls, "\t%lu number of time%s protocol " 69274fd40c9SRandall Stewart "drain called\n"); 69374fd40c9SRandall Stewart p(sctps_protocol_drains_done, "\t%lu number of time%s we did a " 69474fd40c9SRandall Stewart "protocol drain\n"); 69574fd40c9SRandall Stewart p(sctps_read_peeks, "\t%lu number of time%s recv was called with " 69674fd40c9SRandall Stewart "peek\n"); 69774fd40c9SRandall Stewart p(sctps_cached_chk, "\t%lu number of cached chunk%s used\n"); 69874fd40c9SRandall Stewart p(sctps_cached_strmoq, "\t%lu number of cached %stream oq's used\n"); 69974fd40c9SRandall Stewart p(sctps_left_abandon, "\t%lu number of unread me%ssage abandonded " 70074fd40c9SRandall Stewart "by close\n"); 70174fd40c9SRandall Stewart p(sctps_send_burst_avoid, "\t%lu send bur%st avoidance, already " 70274fd40c9SRandall Stewart "max burst inflight to net\n"); 70374fd40c9SRandall Stewart p(sctps_send_cwnd_avoid, "\t%lu send cwnd full avoidance, already " 70474fd40c9SRandall Stewart "max bur%st inflight to net\n"); 70574fd40c9SRandall Stewart p(sctps_fwdtsn_map_over, "\t%lu number of map array over-run%s via " 70674fd40c9SRandall Stewart "fwd-tsn's\n"); 70774fd40c9SRandall Stewart } 70874fd40c9SRandall Stewart 70974fd40c9SRandall Stewart #endif /* SCTP */ 710