--- dist/pf/net/pf.orig.c 2007-09-22 17:43:14.000000000 +0300 +++ dist/pf/net/pf.c 2007-09-22 17:50:31.000000000 +0300 @@ -5057,9 +5057,6 @@ struct pf_addr naddr; struct pf_src_node *sn = NULL; int error = 0; -#ifdef __NetBSD__ - struct tcphdr th; -#endif if (m == NULL || *m == NULL || r == NULL || (dir != PF_IN && dir != PF_OUT) || oifp == NULL) @@ -5178,10 +5175,10 @@ } } #else - m_copydata(m0, sizeof(*ip), sizeof(th), &th); - th.th_sum = 0; - m_copyback(m0, sizeof(*ip), sizeof(th), &th); - in4_cksum(m0, IPPROTO_TCP, sizeof(*ip), m0->m_pkthdr.len - sizeof(*ip)); + if (m0->m_pkthdr.csum_flags & (M_CSUM_TCPv4|M_CSUM_UDPv4)) { + in_delayed_cksum(m0); + m0->m_pkthdr.csum_flags &= ~(M_CSUM_TCPv4|M_CSUM_UDPv4); + } #endif if (ntohs(ip->ip_len) <= ifp->if_mtu) {