summaryrefslogtreecommitdiff
path: root/usr.sbin/tcpdump/extract.h
diff options
context:
space:
mode:
authorOtto Moerbeek <otto@cvs.openbsd.org>2004-02-02 09:43:28 +0000
committerOtto Moerbeek <otto@cvs.openbsd.org>2004-02-02 09:43:28 +0000
commitbeb20b29475cf9d4a3a6311a67ec1004408304fc (patch)
tree97ef010a6cb664154f922e4d544610c3fb59c3af /usr.sbin/tcpdump/extract.h
parent009bf16b1839115da8a6bc4bcf37470dc1d238eb (diff)
Do away with non-aligned memory accesses.
ok deraadt@ hshoexer@
Diffstat (limited to 'usr.sbin/tcpdump/extract.h')
-rw-r--r--usr.sbin/tcpdump/extract.h10
1 files changed, 2 insertions, 8 deletions
diff --git a/usr.sbin/tcpdump/extract.h b/usr.sbin/tcpdump/extract.h
index cecfb342759..4a8d9e8f8ac 100644
--- a/usr.sbin/tcpdump/extract.h
+++ b/usr.sbin/tcpdump/extract.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: extract.h,v 1.7 2002/09/03 12:21:12 ho Exp $ */
+/* $OpenBSD: extract.h,v 1.8 2004/02/02 09:43:27 otto Exp $ */
/*
* Copyright (c) 1992, 1993, 1994, 1995, 1996
@@ -25,21 +25,15 @@
/* Network to host order macros */
-#ifdef LBL_ALIGN
#define EXTRACT_16BITS(p) \
((u_int16_t)*((const u_int8_t *)(p) + 0) << 8 | \
(u_int16_t)*((const u_int8_t *)(p) + 1))
+
#define EXTRACT_32BITS(p) \
((u_int32_t)*((const u_int8_t *)(p) + 0) << 24 | \
(u_int32_t)*((const u_int8_t *)(p) + 1) << 16 | \
(u_int32_t)*((const u_int8_t *)(p) + 2) << 8 | \
(u_int32_t)*((const u_int8_t *)(p) + 3))
-#else
-#define EXTRACT_16BITS(p) \
- ((u_int16_t)ntohs(*(const u_int16_t *)(p)))
-#define EXTRACT_32BITS(p) \
- ((u_int32_t)ntohl(*(const u_int32_t *)(p)))
-#endif
#define EXTRACT_24BITS(p) \
((u_int32_t)*((const u_int8_t *)(p) + 0) << 16 | \