diff options
author | ru <ru@FreeBSD.org> | 2004-04-07 10:01:39 +0000 |
---|---|---|
committer | ru <ru@FreeBSD.org> | 2004-04-07 10:01:39 +0000 |
commit | a6980b04fc41a4c6dc314dc3aa00de7e7834ba7b (patch) | |
tree | edee866751b92a668599d9d82ffb9b264a82d38f /sys | |
parent | 1c584f59a55cb440f0487854db33b28a08898f82 (diff) | |
download | FreeBSD-src-a6980b04fc41a4c6dc314dc3aa00de7e7834ba7b.zip FreeBSD-src-a6980b04fc41a4c6dc314dc3aa00de7e7834ba7b.tar.gz |
Fixed a bug in previous revision: compute the payload checksum before
we convert ip_len into a network byte order; in_delayed_cksum() still
expects it in host byte order.
The symtom was the ``in_cksum_skip: out of data by %d'' complaints
from the kernel.
To add to the previous commit log. These fixes make tcpdump(1) happy
by not complaining about UDP/TCP checksum being bad for looped back
IP multicast when multicast router is deactivated.
Reported by: Vsevolod Lobko
Diffstat (limited to 'sys')
-rw-r--r-- | sys/netinet/ip_output.c | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/sys/netinet/ip_output.c b/sys/netinet/ip_output.c index ccab9af..0b02ea1 100644 --- a/sys/netinet/ip_output.c +++ b/sys/netinet/ip_output.c @@ -2188,6 +2188,14 @@ ip_mloopback(ifp, m, dst, hlen) if (copym != NULL && (copym->m_flags & M_EXT || copym->m_len < hlen)) copym = m_pullup(copym, hlen); if (copym != NULL) { + /* If needed, compute the checksum and mark it as valid. */ + if (copym->m_pkthdr.csum_flags & CSUM_DELAY_DATA) { + in_delayed_cksum(copym); + copym->m_pkthdr.csum_flags &= ~CSUM_DELAY_DATA; + copym->m_pkthdr.csum_flags |= + CSUM_DATA_VALID | CSUM_PSEUDO_HDR; + copym->m_pkthdr.csum_data = 0xffff; + } /* * We don't bother to fragment if the IP length is greater * than the interface's MTU. Can this possibly matter? @@ -2220,14 +2228,6 @@ ip_mloopback(ifp, m, dst, hlen) copym->m_pkthdr.rcvif = ifp; ip_input(copym); #else - /* If needed, compute the checksum and mark it as valid. */ - if (copym->m_pkthdr.csum_flags & CSUM_DELAY_DATA) { - in_delayed_cksum(copym); - copym->m_pkthdr.csum_flags &= ~CSUM_DELAY_DATA; - copym->m_pkthdr.csum_flags |= - CSUM_DATA_VALID | CSUM_PSEUDO_HDR; - copym->m_pkthdr.csum_data = 0xffff; - } if_simloop(ifp, copym, dst->sin_family, 0); #endif } |