bpf.c (122352) | bpf.c (123922) |
---|---|
1/* 2 * Copyright (c) 1990, 1991, 1993 3 * The Regents of the University of California. All rights reserved. 4 * 5 * This code is derived from the Stanford/CMU enet packet filter, 6 * (net/enet.c) distributed as part of 4.3BSD, and code contributed 7 * to Berkeley by Steven McCanne and Van Jacobson both of Lawrence 8 * Berkeley Laboratory. --- 23 unchanged lines hidden (view full) --- 32 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 33 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 34 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 35 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 36 * SUCH DAMAGE. 37 * 38 * @(#)bpf.c 8.4 (Berkeley) 1/9/95 39 * | 1/* 2 * Copyright (c) 1990, 1991, 1993 3 * The Regents of the University of California. All rights reserved. 4 * 5 * This code is derived from the Stanford/CMU enet packet filter, 6 * (net/enet.c) distributed as part of 4.3BSD, and code contributed 7 * to Berkeley by Steven McCanne and Van Jacobson both of Lawrence 8 * Berkeley Laboratory. --- 23 unchanged lines hidden (view full) --- 32 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 33 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 34 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 35 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 36 * SUCH DAMAGE. 37 * 38 * @(#)bpf.c 8.4 (Berkeley) 1/9/95 39 * |
40 * $FreeBSD: head/sys/net/bpf.c 122352 2003-11-09 09:17:26Z tanimura $ | 40 * $FreeBSD: head/sys/net/bpf.c 123922 2003-12-28 03:56:00Z sam $ |
41 */ 42 43#include "opt_bpf.h" 44#include "opt_mac.h" 45#include "opt_netgraph.h" 46 47#include <sys/types.h> 48#include <sys/param.h> --- 1173 unchanged lines hidden (view full) --- 1222 catchpacket(d, (u_char *)m, pktlen, slen, 1223 bpf_mcopy); 1224 BPFD_UNLOCK(d); 1225 } 1226 BPFIF_UNLOCK(bp); 1227} 1228 1229/* | 41 */ 42 43#include "opt_bpf.h" 44#include "opt_mac.h" 45#include "opt_netgraph.h" 46 47#include <sys/types.h> 48#include <sys/param.h> --- 1173 unchanged lines hidden (view full) --- 1222 catchpacket(d, (u_char *)m, pktlen, slen, 1223 bpf_mcopy); 1224 BPFD_UNLOCK(d); 1225 } 1226 BPFIF_UNLOCK(bp); 1227} 1228 1229/* |
1230 * Incoming linkage from device drivers, when packet is in 1231 * an mbuf chain and to be prepended by a contiguous header. 1232 */ 1233void 1234bpf_mtap2(bp, data, dlen, m) 1235 struct bpf_if *bp; 1236 void *data; 1237 u_int dlen; 1238 struct mbuf *m; 1239{ 1240 struct mbuf mb; 1241 struct bpf_d *d; 1242 u_int pktlen, slen; 1243 1244 pktlen = m_length(m, NULL); 1245 /* 1246 * Craft on-stack mbuf suitable for passing to bpf_filter. 1247 * Note that we cut corners here; we only setup what's 1248 * absolutely needed--this mbuf should never go anywhere else. 1249 */ 1250 mb.m_next = m; 1251 mb.m_data = data; 1252 mb.m_len = dlen; 1253 pktlen += dlen; 1254 1255 BPFIF_LOCK(bp); 1256 for (d = bp->bif_dlist; d != 0; d = d->bd_next) { 1257 if (!d->bd_seesent && (m->m_pkthdr.rcvif == NULL)) 1258 continue; 1259 BPFD_LOCK(d); 1260 ++d->bd_rcount; 1261 slen = bpf_filter(d->bd_filter, (u_char *)&mb, pktlen, 0); 1262 if (slen != 0) 1263#ifdef MAC 1264 if (mac_check_bpfdesc_receive(d, bp->bif_ifp) == 0) 1265#endif 1266 catchpacket(d, (u_char *)&mb, pktlen, slen, 1267 bpf_mcopy); 1268 BPFD_UNLOCK(d); 1269 } 1270 BPFIF_UNLOCK(bp); 1271} 1272 1273/* |
|
1230 * Move the packet data from interface memory (pkt) into the 1231 * store buffer. Return 1 if it's time to wakeup a listener (buffer full), 1232 * otherwise 0. "copy" is the routine called to do the actual data 1233 * transfer. bcopy is passed in to copy contiguous chunks, while 1234 * bpf_mcopy is passed in to copy mbuf chains. In the latter case, 1235 * pkt is really an mbuf. 1236 */ 1237static void --- 337 unchanged lines hidden (view full) --- 1575void 1576bpf_mtap(bp, m) 1577 struct bpf_if *bp; 1578 struct mbuf *m; 1579{ 1580} 1581 1582void | 1274 * Move the packet data from interface memory (pkt) into the 1275 * store buffer. Return 1 if it's time to wakeup a listener (buffer full), 1276 * otherwise 0. "copy" is the routine called to do the actual data 1277 * transfer. bcopy is passed in to copy contiguous chunks, while 1278 * bpf_mcopy is passed in to copy mbuf chains. In the latter case, 1279 * pkt is really an mbuf. 1280 */ 1281static void --- 337 unchanged lines hidden (view full) --- 1619void 1620bpf_mtap(bp, m) 1621 struct bpf_if *bp; 1622 struct mbuf *m; 1623{ 1624} 1625 1626void |
1627bpf_mtap2(bp, d, l, m) 1628 struct bpf_if *bp; 1629 const void *d; 1630 u_int l; 1631 struct mbuf *m; 1632{ 1633} 1634 1635void |
|
1583bpfattach(ifp, dlt, hdrlen) 1584 struct ifnet *ifp; 1585 u_int dlt, hdrlen; 1586{ 1587} 1588 1589void 1590bpfattach2(ifp, dlt, hdrlen, driverp) --- 31 unchanged lines hidden --- | 1636bpfattach(ifp, dlt, hdrlen) 1637 struct ifnet *ifp; 1638 u_int dlt, hdrlen; 1639{ 1640} 1641 1642void 1643bpfattach2(ifp, dlt, hdrlen, driverp) --- 31 unchanged lines hidden --- |