Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/netbsd-9]: src/sys/net Pull up following revision(s) (requested by msait...
details: https://anonhg.NetBSD.org/src/rev/bd4604578f82
branches: netbsd-9
changeset: 461058:bd4604578f82
user: martin <martin%NetBSD.org@localhost>
date: Thu Nov 14 15:34:35 2019 +0000
description:
Pull up following revision(s) (requested by msaitoh in ticket #424):
sys/net/if_loop.c: revision 1.108
sys/net/if_loop.c: revision 1.109
Fix IP broadcast + checksum offload problem.
When a machine sends a IP broadcast packet to an Ethernet interface that the
checksum offload flags are set, the packet goes through ether_output() ->
looutput() and the offload flags is cleared without calculating the checksum.
And then, ip_input() calculate the packet's checksum because it's csum_flags is
zero. It regard as bad checksum and it's dropped because the packet's ifp
is s not lo0's. Fixes this bug by passing csum_flags as "calculated and good"
when IN_LOOPBACK_NEED_CHECKSUM() is false. Advised by ryo@.
This problem was seen when "routed -s" was used and the machine's interface's
offload flags were set. bad checksum field of "netstat -s" was increased every
30 seconds.
Fix comment.
diffstat:
sys/net/if_loop.c | 18 ++++++++++++++----
1 files changed, 14 insertions(+), 4 deletions(-)
diffs (48 lines):
diff -r a29fcb0ce342 -r bd4604578f82 sys/net/if_loop.c
--- a/sys/net/if_loop.c Thu Nov 14 15:32:32 2019 +0000
+++ b/sys/net/if_loop.c Thu Nov 14 15:34:35 2019 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: if_loop.c,v 1.107 2019/04/26 08:38:25 pgoyette Exp $ */
+/* $NetBSD: if_loop.c,v 1.107.2.1 2019/11/14 15:34:35 martin Exp $ */
/*
* Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project.
@@ -65,7 +65,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: if_loop.c,v 1.107 2019/04/26 08:38:25 pgoyette Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_loop.c,v 1.107.2.1 2019/11/14 15:34:35 martin Exp $");
#ifdef _KERNEL_OPT
#include "opt_inet.h"
@@ -321,8 +321,13 @@
KASSERT((csum_flags & ~(M_CSUM_IPv4|M_CSUM_UDPv4)) == 0);
if (csum_flags != 0 && IN_LOOPBACK_NEED_CHECKSUM(csum_flags)) {
in_undefer_cksum(m, 0, csum_flags);
+ m->m_pkthdr.csum_flags = 0;
+ } else {
+ /*
+ * Do nothing. Pass M_CSUM_IPv4 and M_CSUM_UDPv4 as
+ * they are to tell those are calculated and good.
+ */
}
- m->m_pkthdr.csum_flags = 0;
pktq = ip_pktq;
break;
#endif
@@ -333,8 +338,13 @@
if (csum_flags != 0 &&
IN6_LOOPBACK_NEED_CHECKSUM(csum_flags)) {
in6_undefer_cksum(m, 0, csum_flags);
+ m->m_pkthdr.csum_flags = 0;
+ } else {
+ /*
+ * Do nothing. Pass M_CSUM_UDPv6 as
+ * they are to tell those are calculated and good.
+ */
}
- m->m_pkthdr.csum_flags = 0;
m->m_flags |= M_LOOP;
pktq = ip6_pktq;
break;
Home |
Main Index |
Thread Index |
Old Index