History

bpf: Add bpf_skc_to_udp6_sock() helper

The helper is used in tracing programs to cast a socket pointer to a udp6_sock pointer. The return value could be NULL if the casting is illegal.

Yonghong Song committed 6 years ago

Commit 0d4fad31 parent 5788b3a6 files · +43 −2Browse files

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

Unified · Split

include/uapi/linux/bpf.h+8−1
@@ -3279,6 +3279,12 @@ union bpf_attr { · 3278 unmodified lines
3279 * Dynamically cast a *sk* pointer to a *tcp_request_sock* pointer.3279 * Dynamically cast a *sk* pointer to a *tcp_request_sock* pointer.
3280 * Return3280 * Return
3281 * *sk* if casting is valid, or NULL otherwise.3281 * *sk* if casting is valid, or NULL otherwise.
3282 *
3283 * struct udp6_sock *bpf_skc_to_udp6_sock(void *sk)
3284 * Description
3285 * Dynamically cast a *sk* pointer to a *udp6_sock* pointer.
3286 * Return
3287 * *sk* if casting is valid, or NULL otherwise.
3282 */3288 */
3283#define __BPF_FUNC_MAPPER(FN) \3289#define __BPF_FUNC_MAPPER(FN) \
3284 FN(unspec), \3290 FN(unspec), \
@@ -3420,7 +3426,8 @@ union bpf_attr { · 135 unmodified lines
3420 FN(skc_to_tcp6_sock), \3426 FN(skc_to_tcp6_sock), \
3421 FN(skc_to_tcp_sock), \3427 FN(skc_to_tcp_sock), \
3422 FN(skc_to_tcp_timewait_sock), \3428 FN(skc_to_tcp_timewait_sock), \
3423 FN(skc_to_tcp_request_sock),3429 FN(skc_to_tcp_request_sock), \
3430 FN(skc_to_udp6_sock),
3424 3431
3425/* integer value in 'imm' field of BPF_CALL instruction selects which helper3432/* integer value in 'imm' field of BPF_CALL instruction selects which helper
3426 * function eBPF program intends to call3433 * function eBPF program intends to call