*/
#ifndef lint
-static const char rcsid[] =
-"@(#) $Header: /tcpdump/master/tcpdump/print-sctp.c,v 1.11 2002-12-11 07:14:08 guy Exp $ (NETLAB/PEL)";
+static const char rcsid[] _U_ =
+"@(#) $Header: /tcpdump/master/tcpdump/print-sctp.c,v 1.15 2003-11-16 09:36:36 guy Exp $ (NETLAB/PEL)";
#endif
#ifdef HAVE_CONFIG_H
#ifdef INET6
if (ip6) {
- if (ip6->ip6_nxt == IPPROTO_SCTP) {
- (void)printf("%s.%d > %s.%d: sctp",
- ip6addr_string(&ip6->ip6_src),
- sourcePort,
- ip6addr_string(&ip6->ip6_dst),
- destPort);
- } else {
- (void)printf("%d > %d: sctp",
- sourcePort, destPort);
- }
+ (void)printf("%s.%d > %s.%d: sctp",
+ ip6addr_string(&ip6->ip6_src),
+ sourcePort,
+ ip6addr_string(&ip6->ip6_dst),
+ destPort);
} else
#endif /*INET6*/
{
- if (ip->ip_p == IPPROTO_SCTP) {
- (void)printf("%s.%d > %s.%d: sctp",
- ipaddr_string(&ip->ip_src),
- sourcePort,
- ipaddr_string(&ip->ip_dst),
- destPort);
- } else {
- (void)printf("%d > %d: sctp",
- sourcePort, destPort);
- }
+ (void)printf("%s.%d > %s.%d: sctp",
+ ipaddr_string(&ip->ip_src),
+ sourcePort,
+ ipaddr_string(&ip->ip_dst),
+ destPort);
}
fflush(stdout);
if (!xflag && !qflag) {
payloadPtr = (const u_char *) (++dataHdrPtr);
printf(":");
+ if (htons(chunkDescPtr->chunkLength) <
+ sizeof(struct sctpDataPart)+
+ sizeof(struct sctpChunkDesc)+1) {
+ printf("bogus chunk length %u]",
+ htons(chunkDescPtr->chunkLength));
+ return;
+ }
default_print(payloadPtr,
- htons(chunkDescPtr->chunkLength)-1 -
- sizeof(struct sctpDataPart)-sizeof(struct sctpChunkDesc));
+ htons(chunkDescPtr->chunkLength) -
+ (sizeof(struct sctpDataPart)+
+ sizeof(struct sctpChunkDesc)+1));
} else
printf("]");
}