Use m_length() instead of home-rolled.

In bpf_mtap(), if the entire packet is in one mbuf, call bpf_tap()
instead since it is a tad faster.

Sponsored by:	http://www.babeltech.dk/
This commit is contained in:
phk 2002-09-18 19:48:59 +00:00
parent 63d87674c8
commit bf65d0d459

View File

@ -1123,11 +1123,10 @@ bpf_mtap(ifp, m)
struct bpf_if *bp = ifp->if_bpf;
struct bpf_d *d;
u_int pktlen, slen;
struct mbuf *m0;
pktlen = 0;
for (m0 = m; m0 != 0; m0 = m0->m_next)
pktlen += m0->m_len;
pktlen = m_length(m, NULL);
if (pktlen == m->m_len)
return(bpf_tap(ifp, mtod(m, u_char *), pktlen));
BPFIF_LOCK(bp);
for (d = bp->bif_dlist; d != 0; d = d->bd_next) {