Daniel Borkmann
42984d7c1e
bpf: add sample usages for persistent maps/progs
This patch adds a couple of stand-alone examples on how BPF_OBJ_PIN
and BPF_OBJ_GET commands can be used.
Example with maps:
# ./fds_example -F /sys/fs/bpf/m -P -m -k 1 -v 42
bpf: map fd:3 (Success)
bpf: pin ret:(0,Success)
bpf: fd:3 u->(1:42) ret:(0,Success)
# ./fds_example -F /sys/fs/bpf/m -G -m -k 1
bpf: get fd:3 (Success)
bpf: fd:3 l->(1):42 ret:(0,Success)
# ./fds_example -F /sys/fs/bpf/m -G -m -k 1 -v 24
bpf: get fd:3 (Success)
bpf: fd:3 u->(1:24) ret:(0,Success)
# ./fds_example -F /sys/fs/bpf/m -G -m -k 1
bpf: get fd:3 (Success)
bpf: fd:3 l->(1):24 ret:(0,Success)
# ./fds_example -F /sys/fs/bpf/m2 -P -m
bpf: map fd:3 (Success)
bpf: pin ret:(0,Success)
# ./fds_example -F /sys/fs/bpf/m2 -G -m -k 1
bpf: get fd:3 (Success)
bpf: fd:3 l->(1):0 ret:(0,Success)
# ./fds_example -F /sys/fs/bpf/m2 -G -m
bpf: get fd:3 (Success)
Example with progs:
# ./fds_example -F /sys/fs/bpf/p -P -p
bpf: prog fd:3 (Success)
bpf: pin ret:(0,Success)
bpf sock:4 <- fd:3 attached ret:(0,Success)
# ./fds_example -F /sys/fs/bpf/p -G -p
bpf: get fd:3 (Success)
bpf: sock:4 <- fd:3 attached ret:(0,Success)
# ./fds_example -F /sys/fs/bpf/p2 -P -p -o ./sockex1_kern.o
bpf: prog fd:5 (Success)
bpf: pin ret:(0,Success)
bpf: sock:3 <- fd:5 attached ret:(0,Success)
# ./fds_example -F /sys/fs/bpf/p2 -G -p
bpf: get fd:3 (Success)
bpf: sock:4 <- fd:3 attached ret:(0,Success)
Signed-off-by: Daniel Borkmann <daniel@iogearbox.net>
Acked-by: Alexei Starovoitov <ast@kernel.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
|
2015-11-02 22:48:39 -05:00 |
| .. |
|
bpf_helpers.h
|
Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net
|
2015-11-01 00:15:30 -04:00 |
|
bpf_load.c
|
samples/bpf: bpf_tail_call example for tracing
|
2015-05-21 17:07:59 -04:00 |
|
bpf_load.h
|
samples/bpf: Add simple non-portable kprobe filter example
|
2015-04-02 13:25:50 +02:00 |
|
fds_example.c
|
bpf: add sample usages for persistent maps/progs
|
2015-11-02 22:48:39 -05:00 |
|
lathist_kern.c
|
bpf: BPF based latency tracing
|
2015-06-23 06:09:58 -07:00 |
|
lathist_user.c
|
bpf: BPF based latency tracing
|
2015-06-23 06:09:58 -07:00 |
|
libbpf.c
|
bpf: add sample usages for persistent maps/progs
|
2015-11-02 22:48:39 -05:00 |
|
libbpf.h
|
bpf: add sample usages for persistent maps/progs
|
2015-11-02 22:48:39 -05:00 |
|
Makefile
|
bpf: add sample usages for persistent maps/progs
|
2015-11-02 22:48:39 -05:00 |
|
sock_example.c
|
samples/bpf: Add simple non-portable kprobe filter example
|
2015-04-02 13:25:50 +02:00 |
|
sockex1_kern.c
|
samples: bpf: add skb->field examples and tests
|
2015-03-15 22:02:28 -04:00 |
|
sockex1_user.c
|
samples: bpf: add skb->field examples and tests
|
2015-03-15 22:02:28 -04:00 |
|
sockex2_kern.c
|
samples: bpf: add skb->field examples and tests
|
2015-03-15 22:02:28 -04:00 |
|
sockex2_user.c
|
samples: bpf: add skb->field examples and tests
|
2015-03-15 22:02:28 -04:00 |
|
sockex3_kern.c
|
bpf: allow programs to write to certain skb fields
|
2015-06-07 02:01:33 -07:00 |
|
sockex3_user.c
|
samples/bpf: bpf_tail_call example for networking
|
2015-05-21 17:07:59 -04:00 |
|
tcbpf1_kern.c
|
bpf: add bpf_redirect() helper
|
2015-09-17 21:09:07 -07:00 |
|
test_maps.c
|
|
|
|
test_verifier.c
|
bpf: add unprivileged bpf tests
|
2015-10-12 19:13:37 -07:00 |
|
trace_output_kern.c
|
samples: bpf: add bpf_perf_event_output example
|
2015-10-22 06:42:15 -07:00 |
|
trace_output_user.c
|
samples: bpf: add bpf_perf_event_output example
|
2015-10-22 06:42:15 -07:00 |
|
tracex1_kern.c
|
samples: bpf: enable trace samples for s390x
|
2015-07-08 15:17:45 -07:00 |
|
tracex1_user.c
|
samples/bpf: Add simple non-portable kprobe filter example
|
2015-04-02 13:25:50 +02:00 |
|
tracex2_kern.c
|
samples: bpf: enable trace samples for s390x
|
2015-07-08 15:17:45 -07:00 |
|
tracex2_user.c
|
bpf: introduce current->pid, tgid, uid, gid, comm accessors
|
2015-06-15 15:53:50 -07:00 |
|
tracex3_kern.c
|
samples: bpf: enable trace samples for s390x
|
2015-07-08 15:17:45 -07:00 |
|
tracex3_user.c
|
samples/bpf: Add IO latency analysis (iosnoop/heatmap) tool
|
2015-04-02 13:25:51 +02:00 |
|
tracex4_kern.c
|
samples: bpf: enable trace samples for s390x
|
2015-07-08 15:17:45 -07:00 |
|
tracex4_user.c
|
samples/bpf: Add kmem_alloc()/free() tracker tool
|
2015-04-02 13:25:51 +02:00 |
|
tracex5_kern.c
|
samples: bpf: enable trace samples for s390x
|
2015-07-08 15:17:45 -07:00 |
|
tracex5_user.c
|
samples/bpf: bpf_tail_call example for tracing
|
2015-05-21 17:07:59 -04:00 |
|
tracex6_kern.c
|
bpf: fix build warnings and add function read_trace_pipe()
|
2015-08-12 16:39:12 -07:00 |
|
tracex6_user.c
|
bpf: fix build warnings and add function read_trace_pipe()
|
2015-08-12 16:39:12 -07:00 |