]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/blob - usr.bin/netstat/sctp.c
This commit was generated by cvs2svn to compensate for changes in r174223,
[FreeBSD/FreeBSD.git] / usr.bin / netstat / sctp.c
1 /*-
2  * Copyright (c) 2001-2007, by Weongyo Jeong. All rights reserved.
3  *
4  * Redistribution and use in source and binary forms, with or without
5  * modification, are permitted provided that the following conditions are met:
6  *
7  * a) Redistributions of source code must retain the above copyright notice,
8  *   this list of conditions and the following disclaimer.
9  *
10  * b) Redistributions in binary form must reproduce the above copyright
11  *    notice, this list of conditions and the following disclaimer in
12  *   the documentation and/or other materials provided with the distribution.
13  *
14  * c) Neither the name of Cisco Systems, Inc. nor the names of its
15  *    contributors may be used to endorse or promote products derived
16  *    from this software without specific prior written permission.
17  *
18  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
19  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
20  * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
21  * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
22  * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
23  * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
24  * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
25  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
26  * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
27  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
28  * THE POSSIBILITY OF SUCH DAMAGE.
29  */
30
31
32 #if 0
33 #ifndef lint
34 static char sccsid[] = "@(#)sctp.c      0.1 (Berkeley) 4/18/2007";
35 #endif /* not lint */
36 #endif
37
38 #include <sys/cdefs.h>
39 __FBSDID("$FreeBSD$");
40
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>
48
49 #include <netinet/in.h>
50 #include <netinet/sctp.h>
51 #include <netinet/sctp_constants.h>
52 #include <arpa/inet.h>
53
54 #include <err.h>
55 #include <errno.h>
56 #include <libutil.h>
57 #include <netdb.h>
58 #include <stdint.h>
59 #include <stdio.h>
60 #include <stdlib.h>
61 #include <string.h>
62 #include <unistd.h>
63 #include "netstat.h"
64
65 #ifdef SCTP
66
67 void    inetprint (struct in_addr *, int, const char *, int);
68 static void sctp_statesprint(uint32_t state);
69
70 #define NETSTAT_SCTP_STATES_CLOSED              0x0
71 #define NETSTAT_SCTP_STATES_BOUND               0x1
72 #define NETSTAT_SCTP_STATES_LISTEN              0x2
73 #define NETSTAT_SCTP_STATES_COOKIE_WAIT         0x3
74 #define NETSTAT_SCTP_STATES_COOKIE_ECHOED       0x4
75 #define NETSTAT_SCTP_STATES_ESTABLISHED         0x5
76 #define NETSTAT_SCTP_STATES_SHUTDOWN_SENT       0x6
77 #define NETSTAT_SCTP_STATES_SHUTDOWN_RECEIVED   0x7
78 #define NETSTAT_SCTP_STATES_SHUTDOWN_ACK_SENT   0x8
79 #define NETSTAT_SCTP_STATES_SHUTDOWN_PENDING    0x9
80
81 char *sctpstates[] = {
82         "CLOSED",
83         "BOUND",
84         "LISTEN", 
85         "COOKIE_WAIT", 
86         "COOKIE_ECHOED", 
87         "ESTABLISHED", 
88         "SHUTDOWN_SENT",
89         "SHUTDOWN_RECEIVED",
90         "SHUTDOWN_ACK_SENT",
91         "SHUTDOWN_PENDING"
92 };
93
94 LIST_HEAD(xladdr_list, xladdr_entry) xladdr_head;
95 struct xladdr_entry {
96         struct xsctp_laddr *xladdr;
97         LIST_ENTRY(xladdr_entry) xladdr_entries;
98 };
99
100 LIST_HEAD(xraddr_list, xraddr_entry) xraddr_head;
101 struct xraddr_entry {
102         struct xsctp_raddr *xraddr;
103         LIST_ENTRY(xraddr_entry) xraddr_entries;
104 };
105
106 static int
107 sctp_skip_xinpcb_ifneed(char *buf, const size_t buflen, size_t *offset)
108 {
109         int exist_tcb = 0;
110         struct xsctp_tcb *xstcb;
111         struct xsctp_raddr *xraddr;
112         struct xsctp_laddr *xladdr;
113
114         while (*offset < buflen) {
115                 xladdr = (struct xsctp_laddr *)(buf + *offset);
116                 *offset += sizeof(struct xsctp_laddr);
117                 if (xladdr->last == 1)
118                         break;
119         }
120         
121         while (*offset < buflen) {
122                 xstcb = (struct xsctp_tcb *)(buf + *offset);
123                 *offset += sizeof(struct xsctp_tcb);
124                 if (xstcb->last == 1)
125                         break;
126
127                 exist_tcb = 1;
128
129                 while (*offset < buflen) {
130                         xladdr = (struct xsctp_laddr *)(buf + *offset);
131                         *offset += sizeof(struct xsctp_laddr);
132                         if (xladdr->last == 1)
133                                 break;
134                 }
135
136                 while (*offset < buflen) {
137                         xraddr = (struct xsctp_raddr *)(buf + *offset);
138                         *offset += sizeof(struct xsctp_raddr);
139                         if (xraddr->last == 1)
140                                 break;
141                 }
142         }
143
144         /*
145          * If Lflag is set, we don't care about the return value.
146          */
147         if (Lflag)
148                 return 0;
149
150         return exist_tcb;
151 }
152
153 static void
154 sctp_process_tcb(struct xsctp_tcb *xstcb, const char *name,
155     char *buf, const size_t buflen, size_t *offset, int *indent)
156 {
157         int i, xl_total = 0, xr_total = 0, x_max;
158         struct sockaddr *sa;
159         struct xsctp_raddr *xraddr;
160         struct xsctp_laddr *xladdr;
161         struct xladdr_entry *prev_xl = NULL, *xl = NULL, *xl_tmp;
162         struct xraddr_entry *prev_xr = NULL, *xr = NULL, *xr_tmp;
163 #ifdef INET6
164         struct sockaddr_in6 *in6;
165 #endif
166
167         LIST_INIT(&xladdr_head);
168         LIST_INIT(&xraddr_head);
169
170         /*
171          * Make `struct xladdr_list' list and `struct xraddr_list' list
172          * to handle the address flexibly.
173          */
174         while (*offset < buflen) {
175                 xladdr = (struct xsctp_laddr *)(buf + *offset);
176                 *offset += sizeof(struct xsctp_laddr);
177                 if (xladdr->last == 1)
178                         break;
179                 
180                 prev_xl = xl;
181                 xl = malloc(sizeof(struct xladdr_entry));
182                 if (xl == NULL) {
183                         warnx("malloc %lu bytes", 
184                             (u_long)sizeof(struct xladdr_entry));
185                         goto out;
186                 }
187                 xl->xladdr = xladdr;
188                 if (prev_xl == NULL)
189                         LIST_INSERT_HEAD(&xladdr_head, xl, xladdr_entries);
190                 else
191                         LIST_INSERT_AFTER(prev_xl, xl, xladdr_entries);
192                 xl_total++;
193         }
194         
195         while (*offset < buflen) {
196                 xraddr = (struct xsctp_raddr *)(buf + *offset);
197                 *offset += sizeof(struct xsctp_raddr);
198                 if (xraddr->last == 1)
199                         break;
200                 
201                 prev_xr = xr;
202                 xr = malloc(sizeof(struct xraddr_entry));
203                 if (xr == NULL) {
204                         warnx("malloc %lu bytes", 
205                             (u_long)sizeof(struct xraddr_entry));
206                         goto out;
207                 }
208                 xr->xraddr = xraddr;
209                 if (prev_xr == NULL)
210                         LIST_INSERT_HEAD(&xraddr_head, xr, xraddr_entries);
211                 else
212                         LIST_INSERT_AFTER(prev_xr, xr, xraddr_entries);
213                 xr_total++;
214         }
215         
216         /*
217          * Let's print the address infos.
218          */
219         xl = LIST_FIRST(&xladdr_head);
220         xr = LIST_FIRST(&xraddr_head);
221         x_max = (xl_total > xr_total) ? xl_total : xr_total;
222         for (i = 0; i < x_max; i++) {
223                 if (((*indent == 0) && i > 0) || *indent > 0)
224                         printf("%-11s ", " ");
225                 
226                 if (xl != NULL) {
227                         sa = &(xl->xladdr->address.sa);
228                         if ((sa->sa_family) == AF_INET)
229                                 inetprint(&((struct sockaddr_in *)sa)->sin_addr, 
230                                     htons(xstcb->local_port), 
231                                     name, numeric_port);
232 #ifdef INET6
233                         else {
234                                 in6 = (struct sockaddr_in6 *)sa;
235                                 inet6print(&in6->sin6_addr,
236                                     htons(xstcb->local_port),
237                                     name, numeric_port);
238                         }
239 #endif
240                 }
241                 
242                 if (xr != NULL && !Lflag) {
243                         sa = &(xr->xraddr->address.sa);
244                         if ((sa->sa_family) == AF_INET)
245                                 inetprint(&((struct sockaddr_in *)sa)->sin_addr,
246                                     htons(xstcb->remote_port),
247                                     name, numeric_port);
248 #ifdef INET6
249                         else {
250                                 in6 = (struct sockaddr_in6 *)sa;
251                                 inet6print(&in6->sin6_addr,
252                                     htons(xstcb->remote_port),
253                                     name, numeric_port);
254                         }
255 #endif
256                 }
257                 
258                 if (xl != NULL)
259                         xl = LIST_NEXT(xl, xladdr_entries);
260                 if (xr != NULL)
261                         xr = LIST_NEXT(xr, xraddr_entries);
262                 
263                 if (i == 0 && !Lflag)
264                         sctp_statesprint(xstcb->state);
265                 
266                 if (i < x_max)
267                         putchar('\n');
268         }
269         
270 out:
271         /*
272          * Free the list which be used to handle the address.
273          */
274         xl = LIST_FIRST(&xladdr_head);
275         while (xl != NULL) {
276                 xl_tmp = LIST_NEXT(xl, xladdr_entries);
277                 free(xl);
278                 xl = xl_tmp;
279         }
280         
281         xr = LIST_FIRST(&xraddr_head);
282         while (xr != NULL) {
283                 xr_tmp = LIST_NEXT(xr, xraddr_entries);
284                 free(xr);
285                 xr = xr_tmp;
286         }
287 }
288
289 #ifdef SCTP_DEBUG
290 uint32_t sctp_pdup[64];
291 int sctp_pcnt = 0;
292 #endif
293
294 static void
295 sctp_process_inpcb(struct xsctp_inpcb *xinpcb, const char *name,
296     char *buf, const size_t buflen, size_t *offset)
297 {
298         int offset_backup, indent = 0, xladdr_total = 0, is_listening = 0;
299         static int first = 1;
300         char *tname;
301         struct xsctp_tcb *xstcb;
302         struct xsctp_laddr *xladdr;
303         struct sockaddr *sa;
304 #ifdef INET6
305         struct sockaddr_in6 *in6;
306 #endif
307
308         if ((xinpcb->flags & SCTP_PCB_FLAGS_TCPTYPE) ==
309             SCTP_PCB_FLAGS_TCPTYPE && xinpcb->maxqlen > 0)
310                 is_listening = 1;
311
312         if (!Lflag && !is_listening &&
313             !(xinpcb->flags & SCTP_PCB_FLAGS_CONNECTED)) {
314 #ifdef SCTP_DEBUG
315                 int i, found = 0;
316
317                 for (i = 0; i < sctp_pcnt; i++) {
318                         if (sctp_pdup[i] == xinpcb->flags) {
319                                 found = 1;
320                                 break;
321                         }
322                 }
323                 if (!found) {
324                         sctp_pdup[sctp_pcnt++] = xinpcb->flags;
325                         if (sctp_pcnt >= 64)
326                                 sctp_pcnt = 0;
327                         printf("[0x%08x]", xinpcb->flags);
328                 }
329 #endif
330                 offset_backup = *offset;
331                 if (!sctp_skip_xinpcb_ifneed(buf, buflen, offset))
332                         return;
333                 *offset = offset_backup;
334         }
335
336         if (first) {
337                 if (!Lflag) {
338                         printf("Active SCTP associations");
339                         if (aflag)
340                                 printf(" (including servers)");
341                 } else
342                         printf("Current listen queue sizes (qlen/maxqlen)");
343                 putchar('\n');
344                 if (Aflag)
345                         printf("%-8.8s ", "Socket");
346                 if (Lflag)
347                         printf("%-5.5s %-5.5s %-8.8s %-22.22s\n",
348                             "Proto", "Type", "Listen", "Local Address");
349                 else
350                         printf((Aflag && !Wflag) ?
351                             "%-5.5s %-5.5s %-18.18s %-18.18s %s\n" :
352                             "%-5.5s %-5.5s %-22.22s %-22.22s %s\n",
353                             "Proto", "Type",
354                             "Local Address", "Foreign Address",
355                             "(state)");
356                 first = 0;
357         }
358         if (Lflag && xinpcb->maxqlen == 0) {
359                 (int)sctp_skip_xinpcb_ifneed(buf, buflen, offset);
360                 return;
361         }
362         if (Aflag)
363                 printf("%8lx ", (u_long)xinpcb);
364
365         printf("%-5.5s ", name);
366         
367         if (xinpcb->flags & SCTP_PCB_FLAGS_TCPTYPE)
368                 tname = "1to1";
369         else if (xinpcb->flags & SCTP_PCB_FLAGS_UDPTYPE)
370                 tname = "1toN";
371         else
372                 return;
373         
374         printf("%-5.5s ", tname);
375
376         if (Lflag) {
377                 char buf1[9];
378                 
379                 snprintf(buf1, 9, "%hu/%hu", xinpcb->qlen, xinpcb->maxqlen);
380                 printf("%-8.8s ", buf1);
381         }
382         /*
383          * process the local address.  This routine are used for Lflag.
384          */
385         while (*offset < buflen) {
386                 xladdr = (struct xsctp_laddr *)(buf + *offset);
387                 *offset += sizeof(struct xsctp_laddr);
388                 if (xladdr->last == 1)
389                         break;
390
391                 if (!Lflag && !is_listening)
392                         continue;
393
394                 if (xladdr_total != 0)
395                         putchar('\n');
396                 if (xladdr_total > 0)
397                         printf((Lflag) ?
398                             "%-20.20s " : "%-11.11s ", " ");
399
400                 sa = &(xladdr->address.sa);
401                 if ((sa->sa_family) == AF_INET)
402                         inetprint(&((struct sockaddr_in *)sa)->sin_addr, 
403                             htons(xinpcb->local_port), name, numeric_port);
404 #ifdef INET6
405                 else {
406                         in6 = (struct sockaddr_in6 *)sa;
407                         inet6print(&in6->sin6_addr,
408                             htons(xinpcb->local_port), name, numeric_port);
409                 }
410 #endif
411
412                 if (!Lflag && xladdr_total == 0 && is_listening == 1)
413                         printf("%-22.22s LISTEN", " ");
414
415                 xladdr_total++;
416         }
417
418         xstcb = (struct xsctp_tcb *)(buf + *offset);
419         *offset += sizeof(struct xsctp_tcb);
420         while (xstcb->last == 0 && *offset < buflen) {
421                 sctp_process_tcb(xstcb, name, buf, buflen, offset, &indent);
422                 indent++;
423                 xstcb = (struct xsctp_tcb *)(buf + *offset);
424                 *offset += sizeof(struct xsctp_tcb);
425         }
426
427         putchar('\n');
428 }
429
430 /*
431  * Print a summary of SCTP connections related to an Internet
432  * protocol.
433  */
434 void
435 sctp_protopr(u_long off __unused,
436     const char *name, int af1, int proto)
437 {
438         char *buf;
439         const char *mibvar = "net.inet.sctp.assoclist";
440         size_t offset = 0;
441         size_t len = 0;
442         struct xsctp_inpcb *xinpcb;
443         
444         if (proto != IPPROTO_SCTP)
445                 return;
446
447         if (sysctlbyname(mibvar, 0, &len, 0, 0) < 0) {
448                 if (errno != ENOENT)
449                         warn("sysctl: %s", mibvar);
450                 return;
451         }
452         if ((buf = malloc(len)) == 0) {
453                 warnx("malloc %lu bytes", (u_long)len);
454                 return;
455         }
456         if (sysctlbyname(mibvar, buf, &len, 0, 0) < 0) {
457                 warn("sysctl: %s", mibvar);
458                 free(buf);
459                 return;
460         }
461
462         xinpcb = (struct xsctp_inpcb *)(buf + offset);
463         offset += sizeof(struct xsctp_inpcb);
464         while (xinpcb->last == 0 && offset < len) {
465                 sctp_process_inpcb(xinpcb, name, buf, (const size_t)len,
466                     &offset);
467
468                 xinpcb = (struct xsctp_inpcb *)(buf + offset);
469                 offset += sizeof(struct xsctp_inpcb);
470         }
471
472         free(buf);
473 }
474
475 static void
476 sctp_statesprint(uint32_t state)
477 {
478         int idx;
479
480         switch (state) {
481         case SCTP_STATE_COOKIE_WAIT:
482                 idx = NETSTAT_SCTP_STATES_COOKIE_WAIT;
483                 break;
484         case SCTP_STATE_COOKIE_ECHOED:
485                 idx = NETSTAT_SCTP_STATES_COOKIE_ECHOED;
486                 break;
487         case SCTP_STATE_OPEN:
488                 idx = NETSTAT_SCTP_STATES_ESTABLISHED;
489                 break;
490         case SCTP_STATE_SHUTDOWN_SENT:
491                 idx = NETSTAT_SCTP_STATES_SHUTDOWN_SENT;
492                 break;
493         case SCTP_STATE_SHUTDOWN_RECEIVED:
494                 idx = NETSTAT_SCTP_STATES_SHUTDOWN_RECEIVED;
495                 break;
496         case SCTP_STATE_SHUTDOWN_ACK_SENT:
497                 idx = NETSTAT_SCTP_STATES_SHUTDOWN_ACK_SENT;
498                 break;
499         case SCTP_STATE_SHUTDOWN_PENDING:
500                 idx = NETSTAT_SCTP_STATES_SHUTDOWN_PENDING;
501                 break;
502         default:
503                 printf("UNKNOWN 0x%08x", state);
504                 return;
505         }
506
507         printf("%s", sctpstates[idx]);
508 }
509
510 /*
511  * Dump SCTP statistics structure.
512  */
513 void
514 sctp_stats(u_long off, const char *name, int af1 __unused, int proto __unused)
515 {
516         struct sctpstat sctpstat, zerostat;
517         size_t len = sizeof(sctpstat);
518
519         if (live) {
520                 if (zflag)
521                         memset(&zerostat, 0, len);
522                 if (sysctlbyname("net.inet.sctp.stats", &sctpstat, &len,
523                     zflag ? &zerostat : NULL, zflag ? len : 0) < 0) {
524                         warn("sysctl: net.inet.sctp.stats");
525                         return;
526                 }
527         } else
528                 kread(off, &sctpstat, len);
529
530         printf ("%s:\n", name);
531
532 #define p(f, m) if (sctpstat.f || sflag <= 1) \
533     printf(m, (uintmax_t)sctpstat.f, plural(sctpstat.f))
534 #define p1a(f, m) if (sctpstat.f || sflag <= 1) \
535     printf(m, (uintmax_t)sctpstat.f)
536
537         /*
538          * input statistics
539          */
540         p(sctps_recvpackets, "\t%ju input packet%s\n");
541         p(sctps_recvdatagrams, "\t\t%ju datagram%s\n");
542         p(sctps_recvpktwithdata, "\t\t%ju packet%s that had data\n");
543         p(sctps_recvsacks, "\t\t%ju input SACK chunk%s\n");
544         p(sctps_recvdata, "\t\t%ju input DATA chunk%s\n");
545         p(sctps_recvdupdata, "\t\t%ju duplicate DATA chunk%s\n");
546         p(sctps_recvheartbeat, "\t\t%ju input HB chunk%s\n");
547         p(sctps_recvheartbeatack, "\t\t%ju HB-ACK chunk%s\n");
548         p(sctps_recvecne, "\t\t%ju input ECNE chunk%s\n");
549         p(sctps_recvauth, "\t\t%ju input AUTH chunk%s\n");
550         p(sctps_recvauthmissing, "\t\t%ju chunk%s missing AUTH\n");
551         p(sctps_recvivalhmacid, "\t\t%ju invalid HMAC id%s received\n");
552         p(sctps_recvivalkeyid, "\t\t%ju invalid secret id%s received\n");
553         p1a(sctps_recvauthfailed, "\t\t%ju auth failed\n");
554         p1a(sctps_recvexpress, "\t\t%ju fast path receives all one chunk\n");
555         p1a(sctps_recvexpressm, "\t\t%ju fast path multi-part data\n");
556
557         /*
558          * output statistics
559          */
560         p(sctps_sendpackets, "\t%ju output packet%s\n");
561         p(sctps_sendsacks, "\t\t%ju output SACK%s\n");
562         p(sctps_senddata, "\t\t%ju output DATA chunk%s\n");
563         p(sctps_sendretransdata, "\t\t%ju retransmitted DATA chunk%s\n");
564         p(sctps_sendfastretrans, "\t\t%ju fast retransmitted DATA chunk%s\n");
565         p(sctps_sendmultfastretrans, "\t\t%ju FR'%s that happened more "
566             "than once to same chunk.\n");
567         p(sctps_sendheartbeat, "\t\t%ju intput HB chunk%s\n");
568         p(sctps_sendecne, "\t\t%ju output ECNE chunk%s\n");
569         p(sctps_sendauth, "\t\t%ju output AUTH chunk%s\n");
570         p1a(sctps_senderrors, "\t\t%ju ip_output error counter\n");
571
572         /*
573          * PCKDROPREP statistics
574          */
575         printf("\tPacket drop statistics:\n");
576         p1a(sctps_pdrpfmbox, "\t\t%ju from middle box\n");
577         p1a(sctps_pdrpfehos, "\t\t%ju from end host\n");
578         p1a(sctps_pdrpmbda, "\t\t%ju with data\n");
579         p1a(sctps_pdrpmbct, "\t\t%ju non-data, non-endhost\n");
580         p1a(sctps_pdrpbwrpt, "\t\t%ju non-endhost, bandwidth rep only\n");
581         p1a(sctps_pdrpcrupt, "\t\t%ju not enough for chunk header\n");
582         p1a(sctps_pdrpnedat, "\t\t%ju not enough data to confirm\n");
583         p1a(sctps_pdrppdbrk, "\t\t%ju where process_chunk_drop said break\n");
584         p1a(sctps_pdrptsnnf, "\t\t%ju failed to find TSN\n");
585         p1a(sctps_pdrpdnfnd, "\t\t%ju attempt reverse TSN lookup\n");
586         p1a(sctps_pdrpdiwnp, "\t\t%ju e-host confirms zero-rwnd\n");
587         p1a(sctps_pdrpdizrw, "\t\t%ju midbox confirms no space\n");
588         p1a(sctps_pdrpbadd, "\t\t%ju data did not match TSN\n");
589         p(sctps_pdrpmark, "\t\t%ju TSN'%s marked for Fast Retran\n");
590
591         /*
592          * Timeouts
593          */
594         printf("\tTimeouts:\n");
595         p(sctps_timoiterator, "\t\t%ju iterator timer%s fired\n");
596         p(sctps_timodata, "\t\t%ju T3 data time out%s\n");
597         p(sctps_timowindowprobe, "\t\t%ju window probe (T3) timer%s fired\n");
598         p(sctps_timoinit, "\t\t%ju INIT timer%s fired\n");
599         p(sctps_timosack, "\t\t%ju sack timer%s fired\n");
600         p(sctps_timoshutdown, "\t\t%ju shutdown timer%s fired\n");
601         p(sctps_timoheartbeat, "\t\t%ju heartbeat timer%s fired\n");
602         p1a(sctps_timocookie, "\t\t%ju a cookie timeout fired\n");
603         p1a(sctps_timosecret, "\t\t%ju an endpoint changed its cookie"
604             "secret\n");
605         p(sctps_timopathmtu, "\t\t%ju PMTU timer%s fired\n");
606         p(sctps_timoshutdownack, "\t\t%ju shutdown ack timer%s fired\n");
607         p(sctps_timoshutdownguard, "\t\t%ju shutdown guard timer%s fired\n");
608         p(sctps_timostrmrst, "\t\t%ju stream reset timer%s fired\n");
609         p(sctps_timoearlyfr, "\t\t%ju early FR timer%s fired\n");
610         p1a(sctps_timoasconf, "\t\t%ju an asconf timer fired\n");
611         p1a(sctps_timoautoclose, "\t\t%ju auto close timer fired\n");
612         p(sctps_timoassockill, "\t\t%ju asoc free timer%s expired\n");
613         p(sctps_timoinpkill, "\t\t%ju inp free timer%s expired\n");
614
615 #if 0
616         /*
617          * Early fast retransmission counters
618          */
619         p(sctps_earlyfrstart, "\t%ju TODO:sctps_earlyfrstart\n");
620         p(sctps_earlyfrstop, "\t%ju TODO:sctps_earlyfrstop\n");
621         p(sctps_earlyfrmrkretrans, "\t%ju TODO:sctps_earlyfrmrkretrans\n");
622         p(sctps_earlyfrstpout, "\t%ju TODO:sctps_earlyfrstpout\n");
623         p(sctps_earlyfrstpidsck1, "\t%ju TODO:sctps_earlyfrstpidsck1\n");
624         p(sctps_earlyfrstpidsck2, "\t%ju TODO:sctps_earlyfrstpidsck2\n");
625         p(sctps_earlyfrstpidsck3, "\t%ju TODO:sctps_earlyfrstpidsck3\n");
626         p(sctps_earlyfrstpidsck4, "\t%ju TODO:sctps_earlyfrstpidsck4\n");
627         p(sctps_earlyfrstrid, "\t%ju TODO:sctps_earlyfrstrid\n");
628         p(sctps_earlyfrstrout, "\t%ju TODO:sctps_earlyfrstrout\n");
629         p(sctps_earlyfrstrtmr, "\t%ju TODO:sctps_earlyfrstrtmr\n");
630 #endif
631
632         /*
633          * Others
634          */
635         p1a(sctps_hdrops, "\t%ju packet shorter than header\n");
636         p1a(sctps_badsum, "\t%ju checksum error\n");
637         p1a(sctps_noport, "\t%ju no endpoint for port\n");
638         p1a(sctps_badvtag, "\t%ju bad v-tag\n");
639         p1a(sctps_badsid, "\t%ju bad SID\n");
640         p1a(sctps_nomem, "\t%ju no memory\n");
641         p1a(sctps_fastretransinrtt, "\t%ju number of multiple FR in a RTT "
642             "window\n");
643 #if 0
644         p(sctps_markedretrans, "\t%ju TODO:sctps_markedretrans\n");
645 #endif
646         p1a(sctps_naglesent, "\t%ju RFC813 allowed sending\n");
647         p1a(sctps_naglequeued, "\t%ju RFC813 does not allow sending\n");
648         p1a(sctps_maxburstqueued, "\t%ju max burst dosn't allow sending\n");
649         p1a(sctps_ifnomemqueued, "\t%ju look ahead tells us no memory in "
650             "interface\n");
651         p(sctps_windowprobed, "\t%ju number%s of window probes sent\n");
652         p(sctps_lowlevelerr, "\t%ju time%s an output error to clamp "
653             "down on next user send.\n");
654         p(sctps_lowlevelerrusr, "\t%ju time%s sctp_senderrors were "
655             "caused from a user\n");
656         p(sctps_datadropchklmt, "\t%ju number of in data drop%s due to "
657             "chunk limit reached\n");
658         p(sctps_datadroprwnd, "\t%ju number of in data drop%s due to rwnd "
659             "limit reached\n");
660         p(sctps_ecnereducedcwnd, "\t%ju time%s a ECN reduced "
661             "the cwnd\n");
662         p1a(sctps_vtagexpress, "\t%ju used express lookup via vtag\n");
663         p1a(sctps_vtagbogus, "\t%ju collision in express lookup.\n");
664         p(sctps_primary_randry, "\t%ju time%s the sender ran dry "
665             "of user data on primary\n");
666         p1a(sctps_cmt_randry, "\t%ju same for above\n");
667         p(sctps_slowpath_sack, "\t%ju sack%s the slow way\n");
668         p(sctps_wu_sacks_sent, "\t%ju window update only sack%s sent\n");
669         p(sctps_sends_with_flags, "\t%ju send%s with sinfo_flags !=0\n");
670         p(sctps_sends_with_unord, "\t%ju unordered send%s\n");
671         p(sctps_sends_with_eof, "\t%ju send%s with EOF flag set\n");
672         p(sctps_sends_with_abort, "\t%ju send%s with ABORT flag set\n");
673         p(sctps_protocol_drain_calls, "\t%ju time%s protocol drain called\n");
674         p(sctps_protocol_drains_done, "\t%ju time%s we did a protocol "
675             "drain\n");
676         p(sctps_read_peeks, "\t%ju time%s recv was called with peek\n");
677         p(sctps_cached_chk, "\t%ju cached chunk%s used\n");
678         p1a(sctps_cached_strmoq, "\t%ju cached stream oq's used\n");
679         p(sctps_left_abandon, "\t%ju unread message%s abandonded by close\n");
680         p1a(sctps_send_burst_avoid, "\t%ju send burst avoidance, already "
681             "max burst inflight to net\n");
682         p1a(sctps_send_cwnd_avoid, "\t%ju send cwnd full avoidance, already "
683             "max burst inflight to net\n");
684         p(sctps_fwdtsn_map_over, "\t%ju number of map array over-run%s via "
685             "fwd-tsn's\n");
686
687 #undef p
688 #undef p1a
689 }
690
691 #endif /* SCTP */