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.
Showing the changes to include/uapi/linux (1 of 2 files). Show all
Unified · Split
| @@ -3299,6 +3299,7 @@ struct bpf_sock_ops { · 3298 unmodified lines | ||
| 3299 | 3299 | __u32 sk_txhash; |
| 3300 | 3300 | __u64 bytes_received; |
| 3301 | 3301 | __u64 bytes_acked; |
| 3302 | + __bpf_md_ptr(struct bpf_sock *, sk); | |
| 3302 | 3303 | }; |
| 3303 | 3304 | |
| 3304 | 3305 | /* Definitions for bpf_sock_ops_cb_flags */ |