]> The Tcpdump Group git mirrors - tcpdump/commitdiff
The SCTP dissector is only called for SCTP packets, so there's no reason
authorguy <guy>
Tue, 3 Jun 2003 23:49:22 +0000 (23:49 +0000)
committerguy <guy>
Tue, 3 Jun 2003 23:49:22 +0000 (23:49 +0000)
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.

print-ip6.c
print-sctp.c
sctpConstants.h

index 9f5777a3001853d474ade7121f69617facdaa334..6050a533c454d458949121fde7d07695a05b7365 100644 (file)
@@ -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 @@ ip6_print(register const u_char *bp, register u_int length)
        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 @@ ip6_print(register const u_char *bp, register u_int length)
                        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);
index 6606dbad6be505e1683565faec6cadb3fd12ce0d..cb6c4d671f44f275ef90c2fc23f48a3b1749482b 100644 (file)
@@ -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 @@ void sctp_print(const u_char *bp,        /* beginning of sctp packet */
 
 #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);
 
index 17f43e8becdeca6080a211ce1d3bd3d66c621c76..ac28a151d0e8837caf9a1f069e46be878be6fec7 100644 (file)
@@ -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
  *
 
 #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