1 /* Copyright (c) 2001 NETLAB, Temple University
2 * Copyright (c) 2001 Protocol Engineering Lab, University of Delaware
4 * Jerry Heinz <gheinz@astro.temple.edu>
5 * John Fiore <jfiore@joda.cis.temple.edu>
6 * Armando L. Caro Jr. <acaro@cis.udel.edu>
8 * Redistribution and use in source and binary forms, with or without
9 * modification, are permitted provided that the following conditions
12 * 1. Redistributions of source code must retain the above copyright
13 * notice, this list of conditions and the following disclaimer.
15 * 2. Redistributions in binary form must reproduce the above copyright
16 * notice, this list of conditions and the following disclaimer in the
17 * documentation and/or other materials provided with the distribution.
19 * 3. Neither the name of the University nor of the Laboratory may be used
20 * to endorse or promote products derived from this software without
21 * specific prior written permission.
23 * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
24 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
25 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
26 * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
27 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
28 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
29 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
30 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
31 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
32 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
36 /* \summary: Stream Control Transmission Protocol (SCTP) printer */
40 #include "netdissect-stdinc.h"
42 #define ND_LONGJMP_FROM_TCHECK
43 #include "netdissect.h"
44 #include "addrtoname.h"
51 * SCTP reference Implementation Copyright (C) 1999 Cisco And Motorola
53 * Redistribution and use in source and binary forms, with or without
54 * modification, are permitted provided that the following conditions
57 * 1. Redistributions of source code must retain the above copyright
58 * notice, this list of conditions and the following disclaimer.
60 * 2. Redistributions in binary form must reproduce the above copyright
61 * notice, this list of conditions and the following disclaimer in the
62 * documentation and/or other materials provided with the distribution.
64 * 3. Neither the name of Cisco nor of Motorola may be used
65 * to endorse or promote products derived from this software without
66 * specific prior written permission.
68 * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
69 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
70 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
71 * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
72 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
73 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
74 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
75 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
76 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
77 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
80 * This file is part of the SCTP reference Implementation
83 * Please send any bug reports or fixes you make to one of the following email
86 * rstewar1@email.mot.com
90 * Any bugs reported given to us we will try to fix... any fixes shared will
91 * be incorporated into the next SCTP release.
94 /* The valid defines for all message
95 * types know to SCTP. 0 is reserved
97 #define SCTP_DATA 0x00
98 #define SCTP_INITIATION 0x01
99 #define SCTP_INITIATION_ACK 0x02
100 #define SCTP_SELECTIVE_ACK 0x03
101 #define SCTP_HEARTBEAT_REQUEST 0x04
102 #define SCTP_HEARTBEAT_ACK 0x05
103 #define SCTP_ABORT_ASSOCIATION 0x06
104 #define SCTP_SHUTDOWN 0x07
105 #define SCTP_SHUTDOWN_ACK 0x08
106 #define SCTP_OPERATION_ERR 0x09
107 #define SCTP_COOKIE_ECHO 0x0a
108 #define SCTP_COOKIE_ACK 0x0b
109 #define SCTP_ECN_ECHO 0x0c
110 #define SCTP_ECN_CWR 0x0d
111 #define SCTP_SHUTDOWN_COMPLETE 0x0e
112 #define SCTP_FORWARD_CUM_TSN 0xc0
113 #define SCTP_RELIABLE_CNTL 0xc1
114 #define SCTP_RELIABLE_CNTL_ACK 0xc2
116 static const struct tok sctp_chunkid_str
[] = {
117 { SCTP_DATA
, "DATA" },
118 { SCTP_INITIATION
, "INIT" },
119 { SCTP_INITIATION_ACK
, "INIT ACK" },
120 { SCTP_SELECTIVE_ACK
, "SACK" },
121 { SCTP_HEARTBEAT_REQUEST
, "HB REQ" },
122 { SCTP_HEARTBEAT_ACK
, "HB ACK" },
123 { SCTP_ABORT_ASSOCIATION
, "ABORT" },
124 { SCTP_SHUTDOWN
, "SHUTDOWN" },
125 { SCTP_SHUTDOWN_ACK
, "SHUTDOWN ACK" },
126 { SCTP_OPERATION_ERR
, "OP ERR" },
127 { SCTP_COOKIE_ECHO
, "COOKIE ECHO" },
128 { SCTP_COOKIE_ACK
, "COOKIE ACK" },
129 { SCTP_ECN_ECHO
, "ECN ECHO" },
130 { SCTP_ECN_CWR
, "ECN CWR" },
131 { SCTP_SHUTDOWN_COMPLETE
, "SHUTDOWN COMPLETE" },
132 { SCTP_FORWARD_CUM_TSN
, "FOR CUM TSN" },
133 { SCTP_RELIABLE_CNTL
, "REL CTRL" },
134 { SCTP_RELIABLE_CNTL_ACK
, "REL CTRL ACK" },
138 /* Data Chuck Specific Flags */
139 #define SCTP_DATA_FRAG_MASK 0x03
140 #define SCTP_DATA_MIDDLE_FRAG 0x00
141 #define SCTP_DATA_LAST_FRAG 0x01
142 #define SCTP_DATA_FIRST_FRAG 0x02
143 #define SCTP_DATA_NOT_FRAG 0x03
144 #define SCTP_DATA_UNORDERED 0x04
146 #define SCTP_ADDRMAX 60
152 /* the sctp common header */
156 nd_uint16_t destination
;
157 nd_uint32_t verificationTag
;
161 /* various descriptor parsers */
163 struct sctpChunkDesc
{
166 nd_uint16_t chunkLength
;
169 struct sctpParamDesc
{
170 nd_uint16_t paramType
;
171 nd_uint16_t paramLength
;
175 struct sctpRelChunkDesc
{
176 struct sctpChunkDesc chk
;
177 nd_uint32_t serialNumber
;
180 struct sctpVendorSpecificParam
{
181 struct sctpParamDesc p
; /* type must be 0xfffe */
182 nd_uint32_t vendorId
; /* vendor ID from RFC 1700 */
183 nd_uint16_t vendorSpecificType
;
184 nd_uint16_t vendorSpecificLen
;
188 /* Structures for the control parts */
192 /* Sctp association init request/ack */
194 /* this is used for init ack, too */
195 struct sctpInitiation
{
196 nd_uint32_t initTag
; /* tag of mine */
197 nd_uint32_t rcvWindowCredit
; /* rwnd */
198 nd_uint16_t NumPreopenStreams
; /* OS */
199 nd_uint16_t MaxInboundStreams
; /* MIS */
200 nd_uint32_t initialTSN
;
201 /* optional param's follow in sctpParamDesc form */
204 struct sctpV4IpAddress
{
205 struct sctpParamDesc p
; /* type is set to SCTP_IPV4_PARAM_TYPE, len=10 */
210 struct sctpV6IpAddress
{
211 struct sctpParamDesc p
; /* type is set to SCTP_IPV6_PARAM_TYPE, len=22 */
216 struct sctpParamDesc param
;
221 struct sctpCookiePreserve
{
222 struct sctpParamDesc p
; /* type is set to SCTP_COOKIE_PRESERVE, len=8 */
223 nd_uint32_t extraTime
;
227 struct sctpTimeStamp
{
233 /* this guy is for use when
234 * I have a initiate message gloming the
238 struct sctpUnifiedInit
{
239 struct sctpChunkDesc uh
;
240 struct sctpInitiation initm
;
243 struct sctpSendableInit
{
244 struct sctpHeader mh
;
245 struct sctpUnifiedInit msg
;
249 /* Selective Acknowledgement
250 * has the following structure with
251 * a optional amount of trailing int's
252 * on the last part (based on the numberOfDesc
256 struct sctpSelectiveAck
{
257 nd_uint32_t highestConseqTSN
;
258 nd_uint32_t updatedRwnd
;
259 nd_uint16_t numberOfdesc
;
260 nd_uint16_t numDupTsns
;
263 struct sctpSelectiveFrag
{
264 nd_uint16_t fragmentStart
;
265 nd_uint16_t fragmentEnd
;
269 struct sctpUnifiedSack
{
270 struct sctpChunkDesc uh
;
271 struct sctpSelectiveAck sack
;
274 /* for the abort and shutdown ACK
275 * we must carry the init tag in the common header. Just the
276 * common header is all that is needed with a chunk descriptor.
278 struct sctpUnifiedAbort
{
279 struct sctpChunkDesc uh
;
282 struct sctpUnifiedAbortLight
{
283 struct sctpHeader mh
;
284 struct sctpChunkDesc uh
;
287 struct sctpUnifiedAbortHeavy
{
288 struct sctpHeader mh
;
289 struct sctpChunkDesc uh
;
290 nd_uint16_t causeCode
;
291 nd_uint16_t causeLen
;
294 /* For the graceful shutdown we must carry
295 * the tag (in common header) and the highest consecutive acking value
297 struct sctpShutdown
{
298 nd_uint32_t TSN_Seen
;
301 struct sctpUnifiedShutdown
{
302 struct sctpChunkDesc uh
;
303 struct sctpShutdown shut
;
306 /* in the unified message we add the trailing
307 * stream id since it is the only message
308 * that is defined as a operation error.
310 struct sctpOpErrorCause
{
312 nd_uint16_t causeLen
;
315 struct sctpUnifiedOpError
{
316 struct sctpChunkDesc uh
;
317 struct sctpOpErrorCause c
;
320 struct sctpUnifiedStreamError
{
321 struct sctpHeader mh
;
322 struct sctpChunkDesc uh
;
323 struct sctpOpErrorCause c
;
325 nd_uint16_t reserved
;
328 struct staleCookieMsg
{
329 struct sctpHeader mh
;
330 struct sctpChunkDesc uh
;
331 struct sctpOpErrorCause c
;
332 nd_uint32_t moretime
;
335 /* the following is used in all sends
336 * where nothing is needed except the
337 * chunk/type i.e. shutdownAck Abort */
339 struct sctpUnifiedSingleMsg
{
340 struct sctpHeader mh
;
341 struct sctpChunkDesc uh
;
346 nd_uint16_t streamId
;
347 nd_uint16_t sequence
;
348 nd_uint32_t payloadtype
;
351 struct sctpUnifiedDatagram
{
352 struct sctpChunkDesc uh
;
353 struct sctpDataPart dp
;
357 struct sctpChunkDesc uh
;
358 nd_uint32_t Lowest_TSN
;
363 struct sctpChunkDesc uh
;
364 nd_uint32_t TSN_reduced_at
;
367 static const struct tok ForCES_channels
[] = {
368 { CHAN_HP
, "ForCES HP" },
369 { CHAN_MP
, "ForCES MP" },
370 { CHAN_LP
, "ForCES LP" },
374 /* data chunk's payload protocol identifiers */
376 #define SCTP_PPID_IUA 1
377 #define SCTP_PPID_M2UA 2
378 #define SCTP_PPID_M3UA 3
379 #define SCTP_PPID_SUA 4
380 #define SCTP_PPID_M2PA 5
381 #define SCTP_PPID_V5UA 6
382 #define SCTP_PPID_H248 7
383 #define SCTP_PPID_BICC 8
384 #define SCTP_PPID_TALI 9
385 #define SCTP_PPID_DUA 10
386 #define SCTP_PPID_ASAP 11
387 #define SCTP_PPID_ENRP 12
388 #define SCTP_PPID_H323 13
389 #define SCTP_PPID_QIPC 14
390 #define SCTP_PPID_SIMCO 15
391 #define SCTP_PPID_DDPSC 16
392 #define SCTP_PPID_DDPSSC 17
393 #define SCTP_PPID_S1AP 18
394 #define SCTP_PPID_RUA 19
395 #define SCTP_PPID_HNBAP 20
396 #define SCTP_PPID_FORCES_HP 21
397 #define SCTP_PPID_FORCES_MP 22
398 #define SCTP_PPID_FORCES_LP 23
399 #define SCTP_PPID_SBC_AP 24
400 #define SCTP_PPID_NBAP 25
402 #define SCTP_PPID_X2AP 27
404 static const struct tok PayloadProto_idents
[] = {
405 { SCTP_PPID_IUA
, "ISDN Q.921" },
406 { SCTP_PPID_M2UA
, "M2UA" },
407 { SCTP_PPID_M3UA
, "M3UA" },
408 { SCTP_PPID_SUA
, "SUA" },
409 { SCTP_PPID_M2PA
, "M2PA" },
410 { SCTP_PPID_V5UA
, "V5.2" },
411 { SCTP_PPID_H248
, "H.248" },
412 { SCTP_PPID_BICC
, "BICC" },
413 { SCTP_PPID_TALI
, "TALI" },
414 { SCTP_PPID_DUA
, "DUA" },
415 { SCTP_PPID_ASAP
, "ASAP" },
416 { SCTP_PPID_ENRP
, "ENRP" },
417 { SCTP_PPID_H323
, "H.323" },
418 { SCTP_PPID_QIPC
, "Q.IPC" },
419 { SCTP_PPID_SIMCO
, "SIMCO" },
420 { SCTP_PPID_DDPSC
, "DDPSC" },
421 { SCTP_PPID_DDPSSC
, "DDPSSC" },
422 { SCTP_PPID_S1AP
, "S1AP" },
423 { SCTP_PPID_RUA
, "RUA" },
424 { SCTP_PPID_HNBAP
, "HNBAP" },
425 { SCTP_PPID_FORCES_HP
, "ForCES HP" },
426 { SCTP_PPID_FORCES_MP
, "ForCES MP" },
427 { SCTP_PPID_FORCES_LP
, "ForCES LP" },
428 { SCTP_PPID_SBC_AP
, "SBc-AP" },
429 { SCTP_PPID_NBAP
, "NBAP" },
431 { SCTP_PPID_X2AP
, "X2AP" },
437 isForCES_port(u_short Port
)
450 sctp_print(netdissect_options
*ndo
,
451 const u_char
*bp
, /* beginning of sctp packet */
452 const u_char
*bp2
, /* beginning of enclosing */
453 u_int sctpPacketLength
) /* sctp packet */
455 u_int sctpPacketLengthRemaining
;
456 const struct sctpHeader
*sctpPktHdr
;
458 const struct ip6_hdr
*ip6
;
460 u_short sourcePort
, destPort
;
462 const struct sctpChunkDesc
*chunkDescPtr
;
466 ndo
->ndo_protocol
= "sctp";
467 ND_ICHECKMSG_ZU("length", sctpPacketLength
, <, sizeof(struct sctpHeader
));
468 sctpPktHdr
= (const struct sctpHeader
*) bp
;
469 ND_TCHECK_SIZE(sctpPktHdr
);
470 sctpPacketLengthRemaining
= sctpPacketLength
;
472 sourcePort
= GET_BE_U_2(sctpPktHdr
->source
);
473 destPort
= GET_BE_U_2(sctpPktHdr
->destination
);
475 ip
= (const struct ip
*)bp2
;
477 ip6
= (const struct ip6_hdr
*)bp2
;
482 ND_PRINT("%s.%u > %s.%u: sctp",
483 GET_IP6ADDR_STRING(ip6
->ip6_src
),
485 GET_IP6ADDR_STRING(ip6
->ip6_dst
),
488 ND_PRINT("%s.%u > %s.%u: sctp",
489 GET_IPADDR_STRING(ip
->ip_src
),
491 GET_IPADDR_STRING(ip
->ip_dst
),
495 if (isForCES_port(sourcePort
)) {
496 ND_PRINT("[%s]", tok2str(ForCES_channels
, NULL
, sourcePort
));
499 if (isForCES_port(destPort
)) {
500 ND_PRINT("[%s]", tok2str(ForCES_channels
, NULL
, destPort
));
504 bp
+= sizeof(struct sctpHeader
);
505 sctpPacketLengthRemaining
-= sizeof(struct sctpHeader
);
507 if (ndo
->ndo_vflag
>= 2)
511 /* cycle through all chunks, printing information on each one */
512 for (chunkCount
= 0, chunkDescPtr
= (const struct sctpChunkDesc
*)bp
;
513 sctpPacketLengthRemaining
!= 0;
516 uint16_t chunkLength
, chunkLengthRemaining
;
519 chunkDescPtr
= (const struct sctpChunkDesc
*)bp
;
520 if (sctpPacketLengthRemaining
< sizeof(*chunkDescPtr
)) {
521 ND_PRINT("%s%u) [chunk descriptor cut off at end of packet]", sep
, chunkCount
+1);
524 ND_TCHECK_SIZE(chunkDescPtr
);
525 chunkLength
= GET_BE_U_2(chunkDescPtr
->chunkLength
);
526 if (chunkLength
< sizeof(*chunkDescPtr
)) {
527 ND_PRINT("%s%u) [Bad chunk length %u, < size of chunk descriptor]", sep
, chunkCount
+1, chunkLength
);
530 chunkLengthRemaining
= chunkLength
;
532 align
= chunkLength
% 4;
536 if (sctpPacketLengthRemaining
< align
) {
537 ND_PRINT("%s%u) [Bad chunk length %u, > remaining data in packet]", sep
, chunkCount
+1, chunkLength
);
541 ND_TCHECK_LEN(bp
, chunkLength
);
543 bp
+= sizeof(*chunkDescPtr
);
544 sctpPacketLengthRemaining
-= sizeof(*chunkDescPtr
);
545 chunkLengthRemaining
-= sizeof(*chunkDescPtr
);
547 ND_PRINT("%s%u) ", sep
, chunkCount
+1);
548 chunkID
= GET_U_1(chunkDescPtr
->chunkID
);
549 ND_PRINT("[%s] ", tok2str(sctp_chunkid_str
, "Unknown chunk type: 0x%x",
554 const struct sctpDataPart
*dataHdrPtr
;
557 uint16_t payload_size
;
559 chunkFlg
= GET_U_1(chunkDescPtr
->chunkFlg
);
560 if ((chunkFlg
& SCTP_DATA_UNORDERED
) == SCTP_DATA_UNORDERED
)
563 if ((chunkFlg
& SCTP_DATA_FIRST_FRAG
) == SCTP_DATA_FIRST_FRAG
)
566 if ((chunkFlg
& SCTP_DATA_LAST_FRAG
) == SCTP_DATA_LAST_FRAG
)
569 if( ((chunkFlg
& SCTP_DATA_UNORDERED
) == SCTP_DATA_UNORDERED
) ||
570 ((chunkFlg
& SCTP_DATA_FIRST_FRAG
) == SCTP_DATA_FIRST_FRAG
) ||
571 ((chunkFlg
& SCTP_DATA_LAST_FRAG
) == SCTP_DATA_LAST_FRAG
) )
574 ND_ICHECKMSG_ZU("chunk length", chunkLengthRemaining
, <,
575 sizeof(*dataHdrPtr
));
576 dataHdrPtr
=(const struct sctpDataPart
*)bp
;
578 ppid
= GET_BE_U_4(dataHdrPtr
->payloadtype
);
579 ND_PRINT("[TSN: %u] ", GET_BE_U_4(dataHdrPtr
->TSN
));
580 ND_PRINT("[SID: %u] ", GET_BE_U_2(dataHdrPtr
->streamId
));
581 ND_PRINT("[SSEQ %u] ", GET_BE_U_2(dataHdrPtr
->sequence
));
582 ND_PRINT("[PPID %s] ",
583 tok2str(PayloadProto_idents
, "0x%x", ppid
));
586 isforces
= (ppid
== SCTP_PPID_FORCES_HP
) ||
587 (ppid
== SCTP_PPID_FORCES_MP
) ||
588 (ppid
== SCTP_PPID_FORCES_LP
);
591 bp
+= sizeof(*dataHdrPtr
);
592 sctpPacketLengthRemaining
-= sizeof(*dataHdrPtr
);
593 chunkLengthRemaining
-= sizeof(*dataHdrPtr
);
594 ND_ICHECKMSG_U("chunk length", chunkLengthRemaining
, ==, 0);
595 payload_size
= chunkLengthRemaining
;
598 forces_print(ndo
, bp
, payload_size
);
599 /* ndo_protocol reassignment after forces_print() call */
600 ndo
->ndo_protocol
= "sctp";
601 } else if (ndo
->ndo_vflag
>= 2) { /* if verbose output is specified */
602 /* at the command line */
604 case SCTP_PPID_M3UA
:
605 m3ua_print(ndo
, bp
, payload_size
);
606 /* ndo_protocol reassignment after m3ua_print() call */
607 ndo
->ndo_protocol
= "sctp";
610 ND_PRINT("[Payload");
611 if (!ndo
->ndo_suppress_default_print
) {
613 ND_DEFAULTPRINT(bp
, payload_size
);
620 sctpPacketLengthRemaining
-= payload_size
;
621 chunkLengthRemaining
-= payload_size
;
624 case SCTP_INITIATION
:
626 const struct sctpInitiation
*init
;
628 ND_ICHECKMSG_ZU("chunk length", chunkLengthRemaining
, <,
630 init
=(const struct sctpInitiation
*)bp
;
631 ND_PRINT("[init tag: %u] ", GET_BE_U_4(init
->initTag
));
632 ND_PRINT("[rwnd: %u] ", GET_BE_U_4(init
->rcvWindowCredit
));
633 ND_PRINT("[OS: %u] ", GET_BE_U_2(init
->NumPreopenStreams
));
634 ND_PRINT("[MIS: %u] ", GET_BE_U_2(init
->MaxInboundStreams
));
635 ND_PRINT("[init TSN: %u] ", GET_BE_U_4(init
->initialTSN
));
637 sctpPacketLengthRemaining
-= sizeof(*init
);
638 chunkLengthRemaining
-= sizeof(*init
);
640 #if 0 /* ALC you can add code for optional params here */
641 if( chunkLengthRemaining
!= 0 )
642 ND_PRINT(" @@@@@ UNFINISHED @@@@@@%s\n",
643 "Optional params present, but not printed.");
645 bp
+= chunkLengthRemaining
;
646 sctpPacketLengthRemaining
-= chunkLengthRemaining
;
647 chunkLengthRemaining
= 0;
650 case SCTP_INITIATION_ACK
:
652 const struct sctpInitiation
*init
;
654 ND_ICHECKMSG_ZU("chunk length", chunkLengthRemaining
, <,
656 init
=(const struct sctpInitiation
*)bp
;
657 ND_PRINT("[init tag: %u] ", GET_BE_U_4(init
->initTag
));
658 ND_PRINT("[rwnd: %u] ", GET_BE_U_4(init
->rcvWindowCredit
));
659 ND_PRINT("[OS: %u] ", GET_BE_U_2(init
->NumPreopenStreams
));
660 ND_PRINT("[MIS: %u] ", GET_BE_U_2(init
->MaxInboundStreams
));
661 ND_PRINT("[init TSN: %u] ", GET_BE_U_4(init
->initialTSN
));
663 sctpPacketLengthRemaining
-= sizeof(*init
);
664 chunkLengthRemaining
-= sizeof(*init
);
666 #if 0 /* ALC you can add code for optional params here */
667 if( chunkLengthRemaining
!= 0 )
668 ND_PRINT(" @@@@@ UNFINISHED @@@@@@%s\n",
669 "Optional params present, but not printed.");
671 bp
+= chunkLengthRemaining
;
672 sctpPacketLengthRemaining
-= chunkLengthRemaining
;
673 chunkLengthRemaining
= 0;
676 case SCTP_SELECTIVE_ACK
:
678 const struct sctpSelectiveAck
*sack
;
679 const struct sctpSelectiveFrag
*frag
;
681 const u_char
*dupTSN
;
683 ND_ICHECKMSG_ZU("chunk length", chunkLengthRemaining
, <,
685 sack
=(const struct sctpSelectiveAck
*)bp
;
686 ND_PRINT("[cum ack %u] ", GET_BE_U_4(sack
->highestConseqTSN
));
687 ND_PRINT("[a_rwnd %u] ", GET_BE_U_4(sack
->updatedRwnd
));
688 ND_PRINT("[#gap acks %u] ", GET_BE_U_2(sack
->numberOfdesc
));
689 ND_PRINT("[#dup tsns %u] ", GET_BE_U_2(sack
->numDupTsns
));
691 sctpPacketLengthRemaining
-= sizeof(*sack
);
692 chunkLengthRemaining
-= sizeof(*sack
);
697 chunkLengthRemaining
!= 0 && fragNo
< GET_BE_U_2(sack
->numberOfdesc
);
698 bp
+= sizeof(*frag
), sctpPacketLengthRemaining
-= sizeof(*frag
), chunkLengthRemaining
-= sizeof(*frag
), fragNo
++) {
699 ND_ICHECKMSG_ZU("chunk length", chunkLengthRemaining
, <,
701 frag
= (const struct sctpSelectiveFrag
*)bp
;
702 ND_PRINT("\n\t\t[gap ack block #%u: start = %u, end = %u] ",
704 GET_BE_U_4(sack
->highestConseqTSN
) + GET_BE_U_2(frag
->fragmentStart
),
705 GET_BE_U_4(sack
->highestConseqTSN
) + GET_BE_U_2(frag
->fragmentEnd
));
708 /* print duplicate TSNs */
710 chunkLengthRemaining
!= 0 && tsnNo
<GET_BE_U_2(sack
->numDupTsns
);
711 bp
+= 4, sctpPacketLengthRemaining
-= 4, chunkLengthRemaining
-= 4, tsnNo
++) {
712 ND_ICHECKMSG_U("chunk length", chunkLengthRemaining
, <, 4);
713 dupTSN
= (const u_char
*)bp
;
714 ND_PRINT("\n\t\t[dup TSN #%u: %u] ", tsnNo
+1,
721 bp
+= chunkLengthRemaining
;
722 sctpPacketLengthRemaining
-= chunkLengthRemaining
;
723 chunkLengthRemaining
= 0;
729 * Any extra stuff at the end of the chunk?
732 bp
+= chunkLengthRemaining
;
733 sctpPacketLengthRemaining
-= chunkLengthRemaining
;
735 if (ndo
->ndo_vflag
< 2)
740 * Fail if the alignment padding isn't in the captured data.
741 * Otherwise, skip it.
743 ND_TCHECK_LEN(bp
, align
);
745 sctpPacketLengthRemaining
-= align
;
750 nd_print_invalid(ndo
);