History

bpf: export bpf_sock for BPF_PROG_TYPE_SOCK_OPS prog type

And let it use bpf_sk_storage_{get,delete} helpers to access socket storage. Kernel context (struct bpf_sock_ops_kern) already has sk member, so I just expose it to the BPF hooks. I use PTR_TO_SOCKET_OR_NULL and return NULL in !is_fullsock case. I also export bpf_tcp_sock to make it possible to access tcp socket stats.

Stanislav Fomichev committed 7 years ago

Commit 1314ef51 parent fb85c4a2 files · +27 −0Browse files

Showing the changes to include/uapi/linux (1 of 2 files). Show all

Unified · Split

include/uapi/linux/bpf.h+1−0
@@ -3299,6 +3299,7 @@ struct bpf_sock_ops { · 3298 unmodified lines
3299 __u32 sk_txhash;3299 __u32 sk_txhash;
3300 __u64 bytes_received;3300 __u64 bytes_received;
3301 __u64 bytes_acked;3301 __u64 bytes_acked;
3302 __bpf_md_ptr(struct bpf_sock *, sk);
3302};3303};
3303 3304
3304/* Definitions for bpf_sock_ops_cb_flags */3305/* Definitions for bpf_sock_ops_cb_flags */