Source-Changes-HG archive

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

[src/trunk]: src/sys/netinet fix cksum error of udp and tcp packet with ip op...



details:   https://anonhg.NetBSD.org/src/rev/982287f6e059
branches:  trunk
changeset: 513748:982287f6e059
user:      yamt <yamt%NetBSD.org@localhost>
date:      Sat Aug 11 12:26:50 2001 +0000

description:
fix cksum error of udp and tcp packet with ip options

diffstat:

 sys/netinet/ip_output.c |  10 ++++++----
 1 files changed, 6 insertions(+), 4 deletions(-)

diffs (42 lines):

diff -r 9049aa3978b6 -r 982287f6e059 sys/netinet/ip_output.c
--- a/sys/netinet/ip_output.c   Sat Aug 11 11:57:35 2001 +0000
+++ b/sys/netinet/ip_output.c   Sat Aug 11 12:26:50 2001 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: ip_output.c,v 1.86 2001/06/02 16:17:10 thorpej Exp $   */
+/*     $NetBSD: ip_output.c,v 1.87 2001/08/11 12:26:50 yamt Exp $      */
 
 /*
  * Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project.
@@ -792,9 +792,10 @@
        offset += m->m_pkthdr.csum_data;        /* checksum offset */
 
        if ((offset + sizeof(u_int16_t)) > m->m_len) {
-               /* XXX This should basically never happen. */
+               /* This happen when ip options were inserted
                printf("in_delayed_cksum: pullup len %d off %d proto %d\n",
                    m->m_len, offset, ip->ip_p);
+                */
                m_copyback(m, offset, sizeof(csum), (caddr_t) &csum);
        } else
                *(u_int16_t *)(mtod(m, caddr_t) + offset) = csum;
@@ -843,7 +844,8 @@
                MGETHDR(n, M_DONTWAIT, MT_HEADER);
                if (n == 0)
                        return (m);
-               n->m_pkthdr.len = m->m_pkthdr.len + optlen;
+               M_COPY_PKTHDR(n, m);
+               m->m_flags &= ~M_PKTHDR;
                m->m_len -= sizeof(struct ip);
                m->m_data += sizeof(struct ip);
                n->m_next = m;
@@ -854,9 +856,9 @@
        } else {
                m->m_data -= optlen;
                m->m_len += optlen;
-               m->m_pkthdr.len += optlen;
                memmove(mtod(m, caddr_t), ip, sizeof(struct ip));
        }
+       m->m_pkthdr.len += optlen;
        ip = mtod(m, struct ip *);
        bcopy((caddr_t)p->ipopt_list, (caddr_t)(ip + 1), (unsigned)optlen);
        *phlen = sizeof(struct ip) + optlen;



Home | Main Index | Thread Index | Old Index