X-Git-Url: https://git.tcpdump.org/tcpdump/blobdiff_plain/acbfc682d6c3ced52b76062d37d5d6a08caa8e78..b347189ca62c553b60c53c3b6978ebd354c1c88b:/print-ip.c diff --git a/print-ip.c b/print-ip.c index 1e9f1ed9..4f916bc6 100644 --- a/print-ip.c +++ b/print-ip.c @@ -98,7 +98,6 @@ ip_finddst(netdissect_options *ndo, int length; int len; const u_char *cp; - uint32_t retval; cp = (const u_char *)(ip + 1); length = (IP_HL(ip) << 2) - sizeof(struct ip); @@ -125,13 +124,11 @@ ip_finddst(netdissect_options *ndo, case IPOPT_LSRR: if (len < 7) break; - UNALIGNED_MEMCPY(&retval, cp + len - 4, 4); - return retval; + return (EXTRACT_IPV4_TO_NETWORK_ORDER(cp + len - 4)); } } trunc: - UNALIGNED_MEMCPY(&retval, &ip->ip_dst, sizeof(uint32_t)); - return retval; + return (EXTRACT_IPV4_TO_NETWORK_ORDER(ip->ip_dst)); } /* @@ -155,9 +152,9 @@ nextproto4_cksum(netdissect_options *ndo, ph.len = htons((uint16_t)len); ph.mbz = 0; ph.proto = next_proto; - UNALIGNED_MEMCPY(&ph.src, &ip->ip_src, sizeof(uint32_t)); + ph.src = EXTRACT_IPV4_TO_NETWORK_ORDER(ip->ip_src); if (IP_HL(ip) == 5) - UNALIGNED_MEMCPY(&ph.dst, &ip->ip_dst, sizeof(uint32_t)); + ph.dst = EXTRACT_IPV4_TO_NETWORK_ORDER(ip->ip_dst); else ph.dst = ip_finddst(ndo, ip);