X-Git-Url: https://git.tcpdump.org/tcpdump/blobdiff_plain/2055e39f2af0aba1ab3945ea8f3e82c614a691a3..1bcd37991fa57d9e966a6f96e7cbff59b16c28bd:/print-ip6.c?ds=inline diff --git a/print-ip6.c b/print-ip6.c index 15e13c2b..525a284e 100644 --- a/print-ip6.c +++ b/print-ip6.c @@ -44,7 +44,7 @@ * calculation. */ static void -ip6_finddst(netdissect_options *ndo, struct in6_addr *dst, +ip6_finddst(netdissect_options *ndo, nd_ipv6 *dst, const struct ip6_hdr *ip6) { const u_char *cp; @@ -77,7 +77,6 @@ ip6_finddst(netdissect_options *ndo, struct in6_addr *dst, * the header, in units of 8 octets, excluding * the first 8 octets. */ - ND_TCHECK_2(cp); advance = (GET_U_1(cp + 1) + 1) << 3; nh = GET_U_1(cp); break; @@ -88,7 +87,6 @@ ip6_finddst(netdissect_options *ndo, struct in6_addr *dst, * marked as reserved, and the header is always * the same size. */ - ND_TCHECK_1(cp); advance = sizeof(struct ip6_frag); nh = GET_U_1(cp); break; @@ -165,7 +163,7 @@ ip6_finddst(netdissect_options *ndo, struct in6_addr *dst, done: trunc: - UNALIGNED_MEMCPY(dst, dst_addr, sizeof(nd_ipv6)); + GET_CPY_BYTES(dst, dst_addr, sizeof(nd_ipv6)); } /* @@ -177,8 +175,8 @@ nextproto6_cksum(netdissect_options *ndo, u_int len, u_int covlen, uint8_t next_proto) { struct { - struct in6_addr ph_src; - struct in6_addr ph_dst; + nd_ipv6 ph_src; + nd_ipv6 ph_dst; uint32_t ph_len; uint8_t ph_zero[3]; uint8_t ph_nxt; @@ -188,7 +186,7 @@ nextproto6_cksum(netdissect_options *ndo, /* pseudo-header */ memset(&ph, 0, sizeof(ph)); - UNALIGNED_MEMCPY(&ph.ph_src, ip6->ip6_src, sizeof (struct in6_addr)); + GET_CPY_BYTES(&ph.ph_src, ip6->ip6_src, sizeof(nd_ipv6)); nh = GET_U_1(ip6->ip6_nxt); switch (nh) { @@ -207,8 +205,7 @@ nextproto6_cksum(netdissect_options *ndo, break; default: - UNALIGNED_MEMCPY(&ph.ph_dst, ip6->ip6_dst, - sizeof (struct in6_addr)); + GET_CPY_BYTES(&ph.ph_dst, ip6->ip6_dst, sizeof(nd_ipv6)); break; } ph.ph_len = htonl(len); @@ -334,8 +331,8 @@ ip6_print(netdissect_options *ndo, const u_char *bp, u_int length) if (cp == (const u_char *)(ip6 + 1) && nh != IPPROTO_TCP && nh != IPPROTO_UDP && nh != IPPROTO_DCCP && nh != IPPROTO_SCTP) { - ND_PRINT("%s > %s: ", ip6addr_string(ndo, ip6->ip6_src), - ip6addr_string(ndo, ip6->ip6_dst)); + ND_PRINT("%s > %s: ", GET_IP6ADDR_STRING(ip6->ip6_src), + GET_IP6ADDR_STRING(ip6->ip6_dst)); } switch (nh) { @@ -377,7 +374,7 @@ ip6_print(netdissect_options *ndo, const u_char *bp, u_int length) * XXX - we don't use "advance"; RFC 3775 says that * the next header field in a mobility header * should be IPPROTO_NONE, but speaks of - * the possiblity of a future extension in + * the possibility of a future extension in * which payload can be piggybacked atop a * mobility header. */ @@ -469,8 +466,8 @@ ip6_print(netdissect_options *ndo, const u_char *bp, u_int length) len -= total_advance; } } - ip_print_demux(ndo, cp, len, 6, fragmented, - GET_U_1(ip6->ip6_hlim), nh, bp); + ip_demux_print(ndo, cp, len, 6, fragmented, + GET_U_1(ip6->ip6_hlim), nh, bp); nd_pop_packet_info(ndo); return; }