Re: mbuf_outbound_finalize() reports packet length is less than mbuf length
Re: mbuf_outbound_finalize() reports packet length is less than mbuf length
- Subject: Re: mbuf_outbound_finalize() reports packet length is less than mbuf length
- From: Andrew Gallatin <email@hidden>
- Date: Mon, 27 Jul 2009 15:52:42 -0400
Brendan Creane wrote:
The exact message from in_delayed_cksum_offset() is:
"in_delayed_cksum_offset: ip_len 49408 (193) doesn't match actual length 207"
In this case, protocol=AF_INET, ifnet_hdrlen(interface)=14, so I'm calling:
mbuf_outbound_finalize(mbuf=0x1d0cf000, 2, 14);
From gdb, mbuf_walk on 0x1d0cf000 displays:
(gdb) mbuf_walk 0x1d0cf000
1: 0x1d0cf000 [len 14, type 1, total 14]
2: 0x1d0d0100 [len 193, type 1, total 207]
I could be wrong, but I think the kernel code is actually broken for
this case.
The problem is that that ip_offset is decremented by the length
of the first mbuf in the chain (14 bytes), so it is 0 when
this test is done:
if (ip_len != (m0->m_pkthdr.len - ip_offset))
That boils down to:
if (193 != (207 - 0))
I think the check really wants to compare the ip_len with the
original value of ip_offset.
You could probably work around it by doing a pullup
on the chain to get the IP header into the first
mbuf.
Drew
--- netinet/ip_output.c 2008-12-11 15:47:09.000000000 -0500
+++ netinet/ip_output.c.fixed 2009-07-27 15:52:01.321555890 -0400
@@ -1556,6 +1556,7 @@
unsigned char buf[sizeof(struct ip)];
u_short csum, offset, ip_len;
struct mbuf *m = m0;
+ int ip_offset_saved = ip_offset;
while (ip_offset >= m->m_len) {
ip_offset -= m->m_len;
@@ -1597,12 +1598,12 @@
* is bogus and we give up.
*/
ip_len = ip->ip_len;
- if (ip_len != (m0->m_pkthdr.len - ip_offset)) {
+ if (ip_len != (m0->m_pkthdr.len - ip_offset_saved)) {
ip_len = SWAP16(ip_len);
- if (ip_len != (m0->m_pkthdr.len - ip_offset)) {
+ if (ip_len != (m0->m_pkthdr.len - ip_offset_saved)) {
printf("in_delayed_cksum_offset: ip_len %d (%d) "
"doesn't match actual length %d\n", ip->ip_len,
- ip_len, (m0->m_pkthdr.len - ip_offset));
+ ip_len, (m0->m_pkthdr.len - ip_offset_saved));
return;
}
}
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Darwin-kernel mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden