]> The Tcpdump Group git mirrors - tcpdump/blobdiff - print-rt6.c
Use "len", not "payload_len", as we step through the packet; use
[tcpdump] / print-rt6.c
index aff7df0919cba33cbc4601018375ff492c6b757a..822ae7cc3a41111781324b80fadcf43742cd2372 100644 (file)
@@ -20,8 +20,8 @@
  */
 
 #ifndef lint
-static const char rcsid[] =
-    "@(#) $Header: /tcpdump/master/tcpdump/print-rt6.c,v 1.19 2002-06-11 17:08:55 itojun Exp $";
+static const char rcsid[] _U_ =
+    "@(#) $Header: /tcpdump/master/tcpdump/print-rt6.c,v 1.26 2003-11-19 00:36:08 guy Exp $";
 #endif
 
 #ifdef HAVE_CONFIG_H
@@ -30,13 +30,7 @@ static const char rcsid[] =
 
 #ifdef INET6
 
-#include <sys/param.h>
-#include <sys/time.h>
-#include <sys/types.h>
-#include <sys/socket.h>
-
-
-#include <netinet/in.h>
+#include <tcpdump-stdinc.h>
 
 #include <stdio.h>
 
@@ -44,6 +38,7 @@ static const char rcsid[] =
 
 #include "interface.h"
 #include "addrtoname.h"
+#include "extract.h"
 
 int
 rt6_print(register const u_char *bp, register const u_char *bp2)
@@ -71,14 +66,18 @@ rt6_print(register const u_char *bp, register const u_char *bp2)
        switch (dp->ip6r_type) {
 #ifndef IPV6_RTHDR_TYPE_0
 #define IPV6_RTHDR_TYPE_0 0
+#endif
+#ifndef IPV6_RTHDR_TYPE_2
+#define IPV6_RTHDR_TYPE_2 2
 #endif
        case IPV6_RTHDR_TYPE_0:
+       case IPV6_RTHDR_TYPE_2:                 /* Mobile IPv6 ID-20 */
                dp0 = (struct ip6_rthdr0 *)dp;
 
                TCHECK(dp0->ip6r0_reserved);
                if (dp0->ip6r0_reserved || vflag) {
                        printf(", rsv=0x%0x",
-                           (u_int32_t)ntohl(dp0->ip6r0_reserved));
+                           EXTRACT_32BITS(&dp0->ip6r0_reserved));
                }
 
                if (len % 2 == 1)
@@ -103,6 +102,6 @@ rt6_print(register const u_char *bp, register const u_char *bp2)
 
  trunc:
        fputs("[|srcrt]", stdout);
-       return 65535;           /* XXX */
+       return -1;
 }
 #endif /* INET6 */