This patch implements a new struct bpf_func_proto, named bpf_skc_to_mptcp_sock_proto. Define a new bpf_id BTF_SOCK_TYPE_MPTCP, and a new helper bpf_skc_to_mptcp_sock(), which invokes another new helper bpf_mptcp_sock_from_subflow() in net/mptcp/bpf.c to get struct mptcp_sock from a given subflow socket. v2: Emit BTF type, add func_id checks in verifier.c and bpf_trace.c, remove build check for CONFIG_BPF_JIT v5: Drop EXPORT_SYMBOL (Martin)
Showing the changes to include/uapi (1 of 11 files). Show all
Unified · Split
| @@ -5172,6 +5172,12 @@ union bpf_attr { · 5171 unmodified lines | |||
| 5172 | * Return | 5172 | * Return |
| 5173 | * Map value associated to *key* on *cpu*, or **NULL** if no entry | 5173 | * Map value associated to *key* on *cpu*, or **NULL** if no entry |
| 5174 | * was found or *cpu* is invalid. | 5174 | * was found or *cpu* is invalid. |
| 5175 | * | ||
| 5176 | * struct mptcp_sock *bpf_skc_to_mptcp_sock(void *sk) | ||
| 5177 | * Description | ||
| 5178 | * Dynamically cast a *sk* pointer to a *mptcp_sock* pointer. | ||
| 5179 | * Return | ||
| 5180 | * *sk* if casting is valid, or **NULL** otherwise. | ||
| 5175 | */ | 5181 | */ |
| 5176 | #define __BPF_FUNC_MAPPER(FN) \ | 5182 | #define __BPF_FUNC_MAPPER(FN) \ |
| 5177 | FN(unspec), \ | 5183 | FN(unspec), \ |
| @@ -5370,6 +5376,7 @@ union bpf_attr { · 192 unmodified lines | |||
| 5370 | FN(ima_file_hash), \ | 5376 | FN(ima_file_hash), \ |
| 5371 | FN(kptr_xchg), \ | 5377 | FN(kptr_xchg), \ |
| 5372 | FN(map_lookup_percpu_elem), \ | 5378 | FN(map_lookup_percpu_elem), \ |
| 5379 | FN(skc_to_mptcp_sock), \ | ||
| 5373 | /* */ | 5380 | /* */ |
| 5374 | 5381 | ||
| 5375 | /* integer value in 'imm' field of BPF_CALL instruction selects which helper | 5382 | /* integer value in 'imm' field of BPF_CALL instruction selects which helper |