Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys Fix in_undefer_cksum() and in6_undefer_cksum().
details: https://anonhg.NetBSD.org/src/rev/543f5cbc641c
branches: trunk
changeset: 433529:543f5cbc641c
user: rin <rin%NetBSD.org@localhost>
date: Wed Sep 19 07:54:11 2018 +0000
description:
Fix in_undefer_cksum() and in6_undefer_cksum().
The 4th argument for in[46]_cksum() should be length of L4 header +
L4 payload. The previous revisions are wrong
- for IPv4 when hdrlen != 0
- for IPv6 always
These functions are used only in net/if_loop.c and
arch/powerpc/booke/dev/pq3etsec.c under some special circumferences.
This should be why the bugs have not been found until today.
OK maxv
diffstat:
sys/netinet/in_offload.c | 6 +++---
sys/netinet6/in6_offload.c | 7 ++++---
2 files changed, 7 insertions(+), 6 deletions(-)
diffs (55 lines):
diff -r 884054c37ed1 -r 543f5cbc641c sys/netinet/in_offload.c
--- a/sys/netinet/in_offload.c Wed Sep 19 07:51:23 2018 +0000
+++ b/sys/netinet/in_offload.c Wed Sep 19 07:54:11 2018 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: in_offload.c,v 1.11 2018/07/11 06:25:05 maxv Exp $ */
+/* $NetBSD: in_offload.c,v 1.12 2018/09/19 07:54:11 rin Exp $ */
/*
* Copyright (c)2005, 2006 YAMAMOTO Takashi,
@@ -27,7 +27,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: in_offload.c,v 1.11 2018/07/11 06:25:05 maxv Exp $");
+__KERNEL_RCSID(0, "$NetBSD: in_offload.c,v 1.12 2018/09/19 07:54:11 rin Exp $");
#include <sys/param.h>
#include <sys/mbuf.h>
@@ -213,7 +213,7 @@
if (csum_flags & (M_CSUM_UDPv4|M_CSUM_TCPv4)) {
size_t l4offset = hdrlen + iphdrlen;
- csum = in4_cksum(m, 0, l4offset, ip_len - l4offset - hdrlen);
+ csum = in4_cksum(m, 0, l4offset, ip_len - iphdrlen);
if (csum == 0 && (csum_flags & M_CSUM_UDPv4) != 0)
csum = 0xffff;
diff -r 884054c37ed1 -r 543f5cbc641c sys/netinet6/in6_offload.c
--- a/sys/netinet6/in6_offload.c Wed Sep 19 07:51:23 2018 +0000
+++ b/sys/netinet6/in6_offload.c Wed Sep 19 07:54:11 2018 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: in6_offload.c,v 1.10 2018/08/10 06:55:04 maxv Exp $ */
+/* $NetBSD: in6_offload.c,v 1.11 2018/09/19 07:54:11 rin Exp $ */
/*
* Copyright (c)2006 YAMAMOTO Takashi,
@@ -27,7 +27,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: in6_offload.c,v 1.10 2018/08/10 06:55:04 maxv Exp $");
+__KERNEL_RCSID(0, "$NetBSD: in6_offload.c,v 1.11 2018/09/19 07:54:11 rin Exp $");
#include <sys/param.h>
#include <sys/mbuf.h>
@@ -193,7 +193,8 @@
l4hdroff = M_CSUM_DATA_IPv6_IPHL(m->m_pkthdr.csum_data);
l4offset = hdrlen + l4hdroff;
- csum = in6_cksum(m, 0, l4offset, plen - l4hdroff);
+ csum = in6_cksum(m, 0, l4offset,
+ plen - (l4hdroff - sizeof(struct ip6_hdr)));
if (csum == 0 && (csum_flags & M_CSUM_UDPv6) != 0)
csum = 0xffff;
Home |
Main Index |
Thread Index |
Old Index