summaryrefslogtreecommitdiffstats
path: root/sys/netpfil
diff options
context:
space:
mode:
authorkp <kp@FreeBSD.org>2015-10-29 20:45:53 +0000
committerkp <kp@FreeBSD.org>2015-10-29 20:45:53 +0000
commit0c3b0b48ba224bb9df3de711df89feb56b1c7e42 (patch)
treefd348df80f0991230f3fbb88c94098e6da9943e6 /sys/netpfil
parentdb507b23f5ff9c41e1bba097b8d196ec60756215 (diff)
downloadFreeBSD-src-0c3b0b48ba224bb9df3de711df89feb56b1c7e42.zip
FreeBSD-src-0c3b0b48ba224bb9df3de711df89feb56b1c7e42.tar.gz
pf: Fix IPv6 checksums with route-to.
When using route-to (or reply-to) pf sends the packet directly to the output interface. If that interface doesn't support checksum offloading the checksum has to be calculated in software. That was already done in the IPv4 case, but not for the IPv6 case. As a result we'd emit packets with pseudo-header checksums (i.e. incorrect checksums). This issue was exposed by the changes in r289316 when pf stopped performing full checksum calculations for all packets. Submitted by: Luoqi Chen MFC after: 1 week
Diffstat (limited to 'sys/netpfil')
-rw-r--r--sys/netpfil/pf/pf.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/sys/netpfil/pf/pf.c b/sys/netpfil/pf/pf.c
index 792782b..1dfc37d 100644
--- a/sys/netpfil/pf/pf.c
+++ b/sys/netpfil/pf/pf.c
@@ -5574,6 +5574,13 @@ pf_route6(struct mbuf **m, struct pf_rule *r, int dir, struct ifnet *oifp,
if (ifp->if_flags & IFF_LOOPBACK)
m0->m_flags |= M_SKIP_FIREWALL;
+ if (m0->m_pkthdr.csum_flags & CSUM_DELAY_DATA_IPV6 &
+ ~ifp->if_hwassist) {
+ uint32_t plen = m0->m_pkthdr.len - sizeof(*ip6);
+ in6_delayed_cksum(m0, plen, sizeof(struct ip6_hdr));
+ m0->m_pkthdr.csum_flags &= ~CSUM_DELAY_DATA_IPV6;
+ }
+
/*
* If the packet is too large for the outgoing interface,
* send back an icmp6 error.
OpenPOWER on IntegriCloud