summaryrefslogtreecommitdiff
path: root/sys/net/if_ethersubr.c
diff options
context:
space:
mode:
authorLuigi Rizzo <luigi@FreeBSD.org>2006-12-08 10:36:45 +0000
committerLuigi Rizzo <luigi@FreeBSD.org>2006-12-08 10:36:45 +0000
commit294dd290c606d31918e2208aa993e009ec0e6cfa (patch)
treec023500c0339b43644074e72f434ee8d4b3f8819 /sys/net/if_ethersubr.c
parent35d10226b7e6492911ba48d72bd6fffa0bf7dbc3 (diff)
Notes
Diffstat (limited to 'sys/net/if_ethersubr.c')
-rw-r--r--sys/net/if_ethersubr.c10
1 files changed, 9 insertions, 1 deletions
diff --git a/sys/net/if_ethersubr.c b/sys/net/if_ethersubr.c
index 5a507e3366dd..6893acdb6d00 100644
--- a/sys/net/if_ethersubr.c
+++ b/sys/net/if_ethersubr.c
@@ -306,7 +306,15 @@ ether_output(struct ifnet *ifp, struct mbuf *m,
if (m->m_flags & M_BCAST) {
struct mbuf *n;
- if ((n = m_copy(m, 0, (int)M_COPYALL)) != NULL) {
+ /*
+ * Because if_simloop() modifies the packet, we need a
+ * writable copy through m_dup() instead of a readonly
+ * one as m_copy[m] would give us. The alternative would
+ * be to modify if_simloop() to handle the readonly mbuf,
+ * but performancewise it is mostly equivalent (trading
+ * extra data copying vs. extra locking).
+ */
+ if ((n = m_dup(m, M_DONTWAIT)) != NULL) {
n->m_pkthdr.csum_flags |= csum_flags;
if (csum_flags & CSUM_DATA_VALID)
n->m_pkthdr.csum_data = 0xffff;