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.
This commit is contained in:
parent
18346d7d6a
commit
7108b34561
|
@ -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 @@ looutput(struct ifnet *ifp, struct mbuf *m, const struct sockaddr *dst,
|
|||
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 @@ looutput(struct ifnet *ifp, struct mbuf *m, const struct sockaddr *dst,
|
|||
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;
|
||||
|
|
Loading…
Reference in New Issue