1170461Srrs/*- 2170461Srrs * Copyright (c) 2001-2007, by Weongyo Jeong. All rights reserved. 3224271Stuexen * Copyright (c) 2011, by Michael Tuexen. All rights reserved. 4170461Srrs * 5170461Srrs * Redistribution and use in source and binary forms, with or without 6170461Srrs * modification, are permitted provided that the following conditions are met: 7170461Srrs * 8170461Srrs * a) Redistributions of source code must retain the above copyright notice, 9170461Srrs * this list of conditions and the following disclaimer. 10170461Srrs * 11170461Srrs * b) Redistributions in binary form must reproduce the above copyright 12170461Srrs * notice, this list of conditions and the following disclaimer in 13170461Srrs * the documentation and/or other materials provided with the distribution. 14170461Srrs * 15170461Srrs * c) Neither the name of Cisco Systems, Inc. nor the names of its 16170461Srrs * contributors may be used to endorse or promote products derived 17170461Srrs * from this software without specific prior written permission. 18170461Srrs * 19170461Srrs * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 20170461Srrs * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, 21170461Srrs * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 22170461Srrs * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE 23170461Srrs * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 24170461Srrs * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 25170461Srrs * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 26170461Srrs * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 27170461Srrs * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 28170461Srrs * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF 29170461Srrs * THE POSSIBILITY OF SUCH DAMAGE. 30170461Srrs */ 31170461Srrs 32170461Srrs#if 0 33170461Srrs#ifndef lint 34170461Srrsstatic char sccsid[] = "@(#)sctp.c 0.1 (Berkeley) 4/18/2007"; 35170461Srrs#endif /* not lint */ 36170461Srrs#endif 37170461Srrs 38170461Srrs#include <sys/cdefs.h> 39170461Srrs__FBSDID("$FreeBSD: releng/11.0/usr.bin/netstat/sctp.c 303267 2016-07-24 14:50:16Z tuexen $"); 40170461Srrs 41170461Srrs#include <sys/param.h> 42170461Srrs#include <sys/queue.h> 43170461Srrs#include <sys/types.h> 44170461Srrs#include <sys/socket.h> 45170461Srrs#include <sys/socketvar.h> 46170461Srrs#include <sys/sysctl.h> 47170461Srrs#include <sys/protosw.h> 48170461Srrs 49170461Srrs#include <netinet/in.h> 50170461Srrs#include <netinet/sctp.h> 51170461Srrs#include <netinet/sctp_constants.h> 52170461Srrs#include <arpa/inet.h> 53170461Srrs 54170461Srrs#include <err.h> 55170461Srrs#include <errno.h> 56200462Sdelphij#include <libutil.h> 57200462Sdelphij#include <netdb.h> 58170461Srrs#include <stdint.h> 59170461Srrs#include <stdio.h> 60170461Srrs#include <stdlib.h> 61279122Smarcel#include <stdbool.h> 62170461Srrs#include <string.h> 63200462Sdelphij#include <unistd.h> 64170461Srrs#include "netstat.h" 65279122Smarcel#include <libxo/xo.h> 66170461Srrs 67170461Srrs#ifdef SCTP 68170461Srrs 69170461Srrsstatic void sctp_statesprint(uint32_t state); 70170461Srrs 71175061Sobrien#define NETSTAT_SCTP_STATES_CLOSED 0x0 72175061Sobrien#define NETSTAT_SCTP_STATES_BOUND 0x1 73175061Sobrien#define NETSTAT_SCTP_STATES_LISTEN 0x2 74175061Sobrien#define NETSTAT_SCTP_STATES_COOKIE_WAIT 0x3 75175061Sobrien#define NETSTAT_SCTP_STATES_COOKIE_ECHOED 0x4 76175061Sobrien#define NETSTAT_SCTP_STATES_ESTABLISHED 0x5 77175061Sobrien#define NETSTAT_SCTP_STATES_SHUTDOWN_SENT 0x6 78175061Sobrien#define NETSTAT_SCTP_STATES_SHUTDOWN_RECEIVED 0x7 79175061Sobrien#define NETSTAT_SCTP_STATES_SHUTDOWN_ACK_SENT 0x8 80175061Sobrien#define NETSTAT_SCTP_STATES_SHUTDOWN_PENDING 0x9 81170461Srrs 82287351Shrsstatic const char *sctpstates[] = { 83170461Srrs "CLOSED", 84170461Srrs "BOUND", 85175061Sobrien "LISTEN", 86175061Sobrien "COOKIE_WAIT", 87175061Sobrien "COOKIE_ECHOED", 88175061Sobrien "ESTABLISHED", 89170461Srrs "SHUTDOWN_SENT", 90170461Srrs "SHUTDOWN_RECEIVED", 91170461Srrs "SHUTDOWN_ACK_SENT", 92170461Srrs "SHUTDOWN_PENDING" 93170461Srrs}; 94170461Srrs 95287351Shrsstatic LIST_HEAD(xladdr_list, xladdr_entry) xladdr_head; 96170461Srrsstruct xladdr_entry { 97170461Srrs struct xsctp_laddr *xladdr; 98170461Srrs LIST_ENTRY(xladdr_entry) xladdr_entries; 99170461Srrs}; 100170461Srrs 101287351Shrsstatic LIST_HEAD(xraddr_list, xraddr_entry) xraddr_head; 102170461Srrsstruct xraddr_entry { 103279122Smarcel struct xsctp_raddr *xraddr; 104279122Smarcel LIST_ENTRY(xraddr_entry) xraddr_entries; 105170461Srrs}; 106170461Srrs 107238514Stuexen#ifdef INET 108303267Stuexenchar * 109303267Stuexeninetname(struct in_addr *inp); 110238514Stuexen#endif 111224271Stuexen 112224271Stuexen#ifdef INET6 113303267Stuexenchar * 114303267Stuexeninet6name(struct in6_addr *in6p); 115224271Stuexen#endif 116224271Stuexen 117224271Stuexenstatic void 118279122Smarcelsctp_print_address(const char *container, union sctp_sockstore *address, 119279122Smarcel int port, int num_port) 120224271Stuexen{ 121224271Stuexen struct servent *sp = 0; 122224271Stuexen char line[80], *cp; 123224271Stuexen int width; 124224271Stuexen 125279122Smarcel if (container) 126279122Smarcel xo_open_container(container); 127279122Smarcel 128224271Stuexen switch (address->sa.sa_family) { 129238514Stuexen#ifdef INET 130224271Stuexen case AF_INET: 131224271Stuexen sprintf(line, "%.*s.", Wflag ? 39 : 16, inetname(&address->sin.sin_addr)); 132224271Stuexen break; 133238514Stuexen#endif 134224271Stuexen#ifdef INET6 135224271Stuexen case AF_INET6: 136224271Stuexen sprintf(line, "%.*s.", Wflag ? 39 : 16, inet6name(&address->sin6.sin6_addr)); 137224271Stuexen break; 138224271Stuexen#endif 139224271Stuexen default: 140224271Stuexen sprintf(line, "%.*s.", Wflag ? 39 : 16, ""); 141224271Stuexen break; 142224271Stuexen } 143229403Sed cp = strchr(line, '\0'); 144224271Stuexen if (!num_port && port) 145224271Stuexen sp = getservbyport((int)port, "sctp"); 146224271Stuexen if (sp || port == 0) 147224271Stuexen sprintf(cp, "%.15s ", sp ? sp->s_name : "*"); 148224271Stuexen else 149224271Stuexen sprintf(cp, "%d ", ntohs((u_short)port)); 150224271Stuexen width = Wflag ? 45 : 22; 151279122Smarcel xo_emit("{d:target/%-*.*s} ", width, width, line); 152279122Smarcel 153279122Smarcel int alen = cp - line - 1, plen = strlen(cp) - 1; 154279122Smarcel xo_emit("{e:address/%*.*s}{e:port/%*.*s}", alen, alen, line, plen, 155279122Smarcel plen, cp); 156279122Smarcel 157279122Smarcel if (container) 158279122Smarcel xo_close_container(container); 159224271Stuexen} 160224271Stuexen 161170461Srrsstatic int 162170461Srrssctp_skip_xinpcb_ifneed(char *buf, const size_t buflen, size_t *offset) 163170461Srrs{ 164170461Srrs int exist_tcb = 0; 165170461Srrs struct xsctp_tcb *xstcb; 166170461Srrs struct xsctp_raddr *xraddr; 167170461Srrs struct xsctp_laddr *xladdr; 168170461Srrs 169170461Srrs while (*offset < buflen) { 170170461Srrs xladdr = (struct xsctp_laddr *)(buf + *offset); 171170461Srrs *offset += sizeof(struct xsctp_laddr); 172170461Srrs if (xladdr->last == 1) 173170461Srrs break; 174170461Srrs } 175175061Sobrien 176170461Srrs while (*offset < buflen) { 177170461Srrs xstcb = (struct xsctp_tcb *)(buf + *offset); 178170461Srrs *offset += sizeof(struct xsctp_tcb); 179170461Srrs if (xstcb->last == 1) 180170461Srrs break; 181170461Srrs 182170461Srrs exist_tcb = 1; 183170461Srrs 184170461Srrs while (*offset < buflen) { 185170461Srrs xladdr = (struct xsctp_laddr *)(buf + *offset); 186170461Srrs *offset += sizeof(struct xsctp_laddr); 187170461Srrs if (xladdr->last == 1) 188170461Srrs break; 189170461Srrs } 190170461Srrs 191170461Srrs while (*offset < buflen) { 192170461Srrs xraddr = (struct xsctp_raddr *)(buf + *offset); 193170461Srrs *offset += sizeof(struct xsctp_raddr); 194170461Srrs if (xraddr->last == 1) 195170461Srrs break; 196170461Srrs } 197170461Srrs } 198170461Srrs 199170461Srrs /* 200170461Srrs * If Lflag is set, we don't care about the return value. 201170461Srrs */ 202170461Srrs if (Lflag) 203170461Srrs return 0; 204170461Srrs 205170461Srrs return exist_tcb; 206170461Srrs} 207170461Srrs 208170461Srrsstatic void 209224271Stuexensctp_process_tcb(struct xsctp_tcb *xstcb, 210170461Srrs char *buf, const size_t buflen, size_t *offset, int *indent) 211170461Srrs{ 212170461Srrs int i, xl_total = 0, xr_total = 0, x_max; 213170461Srrs struct xsctp_raddr *xraddr; 214170461Srrs struct xsctp_laddr *xladdr; 215170461Srrs struct xladdr_entry *prev_xl = NULL, *xl = NULL, *xl_tmp; 216170461Srrs struct xraddr_entry *prev_xr = NULL, *xr = NULL, *xr_tmp; 217170461Srrs 218170461Srrs LIST_INIT(&xladdr_head); 219170461Srrs LIST_INIT(&xraddr_head); 220170461Srrs 221170461Srrs /* 222170461Srrs * Make `struct xladdr_list' list and `struct xraddr_list' list 223170461Srrs * to handle the address flexibly. 224170461Srrs */ 225170461Srrs while (*offset < buflen) { 226170461Srrs xladdr = (struct xsctp_laddr *)(buf + *offset); 227170461Srrs *offset += sizeof(struct xsctp_laddr); 228170461Srrs if (xladdr->last == 1) 229170461Srrs break; 230175061Sobrien 231170461Srrs prev_xl = xl; 232170461Srrs xl = malloc(sizeof(struct xladdr_entry)); 233170461Srrs if (xl == NULL) { 234279122Smarcel xo_warnx("malloc %lu bytes", 235170461Srrs (u_long)sizeof(struct xladdr_entry)); 236170461Srrs goto out; 237170461Srrs } 238170461Srrs xl->xladdr = xladdr; 239170461Srrs if (prev_xl == NULL) 240170461Srrs LIST_INSERT_HEAD(&xladdr_head, xl, xladdr_entries); 241170461Srrs else 242170461Srrs LIST_INSERT_AFTER(prev_xl, xl, xladdr_entries); 243170461Srrs xl_total++; 244170461Srrs } 245175061Sobrien 246170461Srrs while (*offset < buflen) { 247170461Srrs xraddr = (struct xsctp_raddr *)(buf + *offset); 248170461Srrs *offset += sizeof(struct xsctp_raddr); 249170461Srrs if (xraddr->last == 1) 250170461Srrs break; 251175061Sobrien 252170461Srrs prev_xr = xr; 253170461Srrs xr = malloc(sizeof(struct xraddr_entry)); 254170461Srrs if (xr == NULL) { 255279122Smarcel xo_warnx("malloc %lu bytes", 256170461Srrs (u_long)sizeof(struct xraddr_entry)); 257170461Srrs goto out; 258170461Srrs } 259170461Srrs xr->xraddr = xraddr; 260170461Srrs if (prev_xr == NULL) 261170461Srrs LIST_INSERT_HEAD(&xraddr_head, xr, xraddr_entries); 262170461Srrs else 263170461Srrs LIST_INSERT_AFTER(prev_xr, xr, xraddr_entries); 264170461Srrs xr_total++; 265170461Srrs } 266175061Sobrien 267170461Srrs /* 268170461Srrs * Let's print the address infos. 269170461Srrs */ 270279122Smarcel xo_open_list("address"); 271170461Srrs xl = LIST_FIRST(&xladdr_head); 272170461Srrs xr = LIST_FIRST(&xraddr_head); 273298442Saraujo x_max = MAX(xl_total, xr_total); 274170461Srrs for (i = 0; i < x_max; i++) { 275279122Smarcel xo_open_instance("address"); 276279122Smarcel 277170461Srrs if (((*indent == 0) && i > 0) || *indent > 0) 278279122Smarcel xo_emit("{P:/%-12s} ", " "); 279175061Sobrien 280170461Srrs if (xl != NULL) { 281279122Smarcel sctp_print_address("local", &(xl->xladdr->address), 282224271Stuexen htons(xstcb->local_port), numeric_port); 283224271Stuexen } else { 284224271Stuexen if (Wflag) { 285279122Smarcel xo_emit("{P:/%-45s} ", " "); 286224271Stuexen } else { 287279122Smarcel xo_emit("{P:/%-22s} ", " "); 288170461Srrs } 289170461Srrs } 290175061Sobrien 291170461Srrs if (xr != NULL && !Lflag) { 292279122Smarcel sctp_print_address("remote", &(xr->xraddr->address), 293224271Stuexen htons(xstcb->remote_port), numeric_port); 294170461Srrs } 295175061Sobrien 296170461Srrs if (xl != NULL) 297170461Srrs xl = LIST_NEXT(xl, xladdr_entries); 298170461Srrs if (xr != NULL) 299170461Srrs xr = LIST_NEXT(xr, xraddr_entries); 300175061Sobrien 301170461Srrs if (i == 0 && !Lflag) 302170461Srrs sctp_statesprint(xstcb->state); 303175061Sobrien 304170461Srrs if (i < x_max) 305279122Smarcel xo_emit("\n"); 306279122Smarcel xo_close_instance("address"); 307170461Srrs } 308175061Sobrien 309170461Srrsout: 310170461Srrs /* 311170461Srrs * Free the list which be used to handle the address. 312170461Srrs */ 313170461Srrs xl = LIST_FIRST(&xladdr_head); 314170461Srrs while (xl != NULL) { 315170461Srrs xl_tmp = LIST_NEXT(xl, xladdr_entries); 316170461Srrs free(xl); 317170461Srrs xl = xl_tmp; 318170461Srrs } 319175061Sobrien 320170461Srrs xr = LIST_FIRST(&xraddr_head); 321170461Srrs while (xr != NULL) { 322170461Srrs xr_tmp = LIST_NEXT(xr, xraddr_entries); 323170461Srrs free(xr); 324170461Srrs xr = xr_tmp; 325170461Srrs } 326170461Srrs} 327170461Srrs 328170461Srrsstatic void 329224271Stuexensctp_process_inpcb(struct xsctp_inpcb *xinpcb, 330170461Srrs char *buf, const size_t buflen, size_t *offset) 331170461Srrs{ 332224271Stuexen int indent = 0, xladdr_total = 0, is_listening = 0; 333170461Srrs static int first = 1; 334246988Scharnier const char *tname, *pname; 335170461Srrs struct xsctp_tcb *xstcb; 336170461Srrs struct xsctp_laddr *xladdr; 337224271Stuexen size_t offset_laddr; 338224271Stuexen int process_closed; 339170461Srrs 340224271Stuexen if (xinpcb->maxqlen > 0) 341170461Srrs is_listening = 1; 342170461Srrs 343170461Srrs if (first) { 344170461Srrs if (!Lflag) { 345279122Smarcel xo_emit("Active SCTP associations"); 346170461Srrs if (aflag) 347279122Smarcel xo_emit(" (including servers)"); 348170461Srrs } else 349279122Smarcel xo_emit("Current listen queue sizes (qlen/maxqlen)"); 350279122Smarcel xo_emit("\n"); 351170461Srrs if (Lflag) 352279122Smarcel xo_emit("{T:/%-6.6s} {T:/%-5.5s} {T:/%-8.8s} " 353279122Smarcel "{T:/%-22.22s}\n", 354170461Srrs "Proto", "Type", "Listen", "Local Address"); 355170461Srrs else 356224271Stuexen if (Wflag) 357279122Smarcel xo_emit("{T:/%-6.6s} {T:/%-5.5s} {T:/%-45.45s} " 358279122Smarcel "{T:/%-45.45s} {T:/%s}\n", 359224271Stuexen "Proto", "Type", 360224271Stuexen "Local Address", "Foreign Address", 361224271Stuexen "(state)"); 362224271Stuexen else 363279122Smarcel xo_emit("{T:/%-6.6s} {T:/%-5.5s} {T:/%-22.22s} " 364279122Smarcel "{T:/%-22.22s} {T:/%s}\n", 365224271Stuexen "Proto", "Type", 366224271Stuexen "Local Address", "Foreign Address", 367224271Stuexen "(state)"); 368170461Srrs first = 0; 369170461Srrs } 370224271Stuexen xladdr = (struct xsctp_laddr *)(buf + *offset); 371303267Stuexen if ((!aflag && is_listening) || 372303267Stuexen (Lflag && !is_listening)) { 373213620Sdim sctp_skip_xinpcb_ifneed(buf, buflen, offset); 374170461Srrs return; 375170461Srrs } 376170461Srrs 377224271Stuexen if (xinpcb->flags & SCTP_PCB_FLAGS_BOUND_V6) { 378224271Stuexen /* Can't distinguish between sctp46 and sctp6 */ 379224271Stuexen pname = "sctp46"; 380224271Stuexen } else { 381224271Stuexen pname = "sctp4"; 382224271Stuexen } 383175061Sobrien 384170461Srrs if (xinpcb->flags & SCTP_PCB_FLAGS_TCPTYPE) 385170461Srrs tname = "1to1"; 386170461Srrs else if (xinpcb->flags & SCTP_PCB_FLAGS_UDPTYPE) 387170461Srrs tname = "1toN"; 388170461Srrs else 389224271Stuexen tname = "????"; 390175061Sobrien 391170461Srrs if (Lflag) { 392295136Salfred char buf1[22]; 393175061Sobrien 394295136Salfred snprintf(buf1, sizeof buf1, "%u/%u", 395295136Salfred xinpcb->qlen, xinpcb->maxqlen); 396279122Smarcel xo_emit("{:protocol/%-6.6s/%s} {:type/%-5.5s/%s} ", 397279122Smarcel pname, tname); 398279122Smarcel xo_emit("{d:queues/%-8.8s}{e:queue-len/%hu}" 399279122Smarcel "{e:max-queue-len/%hu} ", 400279122Smarcel buf1, xinpcb->qlen, xinpcb->maxqlen); 401170461Srrs } 402224271Stuexen 403224271Stuexen offset_laddr = *offset; 404224271Stuexen process_closed = 0; 405279122Smarcel 406279122Smarcel xo_open_list("local-address"); 407224271Stuexenretry: 408170461Srrs while (*offset < buflen) { 409170461Srrs xladdr = (struct xsctp_laddr *)(buf + *offset); 410170461Srrs *offset += sizeof(struct xsctp_laddr); 411224271Stuexen if (xladdr->last) { 412224271Stuexen if (aflag && !Lflag && (xladdr_total == 0) && process_closed) { 413279122Smarcel xo_open_instance("local-address"); 414279122Smarcel 415279122Smarcel xo_emit("{:protocol/%-6.6s/%s} " 416279122Smarcel "{:type/%-5.5s/%s} ", pname, tname); 417224271Stuexen if (Wflag) { 418279122Smarcel xo_emit("{P:/%-91.91s/%s} " 419279122Smarcel "{:state/CLOSED}", " "); 420224271Stuexen } else { 421279122Smarcel xo_emit("{P:/%-45.45s/%s} " 422279122Smarcel "{:state/CLOSED}", " "); 423224271Stuexen } 424279122Smarcel xo_close_instance("local-address"); 425224271Stuexen } 426224271Stuexen if (process_closed || is_listening) { 427279122Smarcel xo_emit("\n"); 428224271Stuexen } 429170461Srrs break; 430224271Stuexen } 431170461Srrs 432224271Stuexen if (!Lflag && !is_listening && !process_closed) 433170461Srrs continue; 434170461Srrs 435279122Smarcel xo_open_instance("local-address"); 436279122Smarcel 437224271Stuexen if (xladdr_total == 0) { 438303267Stuexen if (!Lflag) { 439303267Stuexen xo_emit("{:protocol/%-6.6s/%s} " 440303267Stuexen "{:type/%-5.5s/%s} ", pname, tname); 441303267Stuexen } 442224271Stuexen } else { 443279122Smarcel xo_emit("\n"); 444279122Smarcel xo_emit(Lflag ? "{P:/%-21.21s} " : "{P:/%-12.12s} ", 445279122Smarcel " "); 446170461Srrs } 447279122Smarcel sctp_print_address("local", &(xladdr->address), 448224271Stuexen htons(xinpcb->local_port), numeric_port); 449224271Stuexen if (aflag && !Lflag && xladdr_total == 0) { 450224271Stuexen if (Wflag) { 451224271Stuexen if (process_closed) { 452279122Smarcel xo_emit("{P:/%-45.45s} " 453279122Smarcel "{:state/CLOSED}", " "); 454224271Stuexen } else { 455279122Smarcel xo_emit("{P:/%-45.45s} " 456303267Stuexen "{:state/LISTEN}", " "); 457224271Stuexen } 458224271Stuexen } else { 459224271Stuexen if (process_closed) { 460279122Smarcel xo_emit("{P:/%-22.22s} " 461279122Smarcel "{:state/CLOSED}", " "); 462224271Stuexen } else { 463279122Smarcel xo_emit("{P:/%-22.22s} " 464279122Smarcel "{:state/LISTEN}", " "); 465224271Stuexen } 466224271Stuexen } 467224271Stuexen } 468170461Srrs xladdr_total++; 469279122Smarcel xo_close_instance("local-address"); 470170461Srrs } 471170461Srrs 472170461Srrs xstcb = (struct xsctp_tcb *)(buf + *offset); 473170461Srrs *offset += sizeof(struct xsctp_tcb); 474224271Stuexen if (aflag && (xladdr_total == 0) && xstcb->last && !process_closed) { 475224271Stuexen process_closed = 1; 476224271Stuexen *offset = offset_laddr; 477224271Stuexen goto retry; 478224271Stuexen } 479170461Srrs while (xstcb->last == 0 && *offset < buflen) { 480279122Smarcel xo_emit("{:protocol/%-6.6s/%s} {:type/%-5.5s/%s} ", 481279122Smarcel pname, tname); 482224271Stuexen sctp_process_tcb(xstcb, buf, buflen, offset, &indent); 483170461Srrs indent++; 484170461Srrs xstcb = (struct xsctp_tcb *)(buf + *offset); 485170461Srrs *offset += sizeof(struct xsctp_tcb); 486170461Srrs } 487279122Smarcel 488279122Smarcel xo_close_list("local-address"); 489170461Srrs} 490170461Srrs 491170461Srrs/* 492170461Srrs * Print a summary of SCTP connections related to an Internet 493170461Srrs * protocol. 494170461Srrs */ 495170461Srrsvoid 496171465Sjhbsctp_protopr(u_long off __unused, 497246988Scharnier const char *name __unused, int af1 __unused, int proto) 498170461Srrs{ 499170461Srrs char *buf; 500170461Srrs const char *mibvar = "net.inet.sctp.assoclist"; 501170646Sdelphij size_t offset = 0; 502170461Srrs size_t len = 0; 503170461Srrs struct xsctp_inpcb *xinpcb; 504175061Sobrien 505170461Srrs if (proto != IPPROTO_SCTP) 506170461Srrs return; 507170461Srrs 508170461Srrs if (sysctlbyname(mibvar, 0, &len, 0, 0) < 0) { 509170461Srrs if (errno != ENOENT) 510279122Smarcel xo_warn("sysctl: %s", mibvar); 511170461Srrs return; 512170461Srrs } 513298182Saraujo if ((buf = malloc(len)) == NULL) { 514279122Smarcel xo_warnx("malloc %lu bytes", (u_long)len); 515170461Srrs return; 516170461Srrs } 517170461Srrs if (sysctlbyname(mibvar, buf, &len, 0, 0) < 0) { 518279122Smarcel xo_warn("sysctl: %s", mibvar); 519170461Srrs free(buf); 520170461Srrs return; 521170461Srrs } 522170461Srrs 523170461Srrs xinpcb = (struct xsctp_inpcb *)(buf + offset); 524170461Srrs offset += sizeof(struct xsctp_inpcb); 525170461Srrs while (xinpcb->last == 0 && offset < len) { 526224271Stuexen sctp_process_inpcb(xinpcb, buf, (const size_t)len, 527170461Srrs &offset); 528170461Srrs 529170461Srrs xinpcb = (struct xsctp_inpcb *)(buf + offset); 530170461Srrs offset += sizeof(struct xsctp_inpcb); 531170461Srrs } 532170461Srrs 533170461Srrs free(buf); 534170461Srrs} 535170461Srrs 536170461Srrsstatic void 537170461Srrssctp_statesprint(uint32_t state) 538170461Srrs{ 539170461Srrs int idx; 540170461Srrs 541170461Srrs switch (state) { 542287284Stuexen case SCTP_CLOSED: 543287284Stuexen idx = NETSTAT_SCTP_STATES_CLOSED; 544287284Stuexen break; 545287284Stuexen case SCTP_BOUND: 546287284Stuexen idx = NETSTAT_SCTP_STATES_BOUND; 547287284Stuexen break; 548287284Stuexen case SCTP_LISTEN: 549287284Stuexen idx = NETSTAT_SCTP_STATES_LISTEN; 550287284Stuexen break; 551287284Stuexen case SCTP_COOKIE_WAIT: 552170461Srrs idx = NETSTAT_SCTP_STATES_COOKIE_WAIT; 553170461Srrs break; 554287284Stuexen case SCTP_COOKIE_ECHOED: 555170461Srrs idx = NETSTAT_SCTP_STATES_COOKIE_ECHOED; 556170461Srrs break; 557287284Stuexen case SCTP_ESTABLISHED: 558170461Srrs idx = NETSTAT_SCTP_STATES_ESTABLISHED; 559170461Srrs break; 560287284Stuexen case SCTP_SHUTDOWN_SENT: 561170461Srrs idx = NETSTAT_SCTP_STATES_SHUTDOWN_SENT; 562170461Srrs break; 563287284Stuexen case SCTP_SHUTDOWN_RECEIVED: 564170461Srrs idx = NETSTAT_SCTP_STATES_SHUTDOWN_RECEIVED; 565170461Srrs break; 566287284Stuexen case SCTP_SHUTDOWN_ACK_SENT: 567170461Srrs idx = NETSTAT_SCTP_STATES_SHUTDOWN_ACK_SENT; 568170461Srrs break; 569287284Stuexen case SCTP_SHUTDOWN_PENDING: 570170461Srrs idx = NETSTAT_SCTP_STATES_SHUTDOWN_PENDING; 571170461Srrs break; 572170461Srrs default: 573279122Smarcel xo_emit("UNKNOWN {:state/0x%08x}", state); 574170461Srrs return; 575170461Srrs } 576170461Srrs 577279122Smarcel xo_emit("{:state/%s}", sctpstates[idx]); 578170461Srrs} 579170461Srrs 580170461Srrs/* 581170461Srrs * Dump SCTP statistics structure. 582170461Srrs */ 583170461Srrsvoid 584171465Sjhbsctp_stats(u_long off, const char *name, int af1 __unused, int proto __unused) 585170461Srrs{ 586287649Smarkj struct sctpstat sctpstat; 587170461Srrs 588287649Smarkj if (fetch_stats("net.inet.sctp.stats", off, &sctpstat, 589287649Smarkj sizeof(sctpstat), kread) != 0) 590287649Smarkj return; 591170461Srrs 592279122Smarcel xo_open_container(name); 593279122Smarcel xo_emit("{T:/%s}:\n", name); 594170461Srrs 595170461Srrs#define p(f, m) if (sctpstat.f || sflag <= 1) \ 596279122Smarcel xo_emit(m, (uintmax_t)sctpstat.f, plural(sctpstat.f)) 597170461Srrs#define p1a(f, m) if (sctpstat.f || sflag <= 1) \ 598279122Smarcel xo_emit(m, (uintmax_t)sctpstat.f) 599170461Srrs 600170461Srrs /* 601170461Srrs * input statistics 602170461Srrs */ 603279122Smarcel p(sctps_recvpackets, "\t{:received-packets/%ju} " 604279122Smarcel "{N:/input packet%s}\n"); 605279122Smarcel p(sctps_recvdatagrams, "\t\t{:received-datagrams/%ju} " 606279122Smarcel "{N:/datagram%s}\n"); 607279122Smarcel p(sctps_recvpktwithdata, "\t\t{:received-with-data/%ju} " 608279122Smarcel "{N:/packet%s that had data}\n"); 609279122Smarcel p(sctps_recvsacks, "\t\t{:received-sack-chunks/%ju} " 610279122Smarcel "{N:/input SACK chunk%s}\n"); 611279122Smarcel p(sctps_recvdata, "\t\t{:received-data-chunks/%ju} " 612279122Smarcel "{N:/input DATA chunk%s}\n"); 613279122Smarcel p(sctps_recvdupdata, "\t\t{:received-duplicate-data-chunks/%ju} " 614279122Smarcel "{N:/duplicate DATA chunk%s}\n"); 615279122Smarcel p(sctps_recvheartbeat, "\t\t{:received-hb-chunks/%ju} " 616279122Smarcel "{N:/input HB chunk%s}\n"); 617279122Smarcel p(sctps_recvheartbeatack, "\t\t{:received-hb-ack-chunks/%ju} " 618279122Smarcel "{N:/HB-ACK chunk%s}\n"); 619279122Smarcel p(sctps_recvecne, "\t\t{:received-ecne-chunks/%ju} " 620279122Smarcel "{N:/input ECNE chunk%s}\n"); 621279122Smarcel p(sctps_recvauth, "\t\t{:received-auth-chunks/%ju} " 622279122Smarcel "{N:/input AUTH chunk%s}\n"); 623279122Smarcel p(sctps_recvauthmissing, "\t\t{:dropped-missing-auth/%ju} " 624279122Smarcel "{N:/chunk%s missing AUTH}\n"); 625279122Smarcel p(sctps_recvivalhmacid, "\t\t{:dropped-invalid-hmac/%ju} " 626279122Smarcel "{N:/invalid HMAC id%s received}\n"); 627279122Smarcel p(sctps_recvivalkeyid, "\t\t{:dropped-invalid-secret/%ju} " 628279122Smarcel "{N:/invalid secret id%s received}\n"); 629279122Smarcel p1a(sctps_recvauthfailed, "\t\t{:dropped-auth-failed/%ju} " 630279122Smarcel "{N:/auth failed}\n"); 631279122Smarcel p1a(sctps_recvexpress, "\t\t{:received-fast-path/%ju} " 632279122Smarcel "{N:/fast path receives all one chunk}\n"); 633279122Smarcel p1a(sctps_recvexpressm, "\t\t{:receives-fast-path-multipart/%ju} " 634279122Smarcel "{N:/fast path multi-part data}\n"); 635170461Srrs 636170461Srrs /* 637170461Srrs * output statistics 638170461Srrs */ 639279122Smarcel p(sctps_sendpackets, "\t{:sent-packets/%ju} " 640279122Smarcel "{N:/output packet%s}\n"); 641279122Smarcel p(sctps_sendsacks, "\t\t{:sent-sacks/%ju} " 642279122Smarcel "{N:/output SACK%s}\n"); 643279122Smarcel p(sctps_senddata, "\t\t{:sent-data-chunks/%ju} " 644279122Smarcel "{N:/output DATA chunk%s}\n"); 645279122Smarcel p(sctps_sendretransdata, "\t\t{:sent-retransmitted-data-chunks/%ju} " 646279122Smarcel "{N:/retransmitted DATA chunk%s}\n"); 647279122Smarcel p(sctps_sendfastretrans, "\t\t" 648279122Smarcel "{:sent-fast-retransmitted-data-chunks/%ju} " 649279122Smarcel "{N:/fast retransmitted DATA chunk%s}\n"); 650279122Smarcel p(sctps_sendmultfastretrans, "\t\t" 651279122Smarcel "{:sent-fast-retransmitted-data-chunk-multiple-times/%ju} " 652279122Smarcel "{N:/FR'%s that happened more than once to same chunk}\n"); 653279122Smarcel p(sctps_sendheartbeat, "\t\t{:sent-hb-chunks/%ju} " 654279122Smarcel "{N:/output HB chunk%s}\n"); 655279122Smarcel p(sctps_sendecne, "\t\t{:sent-ecne-chunks/%ju} " 656279122Smarcel "{N:/output ECNE chunk%s}\n"); 657279122Smarcel p(sctps_sendauth, "\t\t{:sent-auth-chunks/%ju} " 658279122Smarcel "{N:/output AUTH chunk%s}\n"); 659279122Smarcel p1a(sctps_senderrors, "\t\t{:send-errors/%ju} " 660279122Smarcel "{N:/ip_output error counter}\n"); 661170461Srrs 662170461Srrs /* 663170461Srrs * PCKDROPREP statistics 664170461Srrs */ 665279122Smarcel xo_emit("\t{T:Packet drop statistics}:\n"); 666279122Smarcel xo_open_container("drop-statistics"); 667279122Smarcel p1a(sctps_pdrpfmbox, "\t\t{:middle-box/%ju} " 668279122Smarcel "{N:/from middle box}\n"); 669279122Smarcel p1a(sctps_pdrpfehos, "\t\t{:end-host/%ju} " 670279122Smarcel "{N:/from end host}\n"); 671279122Smarcel p1a(sctps_pdrpmbda, "\t\t{:with-data/%ju} " 672279122Smarcel "{N:/with data}\n"); 673279122Smarcel p1a(sctps_pdrpmbct, "\t\t{:non-data/%ju} " 674279122Smarcel "{N:/non-data, non-endhost}\n"); 675279122Smarcel p1a(sctps_pdrpbwrpt, "\t\t{:non-endhost/%ju} " 676279122Smarcel "{N:/non-endhost, bandwidth rep only}\n"); 677279122Smarcel p1a(sctps_pdrpcrupt, "\t\t{:short-header/%ju} " 678279122Smarcel "{N:/not enough for chunk header}\n"); 679279122Smarcel p1a(sctps_pdrpnedat, "\t\t{:short-data/%ju} " 680279122Smarcel "{N:/not enough data to confirm}\n"); 681279122Smarcel p1a(sctps_pdrppdbrk, "\t\t{:chunk-break/%ju} " 682279122Smarcel "{N:/where process_chunk_drop said break}\n"); 683279122Smarcel p1a(sctps_pdrptsnnf, "\t\t{:tsn-not-found/%ju} " 684279122Smarcel "{N:/failed to find TSN}\n"); 685279122Smarcel p1a(sctps_pdrpdnfnd, "\t\t{:reverse-tsn/%ju} " 686279122Smarcel "{N:/attempt reverse TSN lookup}\n"); 687279122Smarcel p1a(sctps_pdrpdiwnp, "\t\t{:confirmed-zero-window/%ju} " 688279122Smarcel "{N:/e-host confirms zero-rwnd}\n"); 689279122Smarcel p1a(sctps_pdrpdizrw, "\t\t{:middle-box-no-space/%ju} " 690279122Smarcel "{N:/midbox confirms no space}\n"); 691279122Smarcel p1a(sctps_pdrpbadd, "\t\t{:bad-data/%ju} " 692279122Smarcel "{N:/data did not match TSN}\n"); 693279122Smarcel p(sctps_pdrpmark, "\t\t{:tsn-marked-fast-retransmission/%ju} " 694279122Smarcel "{N:/TSN'%s marked for Fast Retran}\n"); 695279122Smarcel xo_close_container("drop-statistics"); 696170461Srrs 697170461Srrs /* 698170461Srrs * Timeouts 699170461Srrs */ 700279122Smarcel xo_emit("\t{T:Timeouts}:\n"); 701279122Smarcel xo_open_container("timeouts"); 702279122Smarcel p(sctps_timoiterator, "\t\t{:iterator/%ju} " 703279122Smarcel "{N:/iterator timer%s fired}\n"); 704279122Smarcel p(sctps_timodata, "\t\t{:t3-data/%ju} " 705279122Smarcel "{N:/T3 data time out%s}\n"); 706279122Smarcel p(sctps_timowindowprobe, "\t\t{:window-probe/%ju} " 707279122Smarcel "{N:/window probe (T3) timer%s fired}\n"); 708279122Smarcel p(sctps_timoinit, "\t\t{:init-timer/%ju} " 709279122Smarcel "{N:/INIT timer%s fired}\n"); 710279122Smarcel p(sctps_timosack, "\t\t{:sack-timer/%ju} " 711279122Smarcel "{N:/sack timer%s fired}\n"); 712279122Smarcel p(sctps_timoshutdown, "\t\t{:shutdown-timer/%ju} " 713279122Smarcel "{N:/shutdown timer%s fired}\n"); 714279122Smarcel p(sctps_timoheartbeat, "\t\t{:heartbeat-timer/%ju} " 715279122Smarcel "{N:/heartbeat timer%s fired}\n"); 716279122Smarcel p1a(sctps_timocookie, "\t\t{:cookie-timer/%ju} " 717279122Smarcel "{N:/a cookie timeout fired}\n"); 718279122Smarcel p1a(sctps_timosecret, "\t\t{:endpoint-changed-cookie/%ju} " 719279122Smarcel "{N:/an endpoint changed its cook}ie" 720170882Srrs "secret\n"); 721279122Smarcel p(sctps_timopathmtu, "\t\t{:pmtu-timer/%ju} " 722279122Smarcel "{N:/PMTU timer%s fired}\n"); 723279122Smarcel p(sctps_timoshutdownack, "\t\t{:shutdown-timer/%ju} " 724279122Smarcel "{N:/shutdown ack timer%s fired}\n"); 725279122Smarcel p(sctps_timoshutdownguard, "\t\t{:shutdown-guard-timer/%ju} " 726279122Smarcel "{N:/shutdown guard timer%s fired}\n"); 727279122Smarcel p(sctps_timostrmrst, "\t\t{:stream-reset-timer/%ju} " 728279122Smarcel "{N:/stream reset timer%s fired}\n"); 729279122Smarcel p(sctps_timoearlyfr, "\t\t{:early-fast-retransmission-timer/%ju} " 730279122Smarcel "{N:/early FR timer%s fired}\n"); 731279122Smarcel p1a(sctps_timoasconf, "\t\t{:asconf-timer/%ju} " 732279122Smarcel "{N:/an asconf timer fired}\n"); 733279122Smarcel p1a(sctps_timoautoclose, "\t\t{:auto-close-timer/%ju} " 734279122Smarcel "{N:/auto close timer fired}\n"); 735279122Smarcel p(sctps_timoassockill, "\t\t{:asoc-free-timer/%ju} " 736279122Smarcel "{N:/asoc free timer%s expired}\n"); 737279122Smarcel p(sctps_timoinpkill, "\t\t{:input-free-timer/%ju} " 738279122Smarcel "{N:/inp free timer%s expired}\n"); 739279122Smarcel xo_close_container("timeouts"); 740170461Srrs 741170461Srrs#if 0 742170461Srrs /* 743170461Srrs * Early fast retransmission counters 744170461Srrs */ 745172720Srrs p(sctps_earlyfrstart, "\t%ju TODO:sctps_earlyfrstart\n"); 746172720Srrs p(sctps_earlyfrstop, "\t%ju TODO:sctps_earlyfrstop\n"); 747172720Srrs p(sctps_earlyfrmrkretrans, "\t%ju TODO:sctps_earlyfrmrkretrans\n"); 748172720Srrs p(sctps_earlyfrstpout, "\t%ju TODO:sctps_earlyfrstpout\n"); 749172720Srrs p(sctps_earlyfrstpidsck1, "\t%ju TODO:sctps_earlyfrstpidsck1\n"); 750172720Srrs p(sctps_earlyfrstpidsck2, "\t%ju TODO:sctps_earlyfrstpidsck2\n"); 751172720Srrs p(sctps_earlyfrstpidsck3, "\t%ju TODO:sctps_earlyfrstpidsck3\n"); 752172720Srrs p(sctps_earlyfrstpidsck4, "\t%ju TODO:sctps_earlyfrstpidsck4\n"); 753172720Srrs p(sctps_earlyfrstrid, "\t%ju TODO:sctps_earlyfrstrid\n"); 754172720Srrs p(sctps_earlyfrstrout, "\t%ju TODO:sctps_earlyfrstrout\n"); 755172720Srrs p(sctps_earlyfrstrtmr, "\t%ju TODO:sctps_earlyfrstrtmr\n"); 756170461Srrs#endif 757170461Srrs 758170461Srrs /* 759170461Srrs * Others 760170461Srrs */ 761279122Smarcel p1a(sctps_hdrops, "\t{:dropped-too-short/%ju} " 762279122Smarcel "{N:/packet shorter than header}\n"); 763279122Smarcel p1a(sctps_badsum, "\t{:dropped-bad-checksum/%ju} " 764279122Smarcel "{N:/checksum error}\n"); 765279122Smarcel p1a(sctps_noport, "\t{:dropped-no-endpoint/%ju} " 766279122Smarcel "{N:/no endpoint for port}\n"); 767279122Smarcel p1a(sctps_badvtag, "\t{:dropped-bad-v-tag/%ju} " 768279122Smarcel "{N:/bad v-tag}\n"); 769279122Smarcel p1a(sctps_badsid, "\t{:dropped-bad-sid/%ju} " 770279122Smarcel "{N:/bad SID}\n"); 771279122Smarcel p1a(sctps_nomem, "\t{:dropped-no-memory/%ju} " 772279122Smarcel "{N:/no memory}\n"); 773279122Smarcel p1a(sctps_fastretransinrtt, "\t{:multiple-fast-retransmits-in-rtt/%ju} " 774279122Smarcel "{N:/number of multiple FR in a RT}T window\n"); 775170461Srrs#if 0 776172720Srrs p(sctps_markedretrans, "\t%ju TODO:sctps_markedretrans\n"); 777170461Srrs#endif 778279122Smarcel p1a(sctps_naglesent, "\t{:rfc813-sent/%ju} " 779279122Smarcel "{N:/RFC813 allowed sending}\n"); 780279122Smarcel p1a(sctps_naglequeued, "\t{:rfc813-queued/%ju} " 781279122Smarcel "{N:/RFC813 does not allow sending}\n"); 782279122Smarcel p1a(sctps_maxburstqueued, "\t{:max-burst-queued/%ju} " 783279122Smarcel "{N:/times max burst prohibited sending}\n"); 784279122Smarcel p1a(sctps_ifnomemqueued, "\t{:no-memory-in-interface/%ju} " 785279122Smarcel "{N:/look ahead tells us no memory in interface}\n"); 786279122Smarcel p(sctps_windowprobed, "\t{:sent-window-probes/%ju} " 787279122Smarcel "{N:/number%s of window probes sent}\n"); 788279122Smarcel p(sctps_lowlevelerr, "\t{:low-level-err/%ju} " 789279122Smarcel "{N:/time%s an output error to clamp down on next user send}\n"); 790279122Smarcel p(sctps_lowlevelerrusr, "\t{:low-level-user-error/%ju} " 791279122Smarcel "{N:/time%s sctp_senderrors were caused from a user}\n"); 792279122Smarcel p(sctps_datadropchklmt, "\t{:dropped-chunk-limit/%ju} " 793279122Smarcel "{N:/number of in data drop%s due to chunk limit reached}\n"); 794279122Smarcel p(sctps_datadroprwnd, "\t{:dropped-rwnd-limit/%ju} " 795279122Smarcel "{N:/number of in data drop%s due to rwnd limit reached}\n"); 796279122Smarcel p(sctps_ecnereducedcwnd, "\t{:ecn-reduced-cwnd/%ju} " 797279122Smarcel "{N:/time%s a ECN reduced the cwnd}\n"); 798279122Smarcel p1a(sctps_vtagexpress, "\t{:v-tag-express-lookup/%ju} " 799279122Smarcel "{N:/used express lookup via vtag}\n"); 800279122Smarcel p1a(sctps_vtagbogus, "\t{:v-tag-collision/%ju} " 801279122Smarcel "{N:/collision in express lookup}\n"); 802279122Smarcel p(sctps_primary_randry, "\t{:sender-ran-dry/%ju} " 803279122Smarcel "{N:/time%s the sender ran dry of user data on primary}\n"); 804279122Smarcel p1a(sctps_cmt_randry, "\t{:cmt-ran-dry/%ju} " 805279122Smarcel "{N:/same for above}\n"); 806279122Smarcel p(sctps_slowpath_sack, "\t{:slow-path-sack/%ju} " 807279122Smarcel "{N:/sack%s the slow way}\n"); 808279122Smarcel p(sctps_wu_sacks_sent, "\t{:sent-window-update-only-sack/%ju} " 809279122Smarcel "{N:/window update only sack%s sent}\n"); 810279122Smarcel p(sctps_sends_with_flags, "\t{:sent-with-sinfo/%ju} " 811279122Smarcel "{N:/send%s with sinfo_flags !=0}\n"); 812279122Smarcel p(sctps_sends_with_unord, "\t{:sent-with-unordered/%ju} " 813279122Smarcel "{N:/unordered send%s}\n"); 814279122Smarcel p(sctps_sends_with_eof, "\t{:sent-with-eof/%ju} " 815279122Smarcel "{N:/send%s with EOF flag set}\n"); 816279122Smarcel p(sctps_sends_with_abort, "\t{:sent-with-abort/%ju} " 817279122Smarcel "{N:/send%s with ABORT flag set}\n"); 818279122Smarcel p(sctps_protocol_drain_calls, "\t{:protocol-drain-called/%ju} " 819279122Smarcel "{N:/time%s protocol drain called}\n"); 820279122Smarcel p(sctps_protocol_drains_done, "\t{:protocol-drain/%ju} " 821279122Smarcel "{N:/time%s we did a protocol drain}\n"); 822279122Smarcel p(sctps_read_peeks, "\t{:read-with-peek/%ju} " 823279122Smarcel "{N:/time%s recv was called with peek}\n"); 824279122Smarcel p(sctps_cached_chk, "\t{:cached-chunks/%ju} " 825279122Smarcel "{N:/cached chunk%s used}\n"); 826279122Smarcel p1a(sctps_cached_strmoq, "\t{:cached-output-queue-used/%ju} " 827279122Smarcel "{N:/cached stream oq's used}\n"); 828279122Smarcel p(sctps_left_abandon, "\t{:messages-abandoned/%ju} " 829279122Smarcel "{N:/unread message%s abandonded by close}\n"); 830279122Smarcel p1a(sctps_send_burst_avoid, "\t{:send-burst-avoidance/%ju} " 831279122Smarcel "{N:/send burst avoidance, already max burst inflight to net}\n"); 832279122Smarcel p1a(sctps_send_cwnd_avoid, "\t{:send-cwnd-avoidance/%ju} " 833279122Smarcel "{N:/send cwnd full avoidance, already max burst inflight " 834279122Smarcel "to net}\n"); 835279122Smarcel p(sctps_fwdtsn_map_over, "\t{:tsn-map-overruns/%ju} " 836279122Smarcel "{N:/number of map array over-run%s via fwd-tsn's}\n"); 837170882Srrs 838170882Srrs#undef p 839170882Srrs#undef p1a 840279122Smarcel xo_close_container(name); 841170461Srrs} 842170461Srrs 843170461Srrs#endif /* SCTP */ 844