summaryrefslogtreecommitdiffstats
path: root/sys/net/if_ethersubr.c
diff options
context:
space:
mode:
authorjesper <jesper@FreeBSD.org>2002-01-11 16:04:47 +0000
committerjesper <jesper@FreeBSD.org>2002-01-11 16:04:47 +0000
commit927db04f533d2fdbd84db7aa769260149c96f1a4 (patch)
tree04dbc7f90561d9bd3e965da432f5324effc66cf3 /sys/net/if_ethersubr.c
parentdb24453e8e14091a9f59f87285a92cc5d75012c6 (diff)
downloadFreeBSD-src-927db04f533d2fdbd84db7aa769260149c96f1a4.zip
FreeBSD-src-927db04f533d2fdbd84db7aa769260149c96f1a4.tar.gz
It turns out that when a broadcast packet is looped back, the checksums
are checked on the way in even if they were not calculated on the way out. This fixes rwhod PR: 31954 Submitted by: fenner Approved by: fenner MFC after: 1 week
Diffstat (limited to 'sys/net/if_ethersubr.c')
-rw-r--r--sys/net/if_ethersubr.c13
1 files changed, 13 insertions, 0 deletions
diff --git a/sys/net/if_ethersubr.c b/sys/net/if_ethersubr.c
index 399f065..d743187 100644
--- a/sys/net/if_ethersubr.c
+++ b/sys/net/if_ethersubr.c
@@ -325,12 +325,25 @@ ether_output(ifp, m, dst, rt0)
* reasons and compatibility with the original behavior.
*/
if ((ifp->if_flags & IFF_SIMPLEX) && (loop_copy != -1)) {
+ int csum_flags = 0;
+
+ if (m->m_pkthdr.csum_flags & CSUM_IP)
+ csum_flags |= (CSUM_IP_CHECKED|CSUM_IP_VALID);
+ if (m->m_pkthdr.csum_flags & CSUM_DELAY_DATA)
+ csum_flags |= (CSUM_DATA_VALID|CSUM_PSEUDO_HDR);
if ((m->m_flags & M_BCAST) || (loop_copy > 0)) {
struct mbuf *n = m_copy(m, 0, (int)M_COPYALL);
+ n->m_pkthdr.csum_flags |= csum_flags;
+ if (csum_flags & CSUM_DATA_VALID)
+ n->m_pkthdr.csum_data = 0xffff;
+
(void) if_simloop(ifp, n, dst->sa_family, hlen);
} else if (bcmp(eh->ether_dhost,
eh->ether_shost, ETHER_ADDR_LEN) == 0) {
+ m->m_pkthdr.csum_flags |= csum_flags;
+ if (csum_flags & CSUM_DATA_VALID)
+ m->m_pkthdr.csum_data = 0xffff;
(void) if_simloop(ifp, m, dst->sa_family, hlen);
return (0); /* XXX */
}
OpenPOWER on IntegriCloud