mirror of
https://git.FreeBSD.org/src.git
synced 2024-12-16 10:20:30 +00:00
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/
This commit is contained in:
parent
f0e2422b1b
commit
2201e1b039
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=103556
@ -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 */
|
||||
|
Loading…
Reference in New Issue
Block a user