xdp-project / xdp-tutorial

XDP tutorial
2.49k stars 579 forks source link

AF_XDP based packet sending #244

Open Adarsh97 opened 3 years ago

Adarsh97 commented 3 years ago

Any example program for af_xdp socket based packet sending with xdp, here packet can be raw ip packet (packet with ip and UDP header) or any other packets ?

tohojo commented 3 years ago

Adarsh Sunilkumar @.***> writes:

Any example program for af_xdp socket based packet sending with xdp, here packet can be raw ip packet (packet with ip and UDP header) or any other packets ?

Have a look at the 'xdpsock' sample in samples/bpf in the kernel source tree...

Adarsh97 commented 3 years ago

Thanks for suggesting that. So with af_xdp I can only send a complete packet(a packet with UDP, ip and ethernet headers) ? Anyway is there I can send ip packet, with ethernet header will be taken care by kernel or someone ?

tohojo commented 3 years ago

Adarsh Sunilkumar @.***> writes:

Thanks for suggesting that. So with af_xdp I can only send a complete packet(a packet with UDP, ip and ethernet headers) ? Anyway is there I can send ip packet, with ethernet header will be taken care by kernel or someone ?

No, that would be one of the features provided by the stack (and thus bypassed by AF_XDP) :)