]> The Tcpdump Group git mirrors - tcpdump/commitdiff
From Kazushi Sugyo <[email protected]>:
authorguy <guy>
Thu, 27 Jun 2002 08:21:39 +0000 (08:21 +0000)
committerguy <guy>
Thu, 27 Jun 2002 08:21:39 +0000 (08:21 +0000)
Here is a patch for draft-ietf-mobileip-ipv6-17.
- print-mobility.c: Mobility header(MIPv6 defines a new IPv6 protocol)
  printing
- added Routing header type 2
- ICMPv6 Home Agent Address Discovery and Mobile Prefix Sol., Adv.
  message update

FILES
configure
configure.in
interface.h
print-icmp6.c
print-ip6.c
print-mobility.c [new file with mode: 0644]
print-rt6.c

diff --git a/FILES b/FILES
index 0ac8a388987007ef103aa093c8903713b28ed922..bac3414d8ea68276b89a6bdd3dc74aed1e1b850a 100644 (file)
--- a/FILES
+++ b/FILES
@@ -120,6 +120,7 @@ print-lcp.c
 print-llc.c
 print-lwres.c
 print-mobile.c
 print-llc.c
 print-lwres.c
 print-mobile.c
+print-mobility.c
 print-mpls.c
 print-msdp.c
 print-netbios.c
 print-mpls.c
 print-msdp.c
 print-netbios.c
index 3cf0062b07b015b1e5b6a3384f00b395995f90f4..bf73dce8a538af5e1633c4e4f200b26c524bda87 100755 (executable)
--- a/configure
+++ b/configure
@@ -1,6 +1,6 @@
 #! /bin/sh
 
 #! /bin/sh
 
-# From configure.in Revision: 1.150 
+# From configure.in Revision: 1.151 
 
 
 
 
 
 
@@ -1525,7 +1525,7 @@ if test "${enable_ipv6+set}" = set; then
   enableval="$enable_ipv6"
    case "$enableval" in
 yes)   echo "$ac_t""yes" 1>&6
   enableval="$enable_ipv6"
    case "$enableval" in
 yes)   echo "$ac_t""yes" 1>&6
-       LOCALSRC="print-ip6.c print-ip6opts.c print-ripng.c print-icmp6.c print-frag6.c print-rt6.c print-ospf6.c print-dhcp6.c $LOCALSRC"
+       LOCALSRC="print-ip6.c print-ip6opts.c print-mobility.c print-ripng.c print-icmp6.c print-frag6.c print-rt6.c print-ospf6.c print-dhcp6.c $LOCALSRC"
        cat >> confdefs.h <<\EOF
 #define INET6 1
 EOF
        cat >> confdefs.h <<\EOF
 #define INET6 1
 EOF
@@ -1561,7 +1561,7 @@ EOF
 if { (eval echo configure:1562: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
 then
    echo "$ac_t""yes" 1>&6
 if { (eval echo configure:1562: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
 then
    echo "$ac_t""yes" 1>&6
-  LOCALSRC="print-ip6.c print-ip6opts.c print-ripng.c print-icmp6.c print-frag6.c print-rt6.c print-ospf6.c print-dhcp6.c $LOCALSRC"
+  LOCALSRC="print-ip6.c print-ip6opts.c print-mobility.c print-ripng.c print-icmp6.c print-frag6.c print-rt6.c print-ospf6.c print-dhcp6.c $LOCALSRC"
   cat >> confdefs.h <<\EOF
 #define INET6 1
 EOF
   cat >> confdefs.h <<\EOF
 #define INET6 1
 EOF
index d1fce1f2812935bd79e2642fce0fae40816f14ee..19ea29edc792ee9f36ecd1a425f40b0995319e10 100644 (file)
@@ -1,4 +1,4 @@
-dnl @(#) $Header: /tcpdump/master/tcpdump/configure.in,v 1.150 2002-06-11 17:15:32 itojun Exp $ (LBL)
+dnl @(#) $Header: /tcpdump/master/tcpdump/configure.in,v 1.151 2002-06-27 08:21:40 guy Exp $ (LBL)
 dnl
 dnl Copyright (c) 1994, 1995, 1996, 1997
 dnl    The Regents of the University of California.  All rights reserved.
 dnl
 dnl Copyright (c) 1994, 1995, 1996, 1997
 dnl    The Regents of the University of California.  All rights reserved.
@@ -6,7 +6,7 @@ dnl
 dnl Process this file with autoconf to produce a configure script.
 dnl
 
 dnl Process this file with autoconf to produce a configure script.
 dnl
 
-AC_REVISION($Revision: 1.150 $)
+AC_REVISION($Revision: 1.151 $)
 AC_PREREQ(2.13)
 AC_INIT(tcpdump.c)
 
 AC_PREREQ(2.13)
 AC_INIT(tcpdump.c)
 
@@ -108,7 +108,7 @@ AC_ARG_ENABLE(ipv6,
   --disable-ipv6          disable ipv6 support],
 [ case "$enableval" in
 yes)   AC_MSG_RESULT(yes)
   --disable-ipv6          disable ipv6 support],
 [ case "$enableval" in
 yes)   AC_MSG_RESULT(yes)
-       LOCALSRC="print-ip6.c print-ip6opts.c print-ripng.c print-icmp6.c print-frag6.c print-rt6.c print-ospf6.c print-dhcp6.c $LOCALSRC"
+       LOCALSRC="print-ip6.c print-ip6opts.c print-mobility.c print-ripng.c print-icmp6.c print-frag6.c print-rt6.c print-ospf6.c print-dhcp6.c $LOCALSRC"
        AC_DEFINE(INET6)
        ipv6=yes
        ;;
        AC_DEFINE(INET6)
        ipv6=yes
        ;;
@@ -130,7 +130,7 @@ main()
 }
 ],
 [ AC_MSG_RESULT(yes)
 }
 ],
 [ AC_MSG_RESULT(yes)
-  LOCALSRC="print-ip6.c print-ip6opts.c print-ripng.c print-icmp6.c print-frag6.c print-rt6.c print-ospf6.c print-dhcp6.c $LOCALSRC"
+  LOCALSRC="print-ip6.c print-ip6opts.c print-mobility.c print-ripng.c print-icmp6.c print-frag6.c print-rt6.c print-ospf6.c print-dhcp6.c $LOCALSRC"
   AC_DEFINE(INET6)
   ipv6=yes],
 [ AC_MSG_RESULT(no)
   AC_DEFINE(INET6)
   ipv6=yes],
 [ AC_MSG_RESULT(no)
index a3c5d08ba7605d6532c560ce355b5e472d731b53..c94612cc67c2830a5d368758d7ca6edf8afbc811 100644 (file)
@@ -18,7 +18,7 @@
  * WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF
  * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
  *
  * WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF
  * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
  *
- * @(#) $Header: /tcpdump/master/tcpdump/interface.h,v 1.186 2002-06-11 17:08:38 itojun Exp $ (LBL)
+ * @(#) $Header: /tcpdump/master/tcpdump/interface.h,v 1.187 2002-06-27 08:21:40 guy Exp $ (LBL)
  */
 
 #ifndef tcpdump_interface_h
  */
 
 #ifndef tcpdump_interface_h
@@ -308,6 +308,7 @@ extern void ip6_opt_print(const u_char *, int);
 extern int hbhopt_print(const u_char *);
 extern int dstopt_print(const u_char *);
 extern int frag6_print(const u_char *, const u_char *);
 extern int hbhopt_print(const u_char *);
 extern int dstopt_print(const u_char *);
 extern int frag6_print(const u_char *, const u_char *);
+extern int mobility_print(const u_char *, const u_char *);
 extern void icmp6_print(const u_char *, const u_char *);
 extern void ripng_print(const u_char *, unsigned int);
 extern int rt6_print(const u_char *, const u_char *);
 extern void icmp6_print(const u_char *, const u_char *);
 extern void ripng_print(const u_char *, unsigned int);
 extern int rt6_print(const u_char *, const u_char *);
index 0b13305ab4e4989a7f2712d1da13294a697e753a..0b24c0cbc535a3ef455ddac7628c2ab8618f1352 100644 (file)
@@ -21,7 +21,7 @@
 
 #ifndef lint
 static const char rcsid[] =
 
 #ifndef lint
 static const char rcsid[] =
-    "@(#) $Header: /tcpdump/master/tcpdump/print-icmp6.c,v 1.61 2002-06-11 17:08:48 itojun Exp $";
+    "@(#) $Header: /tcpdump/master/tcpdump/print-icmp6.c,v 1.62 2002-06-27 08:21:40 guy Exp $";
 #endif
 
 #ifdef HAVE_CONFIG_H
 #endif
 
 #ifdef HAVE_CONFIG_H
@@ -357,27 +357,42 @@ icmp6_print(const u_char *bp, const u_char *bp2)
                icmp6_nodeinfo_print(icmp6len, bp, ep);
                break;
        case ICMP6_HADISCOV_REQUEST:
                icmp6_nodeinfo_print(icmp6len, bp, ep);
                break;
        case ICMP6_HADISCOV_REQUEST:
+               printf("icmp6: ha discovery request");
+               if (vflag) {
+                       TCHECK(dp->icmp6_data16[0]);
+                       printf("(id=%d)", ntohs(dp->icmp6_data16[0]));
+               }
+               break;
        case ICMP6_HADISCOV_REPLY:
        case ICMP6_HADISCOV_REPLY:
-       {
-               struct in6_addr *in6;
-               u_int32_t *res;
-               u_char *cp;
-               printf("icmp6: ha discovery %s: ",
-                      dp->icmp6_type == ICMP6_HADISCOV_REQUEST ?
-                      "request" : "reply");
-               TCHECK(dp->icmp6_data16[0]);
-               printf("id=%d", ntohs(dp->icmp6_data16[0]));
-               cp = (u_char *)dp + icmp6len;
-               res = (u_int32_t *)(dp + 1);
-               in6 = (struct in6_addr *)(res + 2);
-               for (; (u_char *)in6 < cp; in6++) {
-                       TCHECK(*in6);
-                       printf(", %s", ip6addr_string(in6));
+               printf("icmp6: ha discovery reply");
+               if (vflag) {
+                       struct in6_addr *in6;
+                       u_int32_t *res;
+                       u_char *cp;
+
+                       TCHECK(dp->icmp6_data16[0]);
+                       printf("(id=%d", ntohs(dp->icmp6_data16[0]));
+                       cp = (u_char *)dp + icmp6len;
+                       res = (u_int32_t *)(dp + 1);
+                       in6 = (struct in6_addr *)(res + 2);
+                       for (; (u_char *)in6 < cp; in6++) {
+                               TCHECK(*in6);
+                               printf(", %s", ip6addr_string(in6));
+                       }
+                       printf(")");
                }
                break;
                }
                break;
-       }
        case ICMP6_MOBILEPREFIX_SOLICIT:
        case ICMP6_MOBILEPREFIX_SOLICIT:
+               printf("icmp6: mobile router solicitation");
+               break;
        case ICMP6_MOBILEPREFIX_ADVERT:
        case ICMP6_MOBILEPREFIX_ADVERT:
+               printf("icmp6: mobile router advertisement");
+               if (vflag) {
+#define MPADVLEN 4
+                       icmp6_opt_print((const u_char *)dp + MPADVLEN,
+                                       icmp6len - MPADVLEN);
+               }
+               break;
        default:
                printf("icmp6: type-#%d", dp->icmp6_type);
                break;
        default:
                printf("icmp6: type-#%d", dp->icmp6_type);
                break;
index 41cbf92802e33a0394407a9a631bc11616be7447..44121fc79f2cd6c76368ec8abc19a99e3da396dc 100644 (file)
@@ -21,7 +21,7 @@
 
 #ifndef lint
 static const char rcsid[] =
 
 #ifndef lint
 static const char rcsid[] =
-    "@(#) $Header: /tcpdump/master/tcpdump/print-ip6.c,v 1.22 2002-06-11 17:08:50 itojun Exp $";
+    "@(#) $Header: /tcpdump/master/tcpdump/print-ip6.c,v 1.23 2002-06-27 08:21:41 guy Exp $";
 #endif
 
 #ifdef HAVE_CONFIG_H
 #endif
 
 #ifdef HAVE_CONFIG_H
@@ -121,6 +121,13 @@ ip6_print(register const u_char *bp, register u_int length)
                        nh = *cp;
                        fragmented = 1;
                        break;
                        nh = *cp;
                        fragmented = 1;
                        break;
+#ifndef IPPROTO_MOBILITY
+#define IPPROTO_MOBILITY 62
+#endif
+               case IPPROTO_MOBILITY:
+                       advance = mobility_print(cp, (const u_char *)ip6);
+                       nh = *cp;
+                       goto end;
                case IPPROTO_ROUTING:
                        advance = rt6_print(cp, (const u_char *)ip6);
                        nh = *cp;
                case IPPROTO_ROUTING:
                        advance = rt6_print(cp, (const u_char *)ip6);
                        nh = *cp;
diff --git a/print-mobility.c b/print-mobility.c
new file mode 100644 (file)
index 0000000..e746806
--- /dev/null
@@ -0,0 +1,304 @@
+/*
+ * Copyright (C) 2002 WIDE Project.
+ * All rights reserved.
+ * 
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ * 3. Neither the name of the project nor the names of its contributors
+ *    may be used to endorse or promote products derived from this software
+ *    without specific prior written permission.
+ * 
+ * THIS SOFTWARE IS PROVIDED BY THE PROJECT AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED.  IN NO EVENT SHALL THE PROJECT OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ */
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#ifndef lint
+static const char rcsid[] =
+     "@(#) $Header: /tcpdump/master/tcpdump/print-mobility.c,v 1.1 2002-06-27 08:22:41 guy Exp $";
+#endif
+
+#ifdef INET6
+#include <sys/param.h>
+#include <sys/time.h>
+#include <sys/types.h>
+#include <sys/socket.h>
+
+#include <netinet/in.h>
+#include <stdio.h>
+
+#include "ip6.h"
+
+#include "interface.h"
+#include "addrtoname.h"
+#include "extract.h"           /* must come after interface.h */
+
+/* Mobility header */
+struct ip6_mobility {
+        u_int8_t ip6m_pproto;   /* following payload protocol (for PG) */
+       u_int8_t ip6m_len;      /* length in units of 8 octets */
+       u_int16_t ip6m_type;    /* message type */
+       u_int16_t ip6m_cksum;   /* sum of IPv6 pseudo-header and MH */
+       union {
+               u_int16_t       ip6m_un_data16[1]; /* type-specific field */
+               u_int8_t        ip6m_un_data8[2];  /* type-specific fiedl */
+       } ip6m_dataun;
+};
+
+#define ip6m_data16    ip6m_dataun.ip6m_un_data16
+#define ip6m_data8     ip6m_dataun.ip6m_un_data8
+
+#define IP6M_MINLEN    8
+
+/* message type */
+#if BYTE_ORDER == BIG_ENDIAN
+#define IP6M_BINDING_REQUEST   0x0000  /* Binding Refresh Request */
+#define IP6M_HOME_TEST_INIT    0x0001  /* Home Test Init */
+#define IP6M_CAREOF_TEST_INIT  0x0002  /* Care-of Test Init */
+#define IP6M_HOME_TEST         0x0003  /* Home Test */
+#define IP6M_CAREOF_TEST       0x0004  /* Care-of Test */
+#define IP6M_BINDING_UPDATE    0x0005  /* Binding Update */
+#define IP6M_BINDING_ACK       0x0006  /* Binding Acknowledgement */
+#define IP6M_BINDING_ERROR     0x0007  /* Binding Error */
+#else /* BYTE_ORDER == LITTLE_ENDIAN */
+#define IP6M_BINDING_REQUEST   0x0000  /* Binding Refresh Request */
+#define IP6M_HOME_TEST_INIT    0x0100  /* Home Test Init */
+#define IP6M_CAREOF_TEST_INIT  0x0200  /* Care-of Test Init */
+#define IP6M_HOME_TEST         0x0300  /* Home Test */
+#define IP6M_CAREOF_TEST       0x0400  /* Care-of Test */
+#define IP6M_BINDING_UPDATE    0x0500  /* Binding Update */
+#define IP6M_BINDING_ACK       0x0600  /* Binding Acknowledgement */
+#define IP6M_BINDING_ERROR     0x0700  /* Binding Error */
+#endif /* BYTE_ORDER == LITTLE_ENDIAN */
+
+/* Mobility Header Options */
+#define IP6MOPT_MINLEN         2
+#define IP6MOPT_PAD1          0x0
+#define IP6MOPT_PADN          0x1
+#define IP6MOPT_UI            0x2
+#define IP6MOPT_UI_MINLEN       4
+#define IP6MOPT_ALTCOA        0x3
+#define IP6MOPT_ALTCOA_MINLEN  18
+#define IP6MOPT_NONCEID       0x4
+#define IP6MOPT_NONCEID_MINLEN  6
+#define IP6MOPT_AUTH          0x5
+#define IP6MOPT_AUTH_MINLEN     2 /* 2+len */
+
+void
+mobility_opt_print(const u_char *bp, int len)
+{
+       int i;
+       int optlen;
+
+       for (i = 0; i < len; i += optlen) {
+               if (bp[i] == IP6MOPT_PAD1)
+                       optlen = 1;
+               else {
+                       if (i + 1 < len)
+                               optlen = bp[i + 1];
+                       else
+                               goto trunc;
+                       if (optlen < IP6MOPT_MINLEN)
+                               optlen = IP6MOPT_MINLEN;        /* XXX */
+               }
+               if (i + optlen > len)
+                       goto trunc;
+
+               switch (bp[i]) {
+               case IP6MOPT_PAD1:
+                       printf("(pad1)");
+                       break;
+               case IP6MOPT_PADN:
+                       if (len - i < IP6MOPT_MINLEN) {
+                               printf("(padn: trunc)");
+                               goto trunc;
+                       }
+                       printf("(padn)");
+                       break;
+               case IP6MOPT_UI:
+                       if (len - i < IP6MOPT_UI_MINLEN) {
+                               printf("(ui: trunc)");
+                               goto trunc;
+                       }
+                       printf("(ui: 0x%04x)", ntohs(*(u_int16_t *)&bp[i + 2]));
+                       break;
+               case IP6MOPT_ALTCOA:
+                       if (len - i < IP6MOPT_ALTCOA_MINLEN) {
+                               printf("(altcoa: trunc)");
+                               goto trunc;
+                       }
+                       printf("(alt-CoA: %s)", ip6addr_string(&bp[i+2]));
+                       break;
+               case IP6MOPT_NONCEID:
+                       if (len - i < IP6MOPT_NONCEID_MINLEN) {
+                               printf("(ni: trunc)");
+                               goto trunc;
+                       }
+                       printf("(ni: ho=0x%04x ci=0x%04x)",
+                               ntohs(*(u_int16_t *)&bp[i + 2]),
+                               ntohs(*(u_int16_t *)&bp[i + 4]));
+                       break;
+               case IP6MOPT_AUTH:
+                       if (len - i < IP6MOPT_AUTH_MINLEN) {
+                               printf("(auth: trunc)");
+                               goto trunc;
+                       }
+                       printf("(auth spi: 0x%08x)",
+                               (u_int32_t)ntohl(*(u_int32_t *)&bp[i + 2]));
+                       break;
+               default:
+                       if (len - i < IP6MOPT_MINLEN) {
+                               printf("(sopt_type %d: trunc)", bp[i]);
+                               goto trunc;
+                       }
+                       printf("(type-0x%02x: len=%d)", bp[i], bp[i + 1]);
+                       break;
+               }
+       }
+       return;
+
+trunc:
+       printf("[trunc] ");
+}
+
+/*
+ * Mobility Header
+ */
+int
+mobility_print(const u_char *bp, const u_char *bp2)
+{
+       const struct ip6_mobility *mh;
+       const struct ip6_hdr *ip6;
+       const u_char *ep;
+       int mhlen, hlen;
+
+       mh = (struct ip6_mobility *)bp;
+       ip6 = (struct ip6_hdr *)bp2;
+
+       /* 'ep' points to the end of available data. */
+       ep = snapend;
+
+       TCHECK(mh->ip6m_len);
+       mhlen = (int)(mh->ip6m_len << 3);
+       if (mhlen < IP6M_MINLEN)
+               mhlen = IP6M_MINLEN;    /* XXX */
+
+       /* XXX ip6m_cksum */
+
+       TCHECK(mh->ip6m_type);
+       switch (mh->ip6m_type) {
+       case IP6M_BINDING_REQUEST:
+               printf("mobility: BRR");
+               hlen = IP6M_MINLEN;
+               break;
+       case IP6M_HOME_TEST_INIT:
+       case IP6M_CAREOF_TEST_INIT:
+               printf("mobility: %soTI",
+                       mh->ip6m_type == IP6M_HOME_TEST_INIT ? "H" : "C");
+               hlen = IP6M_MINLEN;
+               TCHECK2(*mh, hlen + 4);
+               printf(" cookie=0x%x", ntohl(*(u_int32_t *)&bp[hlen]));
+               hlen += 4;
+               break;
+       case IP6M_HOME_TEST:
+       case IP6M_CAREOF_TEST:
+               printf("mobility: %soT",
+                       mh->ip6m_type == IP6M_HOME_TEST ? "H" : "C");
+               hlen = IP6M_MINLEN;
+               TCHECK2(*mh, hlen + 2);
+               printf(" nonce id=0x%x", ntohs(*(u_int16_t *)&bp[hlen]));
+               hlen += 2;
+               /* Reserved (16bits) */
+               hlen += 2;
+               TCHECK2(*mh, hlen + 4);
+               printf(" mobile cookie=0x%x", ntohl(*(u_int32_t *)&bp[hlen]));
+               hlen += 4;
+               /* Home(Care-of) Cookie (128 bits) */
+               hlen += 16;
+               break;
+       case IP6M_BINDING_UPDATE:
+               printf("mobility: BU");
+               TCHECK(mh->ip6m_data8[0]);
+               if (mh->ip6m_data8[0] & 0xf0)
+                       printf(" ");
+               if (mh->ip6m_data8[0] & 0x80)
+                       printf("A");
+               if (mh->ip6m_data8[0] & 0x40)
+                       printf("H");
+               if (mh->ip6m_data8[0] & 0x20)
+                       printf("S");
+               if (mh->ip6m_data8[0] & 0x10)
+                       printf("D");
+               hlen = IP6M_MINLEN;
+               TCHECK2(*mh, hlen + 2);
+               printf(" seq#=%d", ntohs(*(u_int16_t *)&bp[hlen]));
+               hlen += 2;
+               /* Reserved (16bits) */
+               hlen += 2;
+               TCHECK2(*mh, hlen + 4);
+               printf(" lifetime=%d", ntohl(*(u_int32_t *)&bp[hlen]));
+               hlen += 4;
+               TCHECK2(*mh, hlen + 16);
+               printf(" homeaddr %s", ip6addr_string(&bp[hlen]));
+               hlen += 16;
+               break;
+       case IP6M_BINDING_ACK:
+               printf("mobility: BA");
+               TCHECK(mh->ip6m_data8[0]);
+               printf(" status=%d", mh->ip6m_data8[0]);
+               hlen = IP6M_MINLEN;
+               TCHECK2(*mh, hlen + 2);
+               printf(" seq#=%d", ntohs(*(u_int16_t *)&bp[hlen]));
+               hlen += 2;
+               /* Reserved (16bits) */
+               hlen += 2;
+               TCHECK2(*mh, hlen + 4);
+               printf(" lifetime=%d", ntohl(*(u_int32_t *)&bp[hlen]));
+               hlen += 4;
+               TCHECK2(*mh, hlen + 4);
+               printf(" refresh=%d", ntohl(*(u_int32_t *)&bp[hlen]));
+               hlen += 4;
+               break;
+       case IP6M_BINDING_ERROR:
+               printf("mobility: BE");
+               TCHECK(mh->ip6m_data8[0]);
+               printf(" status=%d", mh->ip6m_data8[0]);
+               hlen = IP6M_MINLEN;
+               TCHECK2(*mh, hlen + 16);
+               printf(" homeaddr %s", ip6addr_string(&bp[hlen]));
+               hlen += 16;
+               break;
+       default:
+               printf("mobility: type-#%d len=%d", ntohs(mh->ip6m_type),
+                       mh->ip6m_len);
+               return(mhlen);
+               break;
+       }
+       if (vflag)
+               mobility_opt_print(&bp[hlen], mhlen - hlen);
+
+       return(mhlen);
+
+ trunc:
+       fputs("[|MOBILITY]", stdout);
+       return(mhlen);
+}
+#endif /* INET6 */
index aff7df0919cba33cbc4601018375ff492c6b757a..24f2d473f9c48415ebb3d35ae7d5e0f4bd164310 100644 (file)
@@ -21,7 +21,7 @@
 
 #ifndef lint
 static const char rcsid[] =
 
 #ifndef lint
 static const char rcsid[] =
-    "@(#) $Header: /tcpdump/master/tcpdump/print-rt6.c,v 1.19 2002-06-11 17:08:55 itojun Exp $";
+    "@(#) $Header: /tcpdump/master/tcpdump/print-rt6.c,v 1.20 2002-06-27 08:21:41 guy Exp $";
 #endif
 
 #ifdef HAVE_CONFIG_H
 #endif
 
 #ifdef HAVE_CONFIG_H
@@ -71,8 +71,12 @@ 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
        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:
 #endif
        case IPV6_RTHDR_TYPE_0:
+       case IPV6_RTHDR_TYPE_2:                 /* Mobile IPv6 ID-17 */
                dp0 = (struct ip6_rthdr0 *)dp;
 
                TCHECK(dp0->ip6r0_reserved);
                dp0 = (struct ip6_rthdr0 *)dp;
 
                TCHECK(dp0->ip6r0_reserved);