Three more helpers are added to cast a sock_common pointer to an tcp_sock, tcp_timewait_sock or a tcp_request_sock for tracing programs.
Showing the changes to include/uapi/linux (1 of 6 files). Show all
Unified · Split
| @@ -3261,6 +3261,24 @@ union bpf_attr { · 3260 unmodified lines | ||
| 3261 | 3261 | * Dynamically cast a *sk* pointer to a *tcp6_sock* pointer. |
| 3262 | 3262 | * Return |
| 3263 | 3263 | * *sk* if casting is valid, or NULL otherwise. |
| 3264 | + * | |
| 3265 | + * struct tcp_sock *bpf_skc_to_tcp_sock(void *sk) | |
| 3266 | + * Description | |
| 3267 | + * Dynamically cast a *sk* pointer to a *tcp_sock* pointer. | |
| 3268 | + * Return | |
| 3269 | + * *sk* if casting is valid, or NULL otherwise. | |
| 3270 | + * | |
| 3271 | + * struct tcp_timewait_sock *bpf_skc_to_tcp_timewait_sock(void *sk) | |
| 3272 | + * Description | |
| 3273 | + * Dynamically cast a *sk* pointer to a *tcp_timewait_sock* pointer. | |
| 3274 | + * Return | |
| 3275 | + * *sk* if casting is valid, or NULL otherwise. | |
| 3276 | + * | |
| 3277 | + * struct tcp_request_sock *bpf_skc_to_tcp_request_sock(void *sk) | |
| 3278 | + * Description | |
| 3279 | + * Dynamically cast a *sk* pointer to a *tcp_request_sock* pointer. | |
| 3280 | + * Return | |
| 3281 | + * *sk* if casting is valid, or NULL otherwise. | |
| 3264 | 3282 | */ |
| 3265 | 3283 | #define __BPF_FUNC_MAPPER(FN) \ |
| 3266 | 3284 | FN(unspec), \ |
| @@ -3399,7 +3417,10 @@ union bpf_attr { · 132 unmodified lines | ||
| 3399 | 3417 | FN(ringbuf_discard), \ |
| 3400 | 3418 | FN(ringbuf_query), \ |
| 3401 | 3419 | FN(csum_level), \ |
| 3402 | − FN(skc_to_tcp6_sock), | |
| 3420 | + FN(skc_to_tcp6_sock), \ | |
| 3421 | + FN(skc_to_tcp_sock), \ | |
| 3422 | + FN(skc_to_tcp_timewait_sock), \ | |
| 3423 | + FN(skc_to_tcp_request_sock), | |
| 3403 | 3424 | |
| 3404 | 3425 | /* integer value in 'imm' field of BPF_CALL instruction selects which helper |
| 3405 | 3426 | * function eBPF program intends to call |