foniod / redbpf

Rust library for building and running BPF/eBPF modules
Apache License 2.0
1.71k stars 136 forks source link

feat: add XDP example for UDP port redirect #347

Closed shaneutt closed 2 years ago

shaneutt commented 2 years ago

The purpose of this PR is to add an XDP example of redirecting ports for UDP traffic.

This is not complete, and I'm not certain that this is the best or most idiomatic way to do this yet so I'm leaving this in draft for the moment in hopes of getting some input/suggestions from the maintainers.

rsdy commented 2 years ago

This looks like a passable approach to me, if it works, that's even better. Maybe @rhdxmr has some suggestions on improving it? Regardless, I'd be happy to merge it if you find this helpful!

shaneutt commented 2 years ago

This looks like a passable approach to me, if it works, that's even better.

Thank you. I have tested this locally and it works. However I have yet to get it working with a redbpf userspace loader given the examples available in this repository. I was instead able to load and test it using the normal bpftool approach. This is why I didn't consider it complete yet.