linux/samples/bpf
Alexei Starovoitov 91bc4822c3 tc: bpf: add checksum helpers
Commit 608cd71a9c ("tc: bpf: generalize pedit action") has added the
possibility to mangle packet data to BPF programs in the tc pipeline.
This patch adds two helpers bpf_l3_csum_replace() and bpf_l4_csum_replace()
for fixing up the protocol checksums after the packet mangling.

It also adds 'flags' argument to bpf_skb_store_bytes() helper to avoid
unnecessary checksum recomputations when BPF programs adjusting l3/l4
checksums and documents all three helpers in uapi header.

Moreover, a sample program is added to show how BPF programs can make use
of the mangle and csum helpers.

Signed-off-by: Alexei Starovoitov <ast@plumgrid.com>
Acked-by: Daniel Borkmann <daniel@iogearbox.net>
Signed-off-by: David S. Miller <davem@davemloft.net>
2015-04-06 16:42:35 -04:00
..
bpf_helpers.h tc: bpf: add checksum helpers 2015-04-06 16:42:35 -04:00
bpf_load.c samples: bpf: elf_bpf file loader 2014-12-05 21:47:33 -08:00
bpf_load.h samples: bpf: elf_bpf file loader 2014-12-05 21:47:33 -08:00
libbpf.c samples: bpf: example of stateful socket filtering 2014-12-05 21:47:32 -08:00
libbpf.h ebpf: export BPF_PSEUDO_MAP_FD to uapi 2015-03-01 14:05:19 -05:00
Makefile tc: bpf: add checksum helpers 2015-04-06 16:42:35 -04:00
sock_example.c samples: bpf: example of stateful socket filtering 2014-12-05 21:47:32 -08: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
tcbpf1_kern.c tc: bpf: add checksum helpers 2015-04-06 16:42:35 -04:00
test_maps.c samples: bpf: relax test_maps check 2015-01-26 17:20:40 -08:00
test_verifier.c bpf: allow BPF programs access 'protocol' and 'vlan_tci' fields 2015-03-17 15:06:31 -04:00