xdp-tutorial
xdp-tutorial copied to clipboard
Question about XDP_REDIRECT
Hello everybody,
I'm new to the XDP world and have a question about redirecting to other interfaces in XDP. The two functions bpf_redirect_map () and bpf_redirect () only takes one interface as an argument. In my case I want to redirect the frame from one ingress port to several egress ports at the same time. Is it possible ?
Thanks in Advance !
Achraf Aroua [email protected] writes:
Hello everybody,
I'm new to the XDP world and have a question about redirecting to other interfaces in XDP. The two functions bpf_redirect_map () and bpf_redirect () only takes one interface as an argument. In my case I want to redirect the frame from one ingress port to several egress ports at the same time. Is it possible ?
Not yet, but it's being worked on: https://lore.kernel.org/bpf/[email protected]/
Do you know any other workaround I can use at the moment?
Achraf Aroua [email protected] writes:
Do you know any other workaround I can use at the moment?
You can XDP_PASS packets and handle the cloning in the regular stack...
Firstly, you should use XDP_PASS to pass the packet to higher stack. After that, using tc mirred, and use sub module pedit to change "correct" destination mac address, unless you will overflow all port of your switch.
Note also that the support for duplicating packets on XDP_REDIRECT has landed in the kernel as of kernel 5.14. See this commit for the sample that uses it: https://git.kernel.org/torvalds/c/e48cfe4bbfad