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
This commit is contained in:
Ermal Luçi 2014-11-19 13:31:08 +00:00
parent b3a9e657c3
commit 7b56cc430a
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=274709

View File

@ -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, struct ifnet *ifp, int dir,
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);