diff options
author | tuexen <tuexen@FreeBSD.org> | 2014-06-22 16:54:59 +0000 |
---|---|---|
committer | tuexen <tuexen@FreeBSD.org> | 2014-06-22 16:54:59 +0000 |
commit | 43d8b12efcd89c1249b5e44b1362968516997171 (patch) | |
tree | aac9df5a916f395746125f85e386dcafe6434c99 /sys/netinet/ip_output.c | |
parent | e27908d03e2c34a53b14ec2c732dbbc3cfd449f9 (diff) | |
download | FreeBSD-src-43d8b12efcd89c1249b5e44b1362968516997171.zip FreeBSD-src-43d8b12efcd89c1249b5e44b1362968516997171.tar.gz |
MFC r265691:
For some UDP packets (for example with 200 byte payload) and IP options,
the IP header and the UDP header are not in the same mbuf.
Add code to in_delayed_cksum() to deal with this case.
MFC r265713:
Use KASSERTs as suggested by glebius@
Diffstat (limited to 'sys/netinet/ip_output.c')
-rw-r--r-- | sys/netinet/ip_output.c | 16 |
1 files changed, 6 insertions, 10 deletions
diff --git a/sys/netinet/ip_output.c b/sys/netinet/ip_output.c index 69832d4..c0a6ffd 100644 --- a/sys/netinet/ip_output.c +++ b/sys/netinet/ip_output.c @@ -864,17 +864,13 @@ in_delayed_cksum(struct mbuf *m) csum = 0xffff; offset += m->m_pkthdr.csum_data; /* checksum offset */ - if (offset + sizeof(u_short) > m->m_len) { - printf("delayed m_pullup, m->len: %d off: %d p: %d\n", - m->m_len, offset, ip->ip_p); - /* - * XXX - * this shouldn't happen, but if it does, the - * correct behavior may be to insert the checksum - * in the appropriate next mbuf in the chain. - */ - return; + /* find the mbuf in the chain where the checksum starts*/ + while ((m != NULL) && (offset >= m->m_len)) { + offset -= m->m_len; + m = m->m_next; } + KASSERT(m != NULL, ("in_delayed_cksum: checksum outside mbuf chain.")); + KASSERT(offset + sizeof(u_short) <= m->m_len, ("in_delayed_cksum: checksum split between mbufs.")); *(u_short *)(m->m_data + offset) = csum; } |