Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/netbsd-3]: src/sys/dist/pf/net Pull up following revision(s) (requested ...



details:   https://anonhg.NetBSD.org/src/rev/71c5d5ee3b93
branches:  netbsd-3
changeset: 577847:71c5d5ee3b93
user:      tron <tron%NetBSD.org@localhost>
date:      Mon Feb 20 15:23:44 2006 +0000

description:
Pull up following revision(s) (requested by peter in ticket #1177):
        sys/dist/pf/net/pf.c: revision 1.21
Fix TCP/UDP checksum handling as pointed out by Daniel Hartmeier in:
http://mail-index.netbsd.org/tech-net/2006/01/21/0000.html.
Problem reported and patch tested by der Mouse & Nino Dehne (PR/32874).

diffstat:

 sys/dist/pf/net/pf.c |  15 +++++++--------
 1 files changed, 7 insertions(+), 8 deletions(-)

diffs (43 lines):

diff -r dca093cea328 -r 71c5d5ee3b93 sys/dist/pf/net/pf.c
--- a/sys/dist/pf/net/pf.c      Mon Feb 20 13:58:57 2006 +0000
+++ b/sys/dist/pf/net/pf.c      Mon Feb 20 15:23:44 2006 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: pf.c,v 1.12.4.3 2005/08/15 13:14:14 tron Exp $ */
+/*     $NetBSD: pf.c,v 1.12.4.4 2006/02/20 15:23:44 tron Exp $ */
 /*     $OpenBSD: pf.c,v 1.457.2.7 2005/01/06 14:11:56 brad Exp $ */
 
 /*
@@ -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) {
@@ -5197,6 +5194,8 @@
 #else
                ip->ip_sum = 0;
                ip->ip_sum = in_cksum(m0, ip->ip_hl << 2);
+
+               m0->m_pkthdr.csum_flags &= ~M_CSUM_IPv4;
 #endif
 #ifdef __OpenBSD__
                /* Update relevant hardware checksum stats for TCP/UDP */



Home | Main Index | Thread Index | Old Index