summaryrefslogtreecommitdiffstats
path: root/sys
diff options
context:
space:
mode:
authorderaadt <deraadt@openbsd.org>1998-12-31 11:50:13 +0000
committerderaadt <deraadt@openbsd.org>1998-12-31 11:50:13 +0000
commit48b50c739b046d317bae9f10349c99185fb8d5ea (patch)
tree67fb33b4e470ee130064620b2a4ac64df47ff5a9 /sys
parentmangle uh_sum as before, but recover it for icmp errors (diff)
downloadwireguard-openbsd-48b50c739b046d317bae9f10349c99185fb8d5ea.tar.xz
wireguard-openbsd-48b50c739b046d317bae9f10349c99185fb8d5ea.zip
icmp_error() is now getting packets which are completely in network byte order
Diffstat (limited to 'sys')
-rw-r--r--sys/netinet/ip_icmp.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/sys/netinet/ip_icmp.c b/sys/netinet/ip_icmp.c
index e77c5e694d2..41cb32c7134 100644
--- a/sys/netinet/ip_icmp.c
+++ b/sys/netinet/ip_icmp.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: ip_icmp.c,v 1.10 1998/05/27 20:28:35 deraadt Exp $ */
+/* $OpenBSD: ip_icmp.c,v 1.11 1998/12/31 11:50:13 deraadt Exp $ */
/* $NetBSD: ip_icmp.c,v 1.19 1996/02/13 23:42:22 christos Exp $ */
/*
@@ -104,7 +104,7 @@ icmp_error(n, type, code, dest, destifp)
* Don't error if the old packet protocol was ICMP
* error message, only known informational types.
*/
- if (oip->ip_off &~ (IP_MF|IP_DF))
+ if (ntohs(oip->ip_off) &~ (IP_MF|IP_DF))
goto freeit;
if (oip->ip_p == IPPROTO_ICMP && type != ICMP_REDIRECT &&
n->m_len >= oiplen + ICMP_MINLEN &&
@@ -121,7 +121,7 @@ icmp_error(n, type, code, dest, destifp)
m = m_gethdr(M_DONTWAIT, MT_HEADER);
if (m == NULL)
goto freeit;
- icmplen = oiplen + min(8,oip->ip_len);
+ icmplen = oiplen + min(8, ntohs(oip->ip_len));
m->m_len = icmplen + ICMP_MINLEN;
MH_ALIGN(m, m->m_len);
icp = mtod(m, struct icmp *);