From: David Horn Date: Sun, 7 Feb 2010 22:52:07 +0000 (-0800) Subject: RFC 5006 support. X-Git-Tag: tcpdump-4.1.0~23 X-Git-Url: https://git.tcpdump.org/tcpdump/commitdiff_plain/2a7e2246c7266f4c99922cc2970c207bb545cec5 RFC 5006 support. Reviewed-By: Guy Harris --- diff --git a/CREDITS b/CREDITS index a10e16e3..8d287a73 100644 --- a/CREDITS +++ b/CREDITS @@ -45,6 +45,7 @@ Additional people who have contributed patches: Daniel Hagerty Darren Reed David Binderman + David Horn David Smith David Young Don Ebright diff --git a/icmp6.h b/icmp6.h index 5d272703..168a7089 100644 --- 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; diff --git a/print-icmp6.c b/print-icmp6.c index f85660ca..fb6ec3f9 100644 --- a/print-icmp6.c +++ b/print-icmp6.c @@ -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);