1
0
mirror of https://git.FreeBSD.org/src.git synced 2024-12-16 10:20:30 +00:00

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.
This commit is contained in:
Ruslan Ermilov 2004-03-25 08:46:27 +00:00
parent 9fcc066d3e
commit 26f16ebeb1
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=127396

View File

@ -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;