]> git.baikalelectronics.ru Git - kernel.git/commit
bpf: sockmap, add sample option to test apply_bytes helper
authorJohn Fastabend <john.fastabend@gmail.com>
Sun, 18 Mar 2018 19:57:56 +0000 (12:57 -0700)
committerDaniel Borkmann <daniel@iogearbox.net>
Mon, 19 Mar 2018 20:14:40 +0000 (21:14 +0100)
commit2393a68bb5c148976c26f550c5da26f83c30b8bd
tree5792e6806284fb388783223e3d9cd2d9ae70fdaf
parentd3a95d065f865c84bb87b169754e868070f0ff56
bpf: sockmap, add sample option to test apply_bytes helper

This adds an option to test the apply_bytes helper. This option lets
the user specify an int on the command line specifying how much data
each verdict should apply to.

When this is set a map entry is set with the bytes input by the user
and then the specified program --txmsg or --txmsg_redir will use the
value and set the applied data. If no other option is set then a
default --txmsg_apply program is run. This program will drop pkts
if an error is detected on the bytes map lookup. Useful to verify
the map lookup and apply helper are working and causing a hard
error if it is not.

Signed-off-by: John Fastabend <john.fastabend@gmail.com>
Acked-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Daniel Borkmann <daniel@iogearbox.net>
samples/sockmap/sockmap_kern.c
samples/sockmap/sockmap_user.c
tools/testing/selftests/bpf/bpf_helpers.h