Comments (1)
Thanks Lukas and sorry for late reply,
Check out this diagram: https://upload.wikimedia.org/wikipedia/commons/3/37/Netfilter-packet-flow.svg
An XDP BPF program gets executed only on the receive path, very early on, e.g. before an SKB gets allocated, it does not get executed on the transmit path (e.g. when a locally running application sends something).
Theoretically, you can modify the port in XDP BPF, but then you'd also probably need to fix up the checksums - I'm not sure this is possible, there are bpf-helpers(8) to do that, but they assume an SKB and so cannot be used in XDP BPF.
Perhaps what you're looking for are the tc-bpf(8). They can be hooked on both receive and transmit paths, and you could track the state of IP+port translations with BPF maps. On the diagram above, the ingress/egress qdisc is where tc-bpf(8) can be attached. The manpage actually has an example of port redirection.
Hope this helps, best of luck with the project!
from xdp.
Related Issues (18)
- Allowing offset into frame HOT 1
- Q: what is the correct way to use this for RX and TX at the same time? HOT 4
- xsk stats report Tx_ring_empty_descs when change argument of GetDescs()
- Q: Attach xdp program to interface raises "cannot allocate memory" HOT 4
- xdp_pass
- error HOT 1
- Filter based on the value of a specific byte
- how to do example rate limiting of ip based on this?
- At high throughput receiving same packet twice at expense of another packet disappearing altogether.
- how do also listen to a specific port and forward to another application port based on ip address? HOT 1
- possible to provide example for tcp and ipv6 together?
- getting error for ubuntu 22.04, golang 1.19 go build sendudp.go
- Detaching program hangs when using SKB mode
- map xdp_stats_map: pin by name: missing MapOptions.PinPath
- Memory allocations on Rx/Tx paths limit maximum performance
- Review "kernel kick" code
- examples/sendudp stuck at Poll() after a while HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from xdp.