summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorhenning <henning@openbsd.org>2013-11-26 11:27:41 +0000
committerhenning <henning@openbsd.org>2013-11-26 11:27:41 +0000
commiteaf8732fff5b96f73355cea45e17fa5f434f8238 (patch)
treeefe4a806278dc87ad9e03aed525dffbd86ba9196
parentRemove unused var and include. Fix errno values as per spec. (diff)
downloadwireguard-openbsd-eaf8732fff5b96f73355cea45e17fa5f434f8238.tar.xz
wireguard-openbsd-eaf8732fff5b96f73355cea45e17fa5f434f8238.zip
instead of calculating the icmp checksum here, just set the flag that
it is needed and the lower parts of the stack will take care of it. fixes a cksum bug in a rather constructed case and is just the right thing to do now. ok mpi naddy
-rw-r--r--sys/netinet/ip_icmp.c7
1 files changed, 3 insertions, 4 deletions
diff --git a/sys/netinet/ip_icmp.c b/sys/netinet/ip_icmp.c
index 5ea912e2f31..b8da8bb582e 100644
--- a/sys/netinet/ip_icmp.c
+++ b/sys/netinet/ip_icmp.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: ip_icmp.c,v 1.110 2013/11/17 10:07:32 bluhm Exp $ */
+/* $OpenBSD: ip_icmp.c,v 1.111 2013/11/26 11:27:41 henning Exp $ */
/* $NetBSD: ip_icmp.c,v 1.19 1996/02/13 23:42:22 christos Exp $ */
/*
@@ -817,8 +817,7 @@ icmp_reflect(struct mbuf *m, struct mbuf **op, struct in_ifaddr *ia)
}
/*
- * Send an icmp packet back to the ip level,
- * after supplying a checksum.
+ * Send an icmp packet back to the ip level
*/
void
icmp_send(struct mbuf *m, struct mbuf *opts)
@@ -830,7 +829,7 @@ icmp_send(struct mbuf *m, struct mbuf *opts)
hlen = ip->ip_hl << 2;
icp = (struct icmp *)(mtod(m, caddr_t) + hlen);
icp->icmp_cksum = 0;
- icp->icmp_cksum = in4_cksum(m, 0, hlen, ntohs(ip->ip_len) - hlen);
+ m->m_pkthdr.csum_flags |= M_ICMP_CSUM_OUT;
#ifdef ICMPPRINTFS
if (icmpprintfs) {
char dst[INET_ADDRSTRLEN], src[INET_ADDRSTRLEN];