]> git.baikalelectronics.ru Git - kernel.git/commit
bpf: add support for sockmap detach programs
authorJohn Fastabend <john.fastabend@gmail.com>
Fri, 8 Sep 2017 21:00:49 +0000 (14:00 -0700)
committerDavid S. Miller <davem@davemloft.net>
Sat, 9 Sep 2017 04:11:00 +0000 (21:11 -0700)
commit44cce2ca6b60e4888617312f0bba2581e5bd41ee
treef79a061cee45f81cf3a5a9a2c9606e5b4532f2f9
parent09db4090dc82288a63e27869486c65b94c57a460
bpf: add support for sockmap detach programs

The bpf map sockmap supports adding programs via attach commands. This
patch adds the detach command to keep the API symmetric and allow
users to remove previously added programs. Otherwise the user would
have to delete the map and re-add it to get in this state.

This also adds a series of additional tests to capture detach operation
and also attaching/detaching invalid prog types.

API note: socks will run (or not run) programs depending on the state
of the map at the time the sock is added. We do not for example walk
the map and remove programs from previously attached socks.

Acked-by: Daniel Borkmann <daniel@iogearbox.net>
Signed-off-by: John Fastabend <john.fastabend@gmail.com>
Acked-by: Alexei Starovoitov <ast@kernel.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
include/linux/bpf.h
kernel/bpf/sockmap.c
kernel/bpf/syscall.c
tools/testing/selftests/bpf/test_maps.c