bpf_msg_redirect_map, bpf_msg_apply_bytes, bpf_msg_cork_bytes, bpf_msg_pull_data, bpf_msg_redirect_hash, bpf_get_current_cgroup_id, bpf_map_push_elem, bpf_map_pop_elem, bpf_map_elem, bpf_msg_push_data, bpf_msg_pop_data, bpf_spin_lock, bpf_spin_unlock, bpf_strtol, b...
BPF_PROG_TYPE_SK_MSG : BPF_FUNC_msg_redirect_map() BPF_FUNC_msg_redirect_hash() BPF_FUNC_msg_apply_bytes() BPF_FUNC_msg_cork_bytes() BPF_FUNC_msg_pull_data() BPF_FUNC_msg_push_data() BPF_FUNC_msg_pop_data() Base functions 12. 原始跟踪点程序 程序能够提供内核执行任务的更多信息...
bpf_skb_get_tunnel_key, bpf_skb_set_tunnel_key, bpf_skb_get_tunnel_opt, bpf_skb_set_tunnel_opt, bpf_redirect, bpf_clone_redirect, bpf_skb_change_tail, bpf_skb_change_head, bpf_skb_store_bytes, bpf_csum_update, bpf_l3_csum_replace, bpf_l4_csum_replace, bpf_set_hash_invalid are ...
REDIRECT_BPF='./tc_l2_redirect_kern.o' RP_FILTER=$(< /proc/sys/net/ipv4/conf/all/rp_filter) IPV6_DISABLED=$(< /proc/sys/net/ipv6/conf/all/disable_ipv6) IPV6_FORWARDING=$(< /proc/sys/net/ipv6/conf/all/forwarding) function config_common { @@ -64,6 +65,7 @@ function config...
func_id!=BPF_FUNC_msg_redirect_hash) 21672168 gotoerror; 21682169 break; 2170+ caseBPF_MAP_TYPE_REUSEPORT_SOCKARRAY: 2171+ if(func_id!=BPF_FUNC_sk_select_reuseport) 2172+ gotoerror; 2173+ break; 21692174 default: 21702175 break;
第二部分就需要 BPF_PROG_TYPE_SK_MSG 来做了,因为在建连的时候,套接字的主动建连方和被动建连方已经将 socket 信息存到 sockmap 里了,因此在发送端发送数据时,如果判断出 sockmap 中有 socket 信息,说明被动建连方是本机,直接使用 msg_redirect_hash 函数,将数据重定向过去,从而不经过内核栈,整个过程如下...
bpf_msg_redirect_map, bpf_msg_apply_bytes、bpf_msg_cork_bytes、bpf_msg_pull_data、bpf_bind、bpf_xdp_adjust_tail、bpf_skb_get_xfrm_state、bpf_get_stack、bpf_skb_load_bytes_reativel bpf_fib_lookup、bpf_sock_hash_update、bpf_msg_redirect_hash、bpf_sk_redirect_hash、bpf_lwt_push_...
bpf_skb_get_tunnel_key, bpf_skb_set_tunnel_key, bpf_skb_get_tunnel_opt, bpf_skb_set_tunnel_opt, bpf_redirect, bpf_clone_redirect, bpf_skb_change_tail, bpf_skb_change_head, bpf_skb_store_bytes, bpf_csum_update, bpf_l3_csum_replace, bpf_l4_csum_replace, bpf_set_hash_invalid are ...
case TCX_REDIRECT: return code; case TCX_NEXT: default: return TCX_NEXT; } } #endif /* CONFIG_NET_XGRESS */ #if defined(CONFIG_NET_XGRESS) && defined(CONFIG_BPF_SYSCALL) int tcx_prog_attach(const union bpf_attr *attr, struct bpf_prog *prog); int tcx_link_attach(const union bpf...
- Ensure that internal and user-facing bpf_redirect flags don't overlap (Toke Høiland-Jørgensen) - Switch to use kvzmalloc to allocate BPF verifier environment (Rik van Riel) - Use raw_spinlock_t in BPF ringbuf to fix a sleep in atomic splat ...