svn commit: r274709 - head/sys/netpfil/pf

Dag-Erling Smørgrav des at des.no
Tue Nov 25 11:38:37 UTC 2014


Here's a patch that doesn't crash and tries not to break TSO.

Index: sys/netpfil/pf/pf_ioctl.c
===================================================================
--- sys/netpfil/pf/pf_ioctl.c	(revision 274791)
+++ sys/netpfil/pf/pf_ioctl.c	(working copy)
@@ -3576,9 +3576,10 @@
 	int chk;
 
 	/* We need a proper CSUM befor we start (s. OpenBSD ip_output) */
-	if ((*m)->m_pkthdr.csum_flags & CSUM_DELAY_DATA) {
+	if ((*m)->m_pkthdr.csum_flags &
+	    ((CSUM_DELAY_IP|CSUM_DELAY_DATA) & ~ifp->if_hwassist)) {
 		in_delayed_cksum(*m);
-		(*m)->m_pkthdr.csum_flags &= ~CSUM_DELAY_DATA;
+		(*m)->m_pkthdr.csum_flags &= ~(CSUM_DELAY_IP|CSUM_DELAY_DATA);
 	}
 
 	chk = pf_test(PF_OUT, ifp, m, inp);
@@ -3620,12 +3621,14 @@
 	int chk;
 
 	/* We need a proper CSUM before we start (s. OpenBSD ip_output) */
-	if ((*m)->m_pkthdr.csum_flags & CSUM_DELAY_DATA_IPV6) {
+	if ((*m)->m_pkthdr.csum_flags &
+	    (CSUM_DELAY_DATA_IPV6 & ~ifp->if_hwassist)) {
 		in6_delayed_cksum(*m,
 		    (*m)->m_pkthdr.len - sizeof(struct ip6_hdr),
 		    sizeof(struct ip6_hdr));
 		(*m)->m_pkthdr.csum_flags &= ~CSUM_DELAY_DATA_IPV6;
 	}
+
 	CURVNET_SET(ifp->if_vnet);
 	chk = pf_test6(PF_OUT, ifp, m, inp);
 	CURVNET_RESTORE();

DES
-- 
Dag-Erling Smørgrav - des at des.no


More information about the svn-src-head mailing list