-
Notifications
You must be signed in to change notification settings - Fork 5
bpf: add icmp_send_unreach kfunc #5648
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
bpf: add icmp_send_unreach kfunc #5648
Conversation
|
Upstream branch: 5345e64 |
6978e3e to
1661322
Compare
|
Upstream branch: 5b4c54a |
40ec30e to
db34d08
Compare
1661322 to
6217ef6
Compare
|
Upstream branch: cd7c97f |
Move and rename nf_reject_fill_skb_dst from ipv4/netfilter/nf_reject_ipv4 to ip_route_reply_fetch_dst in ipv4/route.c so that it can be reused in the following patches by BPF kfuncs. Netfilter uses nf_ip_route that is almost a transparent wrapper around ip_route_output_key so this patch inlines it. Signed-off-by: Mahe Tardy <[email protected]>
Move and rename nf_reject6_fill_skb_dst from ipv6/netfilter/nf_reject_ipv6 to ip6_route_reply_fetch_dst in ipv6/route.c so that it can be reused in the following patches by BPF kfuncs. Netfilter uses nf_ip6_route that is almost a transparent wrapper around ip6_route_outputy so this patch inlines it. Signed-off-by: Mahe Tardy <[email protected]>
This is needed in the context of Tetragon to provide improved feedback (in contrast to just dropping packets) to east-west traffic when blocked by policies using cgroup_skb programs. This reuse concepts from netfilter reject target codepath with the differences that: * Packets are cloned since the BPF user can still return SK_PASS from the cgroup_skb progs and the current skb need to stay untouched (cgroup_skb hooks only allow read-only skb payload). * Since cgroup_skb programs are called late in the stack, checksums do not need to be computed or verified, and IPv4 fragmentation does not need to be checked (ip_local_deliver should take care of that earlier). Signed-off-by: Mahe Tardy <[email protected]>
This test opens a server and client, attach a cgroup_skb program on egress and calls the icmp_send_unreach function from the client egress so that an ICMP unreach control message is sent back to the client. It then fetches the message from the error queue to confirm the correct ICMP unreach code has been sent. Note that the BPF program returns SK_PASS to let the connection being established to finish the test cases quicker. Otherwise, you have to wait for the TCP three-way handshake to timeout in the kernel and retrieve the errno translated from the unreach code set by the ICMP control message. Signed-off-by: Mahe Tardy <[email protected]>
db34d08 to
940a143
Compare
|
At least one diff in series https://patchwork.kernel.org/project/netdevbpf/list/?series=986364 expired. Closing PR. |
Pull request for series with
subject: bpf: add icmp_send_unreach kfunc
version: 3
url: https://patchwork.kernel.org/project/netdevbpf/list/?series=986364