The SCTP dissector is only called for SCTP packets, so there's no reason
for it to check the protocol number in the IP header.
Have the IPv6 dissector call the SCTP dissector for SCTP packets.
Get rid of the definition of IPPROTO_SCTP in sctpConstants.h, so we
don't have problems if <netinet/in.h> also defines it.
diff --git a/print-ip6.c b/print-ip6.c
index 9f5777a..6050a53 100644
--- a/print-ip6.c
+++ b/print-ip6.c
@@ -21,7 +21,7 @@
#ifndef lint
static const char rcsid[] =
- "@(#) $Header: /tcpdump/master/tcpdump/print-ip6.c,v 1.29 2003-05-02 08:13:55 itojun Exp $";
+ "@(#) $Header: /tcpdump/master/tcpdump/print-ip6.c,v 1.30 2003-06-03 23:49:22 guy Exp $";
#endif
#ifdef HAVE_CONFIG_H
@@ -75,8 +75,12 @@
while (cp < snapend) {
cp += advance;
+#ifndef IPPROTO_SCTP
+#define IPPROTO_SCTP 132
+#endif
if (cp == (const u_char *)(ip6 + 1)
- && nh != IPPROTO_TCP && nh != IPPROTO_UDP) {
+ && nh != IPPROTO_TCP && nh != IPPROTO_UDP
+ && nh != IPPROTO_SCTP) {
(void)printf("%s > %s: ", ip6addr_string(&ip6->ip6_src),
ip6addr_string(&ip6->ip6_dst));
}
@@ -112,6 +116,10 @@
advance = rt6_print(cp, (const u_char *)ip6);
nh = *cp;
break;
+ case IPPROTO_SCTP:
+ sctp_print(cp, (const u_char *)ip6,
+ len + sizeof(struct ip6_hdr) - (cp - bp));
+ goto end;
case IPPROTO_TCP:
tcp_print(cp, len + sizeof(struct ip6_hdr) - (cp - bp),
(const u_char *)ip6, fragmented);
diff --git a/print-sctp.c b/print-sctp.c
index 6606dba..cb6c4d6 100644
--- a/print-sctp.c
+++ b/print-sctp.c
@@ -35,7 +35,7 @@
#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)";
+"@(#) $Header: /tcpdump/master/tcpdump/print-sctp.c,v 1.12 2003-06-03 23:49:23 guy Exp $ (NETLAB/PEL)";
#endif
#ifdef HAVE_CONFIG_H
@@ -109,29 +109,19 @@
#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);
diff --git a/sctpConstants.h b/sctpConstants.h
index 17f43e8..ac28a15 100644
--- a/sctpConstants.h
+++ b/sctpConstants.h
@@ -1,4 +1,4 @@
-/* @(#) $Header: /tcpdump/master/tcpdump/sctpConstants.h,v 1.3 2002-06-11 17:08:59 itojun Exp $ (LBL) */
+/* @(#) $Header: /tcpdump/master/tcpdump/sctpConstants.h,v 1.4 2003-06-03 23:49:23 guy Exp $ (LBL) */
/* SCTP reference Implementation Copyright (C) 1999 Cisco And Motorola
*
@@ -514,11 +514,6 @@
#define SCTP_DEAMON_PORT 9899
-
-#ifndef IPPROTO_SCTP
-#define IPPROTO_SCTP 132 /* the Official IANA number :-) */
-#endif
-
/* Deamon registration message types/responses */
#define DEAMON_REGISTER 0x01
#define DEAMON_REGISTER_ACK 0x02