Topics

unknown func bpf_clone_redirect#13

Kanthi P
 

Hi,

Has anyone been able to use bpf_clone_redirect method to clone the packet and forward to different interface?

I used these programs and they work for bpf_redirect.
Now I am trying to modify these to use bpf_clone_redirect, but when I run the program I get "unknown func bpf_clone_redirect#13" error.

-       return bpf_redirect(*ifindex, 0);
+       return bpf_clone_redirect(data, *ifindex, 0);

I see bpf_clone_redirect in bpf.h, not sure what is that I am missing.


Can someone please help figure it out?

Thanks,
Kanthi

Daniel Borkmann
 

On 10/20/2018 09:03 PM, Kanthi P wrote:
Hi,

Has anyone been able to use bpf_clone_redirect method to clone the packet
and forward to different interface?

I used these programs and they work for bpf_redirect.
Now I am trying to modify these to use bpf_clone_redirect, but when I run
the program I get "unknown func bpf_clone_redirect#13" error.

- return bpf_redirect(*ifindex, 0);
+ return bpf_clone_redirect(data, *ifindex, 0);

I see bpf_clone_redirect in bpf.h, not sure what is that I am missing.

https://github.com/torvalds/linux/blob/master/samples/bpf/xdp_redirect_kern.c
https://github.com/torvalds/linux/blob/master/samples/bpf/xdp_redirect_user.c

Can someone please help figure it out?
They only work for tc/BPF program types as they are based on sk_buff and not xdp_buff.

Thanks,
Kanthi



Kanthi P
 

Thanks Daniel, will try using BPF.

Just curious to know is there any reason why it is not supported for XDP, as only redirect(without clone) is supported for XDP.

Regards,
Kanthi


On Sun, Oct 21, 2018 at 1:42 AM Daniel Borkmann <daniel@...> wrote:
On 10/20/2018 09:03 PM, Kanthi P wrote:
> Hi,
>
> Has anyone been able to use bpf_clone_redirect method to clone the packet
> and forward to different interface?
>
> I used these programs and they work for bpf_redirect.
> Now I am trying to modify these to use bpf_clone_redirect, but when I run
> the program I get "unknown func bpf_clone_redirect#13" error.
>
> -       return bpf_redirect(*ifindex, 0);
> +       return bpf_clone_redirect(data, *ifindex, 0);
>
> I see bpf_clone_redirect in bpf.h, not sure what is that I am missing.
>
> https://github.com/torvalds/linux/blob/master/samples/bpf/xdp_redirect_kern.c
> https://github.com/torvalds/linux/blob/master/samples/bpf/xdp_redirect_user.c
>
> Can someone please help figure it out?

They only work for tc/BPF program types as they are based on sk_buff and not xdp_buff.

> Thanks,
> Kanthi
>
>
>
>