]> The Tcpdump Group git mirrors - tcpdump/commitdiff
RFC 5006 support.
authorDavid Horn <[email protected]>
Sun, 7 Feb 2010 22:52:07 +0000 (14:52 -0800)
committerGuy Harris <[email protected]>
Sun, 7 Feb 2010 22:52:07 +0000 (14:52 -0800)
Reviewed-By: Guy Harris <[email protected]>
CREDITS
icmp6.h
print-icmp6.c

diff --git a/CREDITS b/CREDITS
index a10e16e3dd877098ae9b0dc86e5df659de934ac7..8d287a736ea2d549eb0473b7bfaba5390cc42b54 100644 (file)
--- a/CREDITS
+++ b/CREDITS
@@ -45,6 +45,7 @@ Additional people who have contributed patches:
        Daniel Hagerty                  <hag at ai dot mit dot edu>
        Darren Reed                     <darrenr at reed dot wattle dot id dot au>
        David Binderman                 <d dot binderman at virgin dot net>
+       David Horn                      <dhorn2000 at gmail dot com>
        David Smith                     <dsmith at redhat dot com>
        David Young                     <dyoung at ojctech dot com>
        Don Ebright                     <Don dot Ebright at compuware dot com>
diff --git a/icmp6.h b/icmp6.h
index 5d272703fac0f4d8043a61375107859bc8379aef..168a70897f10bc22912e16c4a44d60cf3772b520 100644 (file)
--- a/icmp6.h
+++ b/icmp6.h
@@ -276,7 +276,7 @@ struct nd_opt_hdr {         /* Neighbor discovery option header */
 #define ND_OPT_ADVINTERVAL             7
 #define ND_OPT_HOMEAGENT_INFO          8
 #define ND_OPT_ROUTE_INFO              9       /* draft-ietf-ipngwg-router-preference, not officially assigned yet */
-
+#define ND_OPT_RDNSS                   25
 
 struct nd_opt_prefix_info {    /* prefix information */
        u_int8_t        nd_opt_pi_type;
@@ -308,6 +308,14 @@ struct nd_opt_mtu {                /* MTU option */
        u_int32_t       nd_opt_mtu_mtu;
 };
 
+struct nd_opt_rdnss {          /* RDNSS RFC 5006 */
+       u_int8_t        nd_opt_rdnss_type;
+       u_int8_t        nd_opt_rdnss_len;
+       u_int16_t       nd_opt_rdnss_reserved;
+       u_int32_t       nd_opt_rdnss_lifetime;
+       struct in6_addr nd_opt_rdnss_addr[1];   /* variable-length */
+};
+
 struct nd_opt_advinterval {    /* Advertisement interval option */
        u_int8_t        nd_opt_adv_type;
        u_int8_t        nd_opt_adv_len;
index f85660cabc43438fab1828beb974797a8b521dd1..fb6ec3f9114ea8b8e6a8ca9adb229effeb0d77ca 100644 (file)
@@ -135,6 +135,7 @@ static struct tok icmp6_opt_values[] = {
    { ND_OPT_PREFIX_INFORMATION, "prefix info"},
    { ND_OPT_REDIRECTED_HEADER, "redirected header"},
    { ND_OPT_MTU, "mtu"},
+   { ND_OPT_RDNSS, "rdnss"},
    { ND_OPT_ADVINTERVAL, "advertisement interval"},
    { ND_OPT_HOMEAGENT_INFO, "homeagent information"},
    { ND_OPT_ROUTE_INFO, "route info"},
@@ -686,12 +687,14 @@ icmp6_opt_print(const u_char *bp, int resid)
        const struct nd_opt_prefix_info *opp;
        const struct icmp6_opts_redirect *opr;
        const struct nd_opt_mtu *opm;
+       const struct nd_opt_rdnss *oprd;
        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;
        size_t l;
+       u_int i;
 
 #define ECHECK(var) if ((u_char *)&(var) > ep - sizeof(var)) return
 
@@ -750,6 +753,17 @@ icmp6_opt_print(const u_char *bp, int resid)
                                EXTRACT_32BITS(&opm->nd_opt_mtu_mtu),
                                (op->nd_opt_len != 1) ? "bad option length" : "" );
                         break;
+               case ND_OPT_RDNSS:
+                       oprd = (struct nd_opt_rdnss *)op;
+                       l = (op->nd_opt_len - 1) / 2;
+                       printf(" lifetime %us,", 
+                               EXTRACT_32BITS(&oprd->nd_opt_rdnss_lifetime)); 
+                       for (i = 0; i < l; i++) {
+                               TCHECK(oprd->nd_opt_rdnss_addr[i]);
+                               printf(" addr: %s", 
+                                   ip6addr_string(&oprd->nd_opt_rdnss_addr[i]));
+                       }
+                       break;
                case ND_OPT_ADVINTERVAL:
                        opa = (struct nd_opt_advinterval *)op;
                        TCHECK(opa->nd_opt_adv_interval);