]> The Tcpdump Group git mirrors - tcpdump/blobdiff - print-icmp6.c
Get rid of unneeded includes of <netinet/in_systm.h> and <netinet/ip.h>.
[tcpdump] / print-icmp6.c
index d46094ecf125b0cc405e3942b33d418ddf35bfae..71323c7dcd895098be86fd971e2c98edaa29cc78 100644 (file)
@@ -21,7 +21,7 @@
 
 #ifndef lint
 static const char rcsid[] =
-    "@(#) $Header: /tcpdump/master/tcpdump/print-icmp6.c,v 1.55 2001-06-15 22:17:32 fenner Exp $";
+    "@(#) $Header: /tcpdump/master/tcpdump/print-icmp6.c,v 1.60 2002-05-30 22:01:34 itojun Exp $";
 #endif
 
 #ifdef HAVE_CONFIG_H
@@ -43,6 +43,7 @@ static const char rcsid[] =
 #include <arpa/inet.h>
 
 #include <stdio.h>
+#include <string.h>
 #include <netdb.h>
 
 #include "ip6.h"
@@ -355,6 +356,28 @@ icmp6_print(const u_char *bp, const u_char *bp2)
        case ICMP6_NI_REPLY:
                icmp6_nodeinfo_print(icmp6len, bp, ep);
                break;
+       case ICMP6_HADISCOV_REQUEST:
+       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));
+               }
+               break;
+       }
+       case ICMP6_MOBILEPREFIX_SOLICIT:
+       case ICMP6_MOBILEPREFIX_ADVERT:
        default:
                printf("icmp6: type-#%d", dp->icmp6_type);
                break;
@@ -446,6 +469,7 @@ icmp6_opt_print(const u_char *bp, int resid)
        const struct icmp6_opts_redirect *opr;
        const struct nd_opt_mtu *opm;
        const struct nd_opt_advinterval *opa;
+       const struct nd_opt_homeagent_info *oph;
        const struct nd_opt_route_info *opri;
        const u_char *cp, *ep;
        struct in6_addr in6, *in6p;
@@ -544,6 +568,14 @@ icmp6_opt_print(const u_char *bp, int resid)
                        /*(*/
                        printf(")");
                        break;                
+               case ND_OPT_HOMEAGENT_INFO:
+                       oph = (struct nd_opt_homeagent_info *)op;
+                       TCHECK(oph->nd_opt_hai_lifetime);
+                       printf("(ha info:");    /*)*/
+                       printf(" pref=%d", ntohs(oph->nd_opt_hai_preference));
+                       printf(", lifetime=%u", ntohs(oph->nd_opt_hai_lifetime));
+                       printf(")");
+                       break;                
                case ND_OPT_ROUTE_INFO:
                        opri = (struct nd_opt_route_info *)op;
                        TCHECK(opri->nd_opt_rti_lifetime);
@@ -573,7 +605,7 @@ icmp6_opt_print(const u_char *bp, int resid)
                        printf(")");
                        break;
                default:
-                       printf("(unknwon opt_type=%d, opt_len=%d)",
+                       printf("(unknown opt_type=%d, opt_len=%d)",
                               op->nd_opt_type, op->nd_opt_len);
                        break;
                }