Module Name:    src
Committed By:   martin
Date:           Thu Nov 14 16:00:51 UTC 2019

Modified Files:
        src/sys/net [netbsd-8]: if_loop.c

Log Message:
Pull up the following revisions, requested by msaitoh in ticket #1438:

        sys/net/if_loop.c                       1.108-1.109 via patch

Fix a bug that an IP broadcast packet back to myself
is dropped as bad checksum when an interface's checksum
offload is set.


To generate a diff of this commit:
cvs rdiff -u -r1.94.6.4 -r1.94.6.5 src/sys/net/if_loop.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/net/if_loop.c
diff -u src/sys/net/if_loop.c:1.94.6.4 src/sys/net/if_loop.c:1.94.6.5
--- src/sys/net/if_loop.c:1.94.6.4	Tue Jan  2 10:20:33 2018
+++ src/sys/net/if_loop.c	Thu Nov 14 16:00:51 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_loop.c,v 1.94.6.4 2018/01/02 10:20:33 snj Exp $	*/
+/*	$NetBSD: if_loop.c,v 1.94.6.5 2019/11/14 16:00:51 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.94.6.4 2018/01/02 10:20:33 snj Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_loop.c,v 1.94.6.5 2019/11/14 16:00:51 martin Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_inet.h"
@@ -320,8 +320,13 @@ looutput(struct ifnet *ifp, struct mbuf 
 		KASSERT((csum_flags & ~(M_CSUM_IPv4|M_CSUM_UDPv4)) == 0);
 		if (csum_flags != 0 && IN_LOOPBACK_NEED_CHECKSUM(csum_flags)) {
 			ip_undefer_csum(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
@@ -332,8 +337,13 @@ looutput(struct ifnet *ifp, struct mbuf 
 		if (csum_flags != 0 &&
 		    IN6_LOOPBACK_NEED_CHECKSUM(csum_flags)) {
 			ip6_undefer_csum(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;

Reply via email to