summaryrefslogtreecommitdiffstats
path: root/sys/netinet
diff options
context:
space:
mode:
authorru <ru@FreeBSD.org>2004-03-25 08:46:27 +0000
committerru <ru@FreeBSD.org>2004-03-25 08:46:27 +0000
commit869b51c6d04a3ee66a7fd68e1ea9d5906aea23d2 (patch)
tree710d4f143403eec84e83bfe99cc3d874847f03bd /sys/netinet
parentaf30ef411877ee85c0a9a04733de71036b589e8c (diff)
downloadFreeBSD-src-869b51c6d04a3ee66a7fd68e1ea9d5906aea23d2.zip
FreeBSD-src-869b51c6d04a3ee66a7fd68e1ea9d5906aea23d2.tar.gz
Untangle IP multicast routing interaction with delayed payload checksums.
Compute the payload checksum for a locally originated IP multicast where God intended, in ip_mloopback(), rather than doing it in ip_output() and only when multicast router is active. This is more correct as we do not fool ip_input() that the packet has the correct payload checksum when in fact it does not (when multicast router is inactive). This is also more efficient if we don't join the multicast group we send to, thus allowing the hardware to checksum the payload.
Diffstat (limited to 'sys/netinet')
-rw-r--r--sys/netinet/ip_output.c16
1 files changed, 3 insertions, 13 deletions
diff --git a/sys/netinet/ip_output.c b/sys/netinet/ip_output.c
index a83cfa9..ccab9af 100644
--- a/sys/netinet/ip_output.c
+++ b/sys/netinet/ip_output.c
@@ -338,18 +338,6 @@ ip_output(struct mbuf *m, struct mbuf *opt, struct route *ro,
ip->ip_src = IA_SIN(ia)->sin_addr;
}
- if (ip_mrouter && (flags & IP_FORWARDING) == 0) {
- /*
- * XXX
- * delayed checksums are not currently
- * compatible with IP multicast routing
- */
- if (m->m_pkthdr.csum_flags & CSUM_DELAY_DATA) {
- in_delayed_cksum(m);
- m->m_pkthdr.csum_flags &=
- ~CSUM_DELAY_DATA;
- }
- }
IN_LOOKUP_MULTI(pkt_dst, ifp, inm);
if (inm != NULL &&
(imo == NULL || imo->imo_multicast_loop)) {
@@ -2232,8 +2220,10 @@ ip_mloopback(ifp, m, dst, hlen)
copym->m_pkthdr.rcvif = ifp;
ip_input(copym);
#else
- /* if the checksum hasn't been computed, mark it as valid */
+ /* 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;
OpenPOWER on IntegriCloud