X-Git-Url: https://git.tcpdump.org/tcpdump/blobdiff_plain/b050a1e4e0d2116136f101e57b6d0e9e25ae7c70..refs/heads/tcpdump-4.1:/print-icmp6.c diff --git a/print-icmp6.c b/print-icmp6.c index f85660ca..24765381 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"}, @@ -349,14 +350,13 @@ icmp6_print(netdissect_options *ndo, printf("ICMP6, %s", tok2str(icmp6_type_values,"unknown icmp6 type (%u)",dp->icmp6_type)); /* display cosmetics: print the packet length for printer that use the vflag now */ - if (vflag && (dp->icmp6_type == - ND_ROUTER_SOLICIT || - ND_ROUTER_ADVERT || - ND_NEIGHBOR_ADVERT || - ND_NEIGHBOR_SOLICIT || - ND_REDIRECT || - ICMP6_HADISCOV_REPLY || - ICMP6_MOBILEPREFIX_ADVERT )) + if (vflag && (dp->icmp6_type == ND_ROUTER_SOLICIT || + dp->icmp6_type == ND_ROUTER_ADVERT || + dp->icmp6_type == ND_NEIGHBOR_ADVERT || + dp->icmp6_type == ND_NEIGHBOR_SOLICIT || + dp->icmp6_type == ND_REDIRECT || + dp->icmp6_type == ICMP6_HADISCOV_REPLY || + dp->icmp6_type == ICMP6_MOBILEPREFIX_ADVERT )) printf(", length %u", length); switch (dp->icmp6_type) { @@ -686,12 +686,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 +752,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); @@ -839,7 +852,7 @@ mldv2_report_print(const u_char *bp, u_int len) } TCHECK(icp->icmp6_data16[1]); - ngroups = ntohs(icp->icmp6_data16[1]); + ngroups = EXTRACT_16BITS(&icp->icmp6_data16[1]); printf(", %d group record(s)", ngroups); if (vflag > 0) { /* Print the group records */ @@ -898,7 +911,7 @@ mldv2_query_print(const u_char *bp, u_int len) return; } TCHECK(icp->icmp6_data16[0]); - mrc = ntohs(icp->icmp6_data16[0]); + mrc = EXTRACT_16BITS(&icp->icmp6_data16[0]); if (mrc < 32768) { mrt = mrc; } else { @@ -927,7 +940,7 @@ mldv2_query_print(const u_char *bp, u_int len) } TCHECK2(bp[26], 2); - nsrcs = ntohs(*(u_short *)&bp[26]); + nsrcs = EXTRACT_16BITS(&bp[26]); if (nsrcs > 0) { if (len < 28 + nsrcs * sizeof(struct in6_addr)) printf(" [invalid number of sources]");