History

bpf: Add bpf_skc_to_mptcp_sock_proto

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)

Geliang Tang committed 4 years ago

Commit 3bc253c1 parent 7aa424e11 files · +69 −1Browse files

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

Unified · Split

include/uapi/linux/bpf.h+7−0
@@ -5172,6 +5172,12 @@ union bpf_attr { · 5171 unmodified lines
51725172 * Return
51735173 * Map value associated to *key* on *cpu*, or **NULL** if no entry
51745174 * 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.
51755181 */
51765182 #define __BPF_FUNC_MAPPER(FN) \
51775183 FN(unspec), \
@@ -5370,6 +5376,7 @@ union bpf_attr { · 192 unmodified lines
53705376 FN(ima_file_hash), \
53715377 FN(kptr_xchg), \
53725378 FN(map_lookup_percpu_elem), \
5379+ FN(skc_to_mptcp_sock), \
53735380 /* */
53745381
53755382 /* integer value in 'imm' field of BPF_CALL instruction selects which helper