From 869b51c6d04a3ee66a7fd68e1ea9d5906aea23d2 Mon Sep 17 00:00:00 2001 From: ru Date: Thu, 25 Mar 2004 08:46:27 +0000 Subject: 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. --- sys/netinet/ip_output.c | 16 +++------------- 1 file changed, 3 insertions(+), 13 deletions(-) (limited to 'sys/netinet') 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; -- cgit v1.1