You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm trying to capture the packet from veth and encapsulate a new eth header to send it out by a real eth nic. As far as I know, in xdp ebpf, we can use bpf_xdp_adjust_head to do something like this. Is possible we can do it in userspace using AF_XDP? E.g. using user head room and adjust the addr of frame desc forward when we want to encapsulate a new header.
The text was updated successfully, but these errors were encountered:
ZENOTME
changed the title
Is possible to encap a header in AF_XDP
Is possible to encapsulate a new header in AF_XDP
Apr 11, 2024
It should be possible. The frame comes with a headroom by default (I can't be sure if it is 128B or 256B) so you can reference this by sending addr - (space for new headers) to process_packet() and fill in the new header there.
Another option is to push forward, so you use the same pkt pointer you get back from the example code as the start of your packet and push all the other data forward. Of course this will require a packet copy to hold the original data, which will reduce performance of your application.
Ultimately you cannot exceed your frame size and you have to keep track of you packet start offset, so that you fill in the tx descriptor correctly.
I'm trying to capture the packet from veth and encapsulate a new eth header to send it out by a real eth nic. As far as I know, in xdp ebpf, we can use
bpf_xdp_adjust_head
to do something like this. Is possible we can do it in userspace using AF_XDP? E.g. using user head room and adjust the addr of frame desc forward when we want to encapsulate a new header.The text was updated successfully, but these errors were encountered: