Subject: delayed checksumming and source routing
To: None <tech-net@netbsd.org>
From: YAMAMOTO Takashi <yamt@mwd.biglobe.ne.jp>
List: tech-net
Date: 08/10/2001 14:08:15
hi.
source routing is broken after delayed-cksumming has come.
patch to fix it is attached.
is it ok to commit?
---
YAMAMOTO Takashi<yamt@mwd.biglobe.ne.jp>
Index: ip_output.c
===================================================================
RCS file: /cvs/cvsroot/syssrc/sys/netinet/ip_output.c,v
retrieving revision 1.86
diff -u -r1.86 ip_output.c
--- ip_output.c 2001/06/02 16:17:10 1.86
+++ ip_output.c 2001/08/10 04:53:09
@@ -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,7 @@
MGETHDR(n, M_DONTWAIT, MT_HEADER);
if (n == 0)
return (m);
- n->m_pkthdr.len = m->m_pkthdr.len + optlen;
+ n->m_pkthdr = m->m_pkthdr;
m->m_len -= sizeof(struct ip);
m->m_data += sizeof(struct ip);
n->m_next = m;
@@ -854,9 +855,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;