summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorpefo <pefo@openbsd.org>2005-02-22 08:09:23 +0000
committerpefo <pefo@openbsd.org>2005-02-22 08:09:23 +0000
commit5c3b78e7d7b70f701013fe061d8508f68f9090fe (patch)
tree56c7cf60b9fd32d58081b7753ca0abe6fc50324b
parent- refer to netstat output more precisely (diff)
downloadwireguard-openbsd-5c3b78e7d7b70f701013fe061d8508f68f9090fe.tar.xz
wireguard-openbsd-5c3b78e7d7b70f701013fe061d8508f68f9090fe.zip
Fix a bug causing arches not able to load unaligned to crash in ip input.
m_pullup must be done with a size >= ip header and m_adj must be called after the pullup so pullup does not kill the header alignment. Makes mips64, alpha, sparc64 and possibly others happy. ok from martin, brad and a bunch of others who tested.
-rw-r--r--sys/dev/ic/rtl81x9.c11
1 files changed, 6 insertions, 5 deletions
diff --git a/sys/dev/ic/rtl81x9.c b/sys/dev/ic/rtl81x9.c
index 9848001f404..7156ef0004c 100644
--- a/sys/dev/ic/rtl81x9.c
+++ b/sys/dev/ic/rtl81x9.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: rtl81x9.c,v 1.37 2005/02/20 00:41:36 brad Exp $ */
+/* $OpenBSD: rtl81x9.c,v 1.38 2005/02/22 08:09:23 pefo Exp $ */
/*
* Copyright (c) 1997, 1998
@@ -680,12 +680,13 @@ rl_rxeof(sc)
if (m == NULL)
ifp->if_ierrors++;
else {
- m_adj(m, ETHER_ALIGN);
- m_copyback(m, wrap, total_len - wrap,
- sc->rl_cdata.rl_rx_buf);
- m = m_pullup(m, sizeof(struct ether_header));
+ m_copyback(m, wrap + ETHER_ALIGN,
+ total_len - wrap, sc->rl_cdata.rl_rx_buf);
+ m = m_pullup(m, sizeof(struct ip) +ETHER_ALIGN);
if (m == NULL)
ifp->if_ierrors++;
+ else
+ m_adj(m, ETHER_ALIGN);
}
cur_rx = (total_len - wrap + ETHER_CRC_LEN);
} else {