aboutsummaryrefslogtreecommitdiff
path: root/sys/net
diff options
context:
space:
mode:
authorJohn Baldwin <jhb@FreeBSD.org>2022-11-30 22:38:51 +0000
committerJohn Baldwin <jhb@FreeBSD.org>2022-11-30 22:38:51 +0000
commit79b679942352a7f10d759fdee1892aa251e0f439 (patch)
tree1cca837966e54a902baa3b051269117ee60b2a5f /sys/net
parentf9ce8da86434867e1e7172fb56a5504f91c98ce4 (diff)
downloadsrc-79b679942352a7f10d759fdee1892aa251e0f439.tar.gz
src-79b679942352a7f10d759fdee1892aa251e0f439.zip
ether_demux: Defer stripping the Ethernet header.
This avoids having to undo it before invoking NetGraph's orphan input hook. Reviewed by: ae, melifaro Sponsored by: Chelsio Communications Differential Revision: https://reviews.freebsd.org/D37510
Diffstat (limited to 'sys/net')
-rw-r--r--sys/net/if_ethersubr.c11
1 files changed, 4 insertions, 7 deletions
diff --git a/sys/net/if_ethersubr.c b/sys/net/if_ethersubr.c
index d92c49b6f39c..a42e15dda97a 100644
--- a/sys/net/if_ethersubr.c
+++ b/sys/net/if_ethersubr.c
@@ -890,11 +890,9 @@ ether_demux(struct ifnet *ifp, struct mbuf *m)
/*
* Reset layer specific mbuf flags to avoid confusing upper layers.
- * Strip off Ethernet header.
*/
m->m_flags &= ~M_VLANTAG;
m_clrprotoflags(m);
- m_adj(m, ETHER_HDR_LEN);
/*
* Dispatch frame to upper layer.
@@ -922,6 +920,10 @@ ether_demux(struct ifnet *ifp, struct mbuf *m)
default:
goto discard;
}
+
+ /* Strip off Ethernet header. */
+ m_adj(m, ETHER_HDR_LEN);
+
netisr_dispatch(isr, m);
return;
@@ -934,11 +936,6 @@ discard:
if (ifp->if_l2com != NULL) {
KASSERT(ng_ether_input_orphan_p != NULL,
("ng_ether_input_orphan_p is NULL"));
- /*
- * Put back the ethernet header so netgraph has a
- * consistent view of inbound packets.
- */
- M_PREPEND(m, ETHER_HDR_LEN, M_NOWAIT);
(*ng_ether_input_orphan_p)(ifp, m);
return;
}