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
32793279 * Dynamically cast a *sk* pointer to a *tcp_request_sock* pointer.
32803280 * Return
32813281 * *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.
32823288 */
32833289 #define __BPF_FUNC_MAPPER(FN) \
32843290 FN(unspec), \
@@ -3420,7 +3426,8 @@ union bpf_attr { · 135 unmodified lines
34203426 FN(skc_to_tcp6_sock), \
34213427 FN(skc_to_tcp_sock), \
34223428 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),
34243431
34253432 /* integer value in 'imm' field of BPF_CALL instruction selects which helper
34263433 * function eBPF program intends to call