From bf65d0d45904f56cd643d093b534bf0b7515386c Mon Sep 17 00:00:00 2001 From: phk Date: Wed, 18 Sep 2002 19:48:59 +0000 Subject: [PATCH] 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/ --- sys/net/bpf.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/sys/net/bpf.c b/sys/net/bpf.c index 1751e0383753..f1943a45957a 100644 --- a/sys/net/bpf.c +++ b/sys/net/bpf.c @@ -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) {