Giter Site home page Giter Site logo

Redirecting to another port about xdp HOT 1 OPEN

asavie avatar asavie commented on May 22, 2024
Redirecting to another port

from xdp.

Comments (1)

slavc avatar slavc commented on May 22, 2024

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)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.