Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 19 Nov 2014 13:31:09 +0000 (UTC)
From:      Ermal Luçi <eri@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r274709 - head/sys/netpfil/pf
Message-ID:  <201411191331.sAJDV9bH092190@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: eri
Date: Wed Nov 19 13:31:08 2014
New Revision: 274709
URL: https://svnweb.freebsd.org/changeset/base/274709

Log:
  pf(4) needs to have a correct checksum during its processing.
  Calculate checksums for the IPv6 path when needed before
  delving into pf(4) code as required.
  
  PR:     172648, 179392
  Reviewed by:    glebius@
  Approved by:    gnn@
  Obtained from:  pfSense
  MFC after:      1 week
  Sponsored by:   Netgate

Modified:
  head/sys/netpfil/pf/pf_ioctl.c

Modified: head/sys/netpfil/pf/pf_ioctl.c
==============================================================================
--- head/sys/netpfil/pf/pf_ioctl.c	Wed Nov 19 13:04:25 2014	(r274708)
+++ head/sys/netpfil/pf/pf_ioctl.c	Wed Nov 19 13:31:08 2014	(r274709)
@@ -76,6 +76,7 @@ __FBSDID("$FreeBSD$");
 #include <netinet/in.h>
 #include <netinet/ip.h>
 #include <netinet/ip_var.h>
+#include <netinet6/ip6_var.h>
 #include <netinet/ip_icmp.h>
 
 #ifdef INET6
@@ -3619,12 +3620,11 @@ pf_check6_out(void *arg, struct mbuf **m
 	int chk;
 
 	/* We need a proper CSUM before we start (s. OpenBSD ip_output) */
-	if ((*m)->m_pkthdr.csum_flags & CSUM_DELAY_DATA) {
-#ifdef INET
-		/* XXX-BZ copy&paste error from r126261? */
-		in_delayed_cksum(*m);
-#endif
-		(*m)->m_pkthdr.csum_flags &= ~CSUM_DELAY_DATA;
+	if ((*m)->m_pkthdr.csum_flags & CSUM_DELAY_DATA_IPV6) {
+		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);



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201411191331.sAJDV9bH092190>