diff options
author | John Fastabend <john.fastabend@gmail.com> | 2017-09-08 14:00:49 -0700 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2017-09-08 21:11:00 -0700 |
commit | 5a67da2a71c64daeb456f6f3e87b5c7cecdc5ffa (patch) | |
tree | f79a061cee45f81cf3a5a9a2c9606e5b4532f2f9 /include/linux/bpf.h | |
parent | bbbe211c295ffb309247adb7b871dda60d92d2d5 (diff) | |
download | op-kernel-dev-5a67da2a71c64daeb456f6f3e87b5c7cecdc5ffa.zip op-kernel-dev-5a67da2a71c64daeb456f6f3e87b5c7cecdc5ffa.tar.gz |
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>
Diffstat (limited to 'include/linux/bpf.h')
-rw-r--r-- | include/linux/bpf.h | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/include/linux/bpf.h b/include/linux/bpf.h index c2cb1b5..8390859 100644 --- a/include/linux/bpf.h +++ b/include/linux/bpf.h @@ -385,16 +385,16 @@ static inline void __dev_map_flush(struct bpf_map *map) #if defined(CONFIG_STREAM_PARSER) && defined(CONFIG_BPF_SYSCALL) struct sock *__sock_map_lookup_elem(struct bpf_map *map, u32 key); -int sock_map_attach_prog(struct bpf_map *map, struct bpf_prog *prog, u32 type); +int sock_map_prog(struct bpf_map *map, struct bpf_prog *prog, u32 type); #else static inline struct sock *__sock_map_lookup_elem(struct bpf_map *map, u32 key) { return NULL; } -static inline int sock_map_attach_prog(struct bpf_map *map, - struct bpf_prog *prog, - u32 type) +static inline int sock_map_prog(struct bpf_map *map, + struct bpf_prog *prog, + u32 type) { return -EOPNOTSUPP; } |