mirror of
https://github.com/netdata/libbpf.git
synced 2026-04-06 00:29:07 +08:00
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. Signed-off-by: Yonghong Song <yhs@fb.com> Signed-off-by: Alexei Starovoitov <ast@kernel.org> Acked-by: Martin KaFai Lau <kafai@fb.com> Cc: Eric Dumazet <edumazet@google.com> Link: https://lore.kernel.org/bpf/20200623230815.3988481-1-yhs@fb.com
This commit is contained in:
committed by
Andrii Nakryiko
parent
47370741be
commit
318ed9d544
@@ -3279,6 +3279,12 @@ union bpf_attr {
|
|||||||
* Dynamically cast a *sk* pointer to a *tcp_request_sock* pointer.
|
* Dynamically cast a *sk* pointer to a *tcp_request_sock* pointer.
|
||||||
* Return
|
* Return
|
||||||
* *sk* if casting is valid, or NULL otherwise.
|
* *sk* if casting is valid, or NULL otherwise.
|
||||||
|
*
|
||||||
|
* struct udp6_sock *bpf_skc_to_udp6_sock(void *sk)
|
||||||
|
* Description
|
||||||
|
* Dynamically cast a *sk* pointer to a *udp6_sock* pointer.
|
||||||
|
* Return
|
||||||
|
* *sk* if casting is valid, or NULL otherwise.
|
||||||
*/
|
*/
|
||||||
#define __BPF_FUNC_MAPPER(FN) \
|
#define __BPF_FUNC_MAPPER(FN) \
|
||||||
FN(unspec), \
|
FN(unspec), \
|
||||||
@@ -3420,7 +3426,8 @@ union bpf_attr {
|
|||||||
FN(skc_to_tcp6_sock), \
|
FN(skc_to_tcp6_sock), \
|
||||||
FN(skc_to_tcp_sock), \
|
FN(skc_to_tcp_sock), \
|
||||||
FN(skc_to_tcp_timewait_sock), \
|
FN(skc_to_tcp_timewait_sock), \
|
||||||
FN(skc_to_tcp_request_sock),
|
FN(skc_to_tcp_request_sock), \
|
||||||
|
FN(skc_to_udp6_sock),
|
||||||
|
|
||||||
/* integer value in 'imm' field of BPF_CALL instruction selects which helper
|
/* integer value in 'imm' field of BPF_CALL instruction selects which helper
|
||||||
* function eBPF program intends to call
|
* function eBPF program intends to call
|
||||||
|
|||||||
Reference in New Issue
Block a user