]> git.baikalelectronics.ru Git - kernel.git/commit
filter: added BPF random opcode
authorChema Gonzalez <chema@google.com>
Mon, 21 Apr 2014 16:21:24 +0000 (09:21 -0700)
committerDavid S. Miller <davem@davemloft.net>
Wed, 23 Apr 2014 01:27:57 +0000 (21:27 -0400)
commit3463776d2eab52a1ed1898d44af73c6fc043b269
tree6988d7dc3352fbcce10c5c510ffa11e6f30217de
parentb0628fab2ef660b435ad0b7db0b81d0c186f30c1
filter: added BPF random opcode

Added a new ancillary load (bpf call in eBPF parlance) that produces
a 32-bit random number. We are implementing it as an ancillary load
(instead of an ISA opcode) because (a) it is simpler, (b) allows easy
JITing, and (c) seems more in line with generic ISAs that do not have
"get a random number" as a instruction, but as an OS call.

The main use for this ancillary load is to perform random packet sampling.

Signed-off-by: Chema Gonzalez <chema@google.com>
Acked-by: Alexei Starovoitov <ast@plumgrid.com>
Acked-by: Daniel Borkmann <dborkman@redhat.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Documentation/networking/filter.txt
include/linux/filter.h
include/uapi/linux/filter.h
net/core/filter.c
tools/net/bpf_exp.l
tools/net/bpf_exp.y