linux/samples
Alexei Starovoitov fbe3310840 samples: bpf: large eBPF program in C
sockex2_kern.c is purposefully large eBPF program in C.
llvm compiles ~200 lines of C code into ~300 eBPF instructions.

It's similar to __skb_flow_dissect() to demonstrate that complex packet parsing
can be done by eBPF.
Then it uses (struct flow_keys)->dst IP address (or hash of ipv6 dst) to keep
stats of number of packets per IP.
User space loads eBPF program, attaches it to loopback interface and prints
dest_ip->#packets stats every second.

Usage:
$sudo samples/bpf/sockex2
ip 127.0.0.1 count 19
ip 127.0.0.1 count 178115
ip 127.0.0.1 count 369437
ip 127.0.0.1 count 559841
ip 127.0.0.1 count 750539

Signed-off-by: Alexei Starovoitov <ast@plumgrid.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
2014-12-05 21:47:34 -08:00
..
bpf samples: bpf: large eBPF program in C 2014-12-05 21:47:34 -08:00
hidraw HID: samples/hidraw: add .gitignore file 2013-08-20 12:48:58 +02:00
hw_breakpoint
kdb
kfifo kfifo API type safety 2013-11-15 09:32:23 +09:00
kobject samples/kobject/: avoid world-writable sysfs files. 2014-05-14 10:53:57 +09:30
kprobes kprobes: update jprobe_example.c for do_fork() change 2014-09-26 11:11:12 +02:00
rpmsg misc: remove __dev* attributes. 2013-01-03 15:57:16 -08:00
seccomp samples/seccomp/Makefile: do not build tests if cross-compiling for MIPS 2014-04-03 16:21:06 -07:00
trace_events tracing: Change trace event sample to use strlcpy instead of strncpy 2014-07-01 07:13:33 -04:00
uhid HID: uhid: improve uhid example client 2013-09-04 11:35:14 +02:00
Kconfig tracing: Remove tracepoint sample code 2013-01-25 11:22:11 -05:00
Makefile tracing: Remove tracepoint sample code 2013-01-25 11:22:11 -05:00