summaryrefslogtreecommitdiffstats
path: root/usr.sbin/tcpdump/extract.h
diff options
context:
space:
mode:
authorotto <otto@openbsd.org>2004-02-02 09:43:27 +0000
committerotto <otto@openbsd.org>2004-02-02 09:43:27 +0000
commite4c9ae7d9708d67a071eca958028feacf09ee5c4 (patch)
tree2a4aa5ab5fab16238b372258de61815a8f52cb24 /usr.sbin/tcpdump/extract.h
parentDon't set alarms in the past + cleanup from NetBSD (minus the bugs there). (diff)
downloadwireguard-openbsd-e4c9ae7d9708d67a071eca958028feacf09ee5c4.tar.xz
wireguard-openbsd-e4c9ae7d9708d67a071eca958028feacf09ee5c4.zip
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 | \