bpf_skb_adjust_room after L4 header?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi,

I am currently facing a checksums issue when attempting to insert a custom 4 Byte header between a L4/UDP header and the payload using a TC BPF egress filter.
The goal is to use an eBPF program to transparently push/pop a TURN ChannelData message header from the UDP payload [1].

So far, I have tried to accomplish this with the bpf_skb_adjust_room(..., BPF_ADJ_ROOM_NET) helper by adding some room between after the IP header and manually shifting the UDP header to the newly gained space.

This works when TX checksum offloading is disabled. However, with TX checksum offloading the skb->transport_header is wrong as it has not been adjusted. This also causes to skb->csum_offset to point to the wrong place. 

I guess ideally, we would extend bpf_skb_adjust_room with a new flag value BPF_ADJ_ROOM_TRANSPORT?

XDP is not an option as we also need the eBPF to process the egress path.
Maybe the helpers bpf_skb_change_{head,tail}() might work? But I am concerned about the performance impact caused by a memmove() of the UDP payload just for making new space in the front of the payload.

Or are there any other ways of pushing a header between the L4 header and its payload while properly adjusting the header offsets in the SKB?

Best regards,
Steffen

[1] https://datatracker.ietf.org/doc/html/rfc8656#section-12.4

The problem has also been covered here: https://github.com/cilium/ebpf/issues/339
And there is also feature request for the coturn TURN server: https://github.com/coturn/coturn/issues/759






[Index of Archives]     [Linux Samsung SoC]     [Linux Rockchip SoC]     [Linux Actions SoC]     [Linux for Synopsys ARC Processors]     [Linux NFS]     [Linux NILFS]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]


  Powered by Linux