4 ms·
Is eBPF directly able to perform simple modifications of the data or only analyze and customize forwarding? E.g. if I had a custom packet encapsulation format I
by zamadatix 5y ago
Is eBPF directly able to perform simple modifications of the data or only analyze and customize forwarding? E.g. if I had a custom packet encapsulation format I wanted to remap into another encapsulation format of a similar type I'm pretty sure I can use XDP to forward packets that match a userspace program which can then zero-copy modify the contents but at that point it seems to have lost a lot of the luster compared to a kernel module as I'm hopping back and forth between kernelspace and userspace. I'm not sure if that is a limitation of just reading about XDP a lot because dropping packets/load balancing is more popular and I just need to look elsewhere in eBPF or if it's actually a limitation of eBPF itself.
- sophacles 5y agoYes you can do modifications. (simple and not so simple!). For encapsulation you may want to look into lightweight tunnels. General transformation also often happens in the tc subsystem. The available documentation isn't that great yet, but there's good links in the OP about this.
- tptacek 5y agoWe use XDP for our UDP forwarding data path, encapsulating and decapsulating packets along the way in a custom frame: https://fly.io/blog/bpf-xdp-packet-filters-and-udp/ https://fly.io/blog/bpf-xdp-packet-filters-and-udp/
- kasey_junk 5y agoDo you ever worry about issues with your hosting company? Like missing out on router optimizations and the like on the underlying network because of your bespoke framing?
- tptacek 5y agoWell, I wasn't a minute ago.
- kasey_junk 5y agoWell I guess we’ve proven I’m not the only one susceptible to “OSI model error Eldritch Dread”
- tptacek 5y agoHonestly though it's all a moot point for us, since no matter how we encapsulate, all our server-server traffic (TCP, UDP, or otherwise) is over WireGuard, which is itself UDP.