And let it use bpf_sk_storage_{get,delete} helpers to access socket storage. Kernel context (struct bpf_sock_addr_kern) already has sk member, so I just expose it to the BPF hooks. Using PTR_TO_SOCKET instead of PTR_TO_SOCK_COMMON should be safe because the hook is called on bind/connect.
Showing the changes to include/uapi/linux (1 of 2 files). Show all
Unified · Split
| @@ -3247,6 +3247,7 @@ struct bpf_sock_addr { · 3246 unmodified lines | |||
| 3247 | __u32 msg_src_ip6[4]; /* Allows 1,2,4-byte read an 4-byte write. | 3247 | __u32 msg_src_ip6[4]; /* Allows 1,2,4-byte read an 4-byte write. |
| 3248 | * Stored in network byte order. | 3248 | * Stored in network byte order. |
| 3249 | */ | 3249 | */ |
| 3250 | __bpf_md_ptr(struct bpf_sock *, sk); | ||
| 3250 | }; | 3251 | }; |
| 3251 | 3252 | ||
| 3252 | /* User bpf_sock_ops struct to access socket values and specify request ops | 3253 | /* User bpf_sock_ops struct to access socket values and specify request ops |