From 0dea849ae93133a4a02f0d5fd58340d3df92668b Mon Sep 17 00:00:00 2001 From: John Baldwin Date: Fri, 29 Dec 2006 13:59:50 +0000 Subject: Various bpf(4) related fixes to catch places up to the new bpf(4) semantics. - Stop testing bpf pointers for NULL. In some cases use bpf_peers_present() and then call the function directly inside the conditional block instead of the macro. - For places where the entire conditional block is the macro, remove the test and make the macro unconditional. - Use BPF_MTAP() in if_pfsync on FreeBSD instead of an expanded version of the old semantics. Reviewed by: csjp (older version) --- sys/dev/ppbus/if_plip.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'sys/dev/ppbus') diff --git a/sys/dev/ppbus/if_plip.c b/sys/dev/ppbus/if_plip.c index 2af0fd1efe5f..df59f1bda7d2 100644 --- a/sys/dev/ppbus/if_plip.c +++ b/sys/dev/ppbus/if_plip.c @@ -455,7 +455,7 @@ static void lptap(struct ifnet *ifp, struct mbuf *m) { u_int32_t af = AF_INET; - BPF_MTAP2(ifp, &af, sizeof(af), m); + bpf_mtap2(ifp, &af, sizeof(af), m); } static void @@ -514,7 +514,7 @@ lp_intr (void *arg) sc->sc_ifp->if_ibytes += len; top = m_devget(sc->sc_ifbuf + CLPIPHDRLEN, len, 0, sc->sc_ifp, 0); if (top) { - if (sc->sc_ifp->if_bpf) + if (bpf_peers_present(sc->sc_ifp->if_bpf)) lptap(sc->sc_ifp, top); netisr_queue(NETISR_IP, top); /* mbuf is free'd on failure. */ } @@ -559,7 +559,7 @@ lp_intr (void *arg) sc->sc_ifp->if_ibytes += len; top = m_devget(sc->sc_ifbuf + LPIPHDRLEN, len, 0, sc->sc_ifp, 0); if (top) { - if (sc->sc_ifp->if_bpf) + if (bpf_peers_present(sc->sc_ifp->if_bpf)) lptap(sc->sc_ifp, top); netisr_queue(NETISR_IP, top); /* mbuf is free'd on failure. */ } @@ -694,7 +694,7 @@ lpoutput (struct ifnet *ifp, struct mbuf *m, } else { ifp->if_opackets++; ifp->if_obytes += m->m_pkthdr.len; - if (ifp->if_bpf) + if (bpf_peers_present(ifp->if_bpf)) lptap(ifp, m); } @@ -739,7 +739,7 @@ lpoutput (struct ifnet *ifp, struct mbuf *m, } else { ifp->if_opackets++; ifp->if_obytes += m->m_pkthdr.len; - if (ifp->if_bpf) + if (bpf_peers_present(ifp->if_bpf)) lptap(ifp, m); } -- cgit v1.3