aboutsummaryrefslogtreecommitdiffstats
path: root/include/net/bpf_sk_storage.h
diff options
context:
space:
mode:
authorStanislav Fomichev <sdf@google.com>2019-08-14 10:37:49 -0700
committerDaniel Borkmann <daniel@iogearbox.net>2019-08-17 23:18:54 +0200
commit8f51dfc73bf181f2304e1498f55d5f452e060cbe (patch)
tree1b3877adff06cd12dbeac725521cef44d2ebf7d7 /include/net/bpf_sk_storage.h
parentbpf: export bpf_map_inc_not_zero (diff)
downloadlinux-dev-8f51dfc73bf181f2304e1498f55d5f452e060cbe.tar.xz
linux-dev-8f51dfc73bf181f2304e1498f55d5f452e060cbe.zip
bpf: support cloning sk storage on accept()
Add new helper bpf_sk_storage_clone which optionally clones sk storage and call it from sk_clone_lock. Cc: Martin KaFai Lau <kafai@fb.com> Cc: Yonghong Song <yhs@fb.com> Acked-by: Martin KaFai Lau <kafai@fb.com> Acked-by: Yonghong Song <yhs@fb.com> Signed-off-by: Stanislav Fomichev <sdf@google.com> Signed-off-by: Daniel Borkmann <daniel@iogearbox.net>
Diffstat (limited to 'include/net/bpf_sk_storage.h')
-rw-r--r--include/net/bpf_sk_storage.h10
1 files changed, 10 insertions, 0 deletions
diff --git a/include/net/bpf_sk_storage.h b/include/net/bpf_sk_storage.h
index b9dcb02e756b..8e4f831d2e52 100644
--- a/include/net/bpf_sk_storage.h
+++ b/include/net/bpf_sk_storage.h
@@ -10,4 +10,14 @@ void bpf_sk_storage_free(struct sock *sk);
extern const struct bpf_func_proto bpf_sk_storage_get_proto;
extern const struct bpf_func_proto bpf_sk_storage_delete_proto;
+#ifdef CONFIG_BPF_SYSCALL
+int bpf_sk_storage_clone(const struct sock *sk, struct sock *newsk);
+#else
+static inline int bpf_sk_storage_clone(const struct sock *sk,
+ struct sock *newsk)
+{
+ return 0;
+}
+#endif
+
#endif /* _BPF_SK_STORAGE_H */