diff options
author | 2016-09-12 16:24:37 +0000 | |
---|---|---|
committer | 2016-09-12 16:24:37 +0000 | |
commit | 6f70de4933df9331382bd3c0555f471893aafb0c (patch) | |
tree | 53a844b96f6c81103c016f971a30bc457f479fde /sys | |
parent | sync (diff) | |
download | wireguard-openbsd-6f70de4933df9331382bd3c0555f471893aafb0c.tar.xz wireguard-openbsd-6f70de4933df9331382bd3c0555f471893aafb0c.zip |
bpf_tap() is long dead! Long live bpf_mtap() & friends.
ok natano@ deraadt@
Diffstat (limited to 'sys')
-rw-r--r-- | sys/net/bpf.c | 58 | ||||
-rw-r--r-- | sys/net/bpf.h | 3 |
2 files changed, 2 insertions, 59 deletions
diff --git a/sys/net/bpf.c b/sys/net/bpf.c index 98a367b70c4..bd85d5e1a77 100644 --- a/sys/net/bpf.c +++ b/sys/net/bpf.c @@ -1,4 +1,4 @@ -/* $OpenBSD: bpf.c,v 1.148 2016/08/22 10:40:36 mpi Exp $ */ +/* $OpenBSD: bpf.c,v 1.149 2016/09/12 16:24:37 krw Exp $ */ /* $NetBSD: bpf.c,v 1.33 1997/02/21 23:59:35 thorpej Exp $ */ /* @@ -1148,62 +1148,6 @@ filt_bpfread(struct knote *kn, long hint) } /* - * Incoming linkage from device drivers. Process the packet pkt, of length - * pktlen, which is stored in a contiguous buffer. The packet is parsed - * by each process' filter, and if accepted, stashed into the corresponding - * buffer. - */ -int -bpf_tap(caddr_t arg, u_char *pkt, u_int pktlen, u_int direction) -{ - struct bpf_if *bp = (struct bpf_if *)arg; - struct srp_ref sr; - struct bpf_d *d; - size_t slen; - struct timeval tv; - int drop = 0, gottime = 0; - int s; - - if (bp == NULL) - return (0); - - SRPL_FOREACH(d, &sr, &bp->bif_dlist, bd_next) { - atomic_inc_long(&d->bd_rcount); - - if ((direction & d->bd_dirfilt) != 0) - slen = 0; - else { - struct srp_ref sr; - struct bpf_program *bf; - struct bpf_insn *fcode = NULL; - - bf = srp_enter(&sr, &d->bd_rfilter); - if (bf != NULL) - fcode = bf->bf_insns; - slen = bpf_filter(fcode, pkt, pktlen, pktlen); - srp_leave(&sr); - } - - if (slen > 0) { - if (!gottime++) - microtime(&tv); - - KERNEL_LOCK(); - s = splnet(); - bpf_catchpacket(d, pkt, pktlen, slen, bcopy, &tv); - splx(s); - KERNEL_UNLOCK(); - - if (d->bd_fildrop) - drop = 1; - } - } - SRPL_LEAVE(&sr); - - return (drop); -} - -/* * Copy data from an mbuf chain into a buffer. This code is derived * from m_copydata in sys/uipc_mbuf.c. */ diff --git a/sys/net/bpf.h b/sys/net/bpf.h index 64188a9cf56..b38a04a48e9 100644 --- a/sys/net/bpf.h +++ b/sys/net/bpf.h @@ -1,4 +1,4 @@ -/* $OpenBSD: bpf.h,v 1.57 2016/09/11 13:57:57 deraadt Exp $ */ +/* $OpenBSD: bpf.h,v 1.58 2016/09/12 16:24:37 krw Exp $ */ /* $NetBSD: bpf.h,v 1.15 1996/12/13 07:57:33 mikel Exp $ */ /* @@ -287,7 +287,6 @@ struct ifnet; struct mbuf; int bpf_validate(struct bpf_insn *, int); -int bpf_tap(caddr_t, u_char *, u_int, u_int); int bpf_mtap(caddr_t, const struct mbuf *, u_int); int bpf_mtap_hdr(caddr_t, caddr_t, u_int, const struct mbuf *, u_int, void (*)(const void *, void *, size_t)); |