summaryrefslogtreecommitdiffstats
path: root/sys/net/bpf_filter.c (follow)
Commit message (Collapse)AuthorAgeFilesLines
* add a BPF_RND load location that provides a random value.dlg2020-08-031-1/+6
| | | | | | | | | | | | | | | | this will be used so a bpf filter can make a decision based on a random number, which in turn will be used so a filter can perform random sampling of packets rather than capturing all packets. random sampling means that we don't have to figure out how to make bpf coordinate multiple concurrent calls to do counter based sampling. BPF_RND is currently backed with arc4random. discussed with many including jmatthew@, alex wilson, claudio@, sthen@, deraadt@, and tb@ ok kn@ tb@ jmatthew@ i call this extended bpf... xBPF.
* If you use sys/param.h, you don't need sys/types.hderaadt2017-09-081-2/+1
|
* Don't waste time zero'ing memory until there is some chance it mightkrw2016-09-131-3/+3
| | | | | | | | be used. Also noted by dlg@. ok phessler@ mpi@
* Kill some unsightly whitespace.krw2016-09-121-15/+15
|
* mark the bpf_mem ops as Static.dlg2016-04-021-9/+12
| | | | Static is a nop in _KERNEL, but is static in userland and therefore libpcap
* mark the program and buffer as const in bpf_filter()dlg2016-04-021-2/+3
| | | | | | | | other projects have already done this, and there's software (eg, gopacket) which now expects it. based on a discussion with jasper@ and canacar@ ok jasper@
* refactor bpf_filter a bit.dlg2016-04-021-181/+83
| | | | | | | | | | | | | | | | | | | | | | | the code was confusing around how it dealt with packets in mbufs vs plain memory buffers with a lenght. this renames bpf_filter to _bpf_filter, and changes it so the packet memory is referred to by an opaque pointer, and callers have to provide a set of operations to extra values from that opaque pointer. bpf_filter is now provided as a wrapper around _bpf_filter. it provides a set of operators that work on a straight buffer with a lenght. this also adds a bpf_mfilter function which takes an mbuf instead of a buffer, and it provides explicit operations for extracting values from mbufs. if we want to use bpf filters against other data structures (usb or scsi packets maybe?) we are able to provide functions for extracting payloads from them and use _bpf_filter as is. ok canacar@
* test mbuf pointers against NULL not 0jsg2015-05-131-4/+4
| | | | ok krw@ miod@
* better boundchecks in validation; from Guy Harris; ok millert@ dlg@otto2014-09-191-5/+5
|
* ansify function declaration things.dlg2014-09-181-17/+5
| | | | ok mpi@ henning@ krw@
* Unbreak userland as well, since bpf_filter.c is also used in libpcap.canacar2011-02-131-2/+4
| | | | Noticed by robert at openbsd pap st, thanks.
* Unbreak previous commit by adding the proper header file.canacar2011-02-121-1/+2
|
* Clear the filter memory area before using it. Leaving it uninitialized maycanacar2011-02-121-1/+3
| | | | | | leak previous kernel stack contents through a malicioius BPF filter. Reported by Dan Rosenberg via Alistair Crooks. ok deraadt@, krw@, claudio@
* Fix validation of div by constant; from Guy Harris; ok deraadt@ miod@otto2010-04-211-2/+2
|
* Accept BPF_MUL as a valid instruction in bpf_validate() also improvecanacar2008-01-021-4/+4
| | | | the comments. Based on diff from Guy Harris
* Fix some "that that"s.tom2007-08-061-2/+2
| | | | ok miod@ jmc@
* Fix handling of errors wrt to MINDEX. From NetBSD bpf_filter 1.32;otto2006-10-281-9/+7
| | | | ok henning@ deraadt@ canacar@
* add missing break; now filters containing a division can passotto2006-02-271-1/+2
| | | | validation; from NetBSD; ok deraadt@
* Avoid sign extend by casting to u_char *; from NetBSD via Guy Harris.otto2005-12-081-3/+3
| | | | | Also change another cast, for the sake of consistency, as prompted by djm@ ok deraadt@ djm@ canacar@
* No part of the code defines UNALIGNED_ACCESS, use reverted tests formiod2005-09-281-2/+3
| | | | | | __STRICT_ALIGNMENT instead. Help pedro@ deraadt@, ok deraadt@
* - make the k field in struct bpf_insn unsigned, as promised in theotto2004-04-261-32/+95
| | | | | | | | manual page. - more strict bpf code validation, preventing arbitrary kernel memory read and writes. Some help from frantzen@ and canacar@; testing jmc@ markus@; ok canacar@ henning@ franzen@
* prevent backward jumps; pls@egsys.hu; ok canacar, deraadtmarkus2004-02-231-2/+3
|
* de-register. deraadt okitojun2003-12-101-25/+25
|
* add missing includesdavid2003-07-181-1/+2
| | | | ok tedu@
* protos for userland buildderaadt2003-06-271-1/+4
|
* Remove the advertising clause in the UCB license which Berkeleymillert2003-06-021-6/+2
| | | | rescinded 22 July 1999. Proofed by myself and Theo.
* First round of __P removal in sysmillert2002-03-141-3/+3
|
* de-#ifdef-izejason2000-06-191-9/+2
|
* Remove statics (required renames)niklas1999-09-131-11/+11
|
* Fix some mips -> __mips__ stuff.pefo1999-06-011-2/+2
|
* __OpenBSD__deraadt1996-08-221-2/+2
|
* From NetBSD: 960217 mergeniklas1996-03-031-6/+6
|
* For the '#ifdef sun [...] #endif' conditional we weren't bringing in thedavem1995-10-231-0/+2
| | | | | proper definitions for 'struct mbuf' and friends for in.h, bringing in 'sys/socket.h' and 'net/if.h' fixes this.
* initial import of NetBSD treederaadt1995-10-181-0/+525