summaryrefslogtreecommitdiffstats
path: root/sys
diff options
context:
space:
mode:
authorphk <phk@FreeBSD.org>2002-09-18 19:50:48 +0000
committerphk <phk@FreeBSD.org>2002-09-18 19:50:48 +0000
commitbfed3f6fe96c44b7f23e2b9e4f769cd835195819 (patch)
tree38b1a54d7cab0b60a018983d8dcfe555ace02b49 /sys
parentbf65d0d45904f56cd643d093b534bf0b7515386c (diff)
downloadFreeBSD-src-bfed3f6fe96c44b7f23e2b9e4f769cd835195819.zip
FreeBSD-src-bfed3f6fe96c44b7f23e2b9e4f769cd835195819.tar.gz
Optimize the way we call BPF a tiny bit: If we chop the ether-header off
ourselves, call bpf before we do so, rather than re-construct the entire thing afterwards. Sponsored: http://www.babeltech.dk/
Diffstat (limited to 'sys')
-rw-r--r--sys/net/if_ethersubr.c15
1 files changed, 7 insertions, 8 deletions
diff --git a/sys/net/if_ethersubr.c b/sys/net/if_ethersubr.c
index b622d9e..ba254c8 100644
--- a/sys/net/if_ethersubr.c
+++ b/sys/net/if_ethersubr.c
@@ -566,19 +566,14 @@ ether_input(struct ifnet *ifp, struct ether_header *eh, struct mbuf *m)
m_freem(m);
return;
}
+ if (ifp->if_bpf != NULL)
+ bpf_mtap(ifp, m);
m->m_pkthdr.rcvif = ifp;
eh = mtod(m, struct ether_header *);
m->m_data += sizeof(struct ether_header);
m->m_len -= sizeof(struct ether_header);
m->m_pkthdr.len = m->m_len;
- }
-
-#ifdef MAC
- mac_create_mbuf_from_ifnet(ifp, m);
-#endif
-
- /* Check for a BPF tap */
- if (ifp->if_bpf != NULL) {
+ } else if (ifp->if_bpf != NULL) {
struct m_hdr mh;
/* This kludge is OK; BPF treats the "mbuf" as read-only */
@@ -588,6 +583,10 @@ ether_input(struct ifnet *ifp, struct ether_header *eh, struct mbuf *m)
bpf_mtap(ifp, (struct mbuf *)&mh);
}
+#ifdef MAC
+ mac_create_mbuf_from_ifnet(ifp, m);
+#endif
+
ifp->if_ibytes += m->m_pkthdr.len + sizeof (*eh);
/* Handle ng_ether(4) processing, if any */
OpenPOWER on IntegriCloud