Re: Using AF_XDP To Modify Outgoing Packets

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

 



Hey Jesper,


Thank you for the information and examples! They helped a lot!


I've started developing the TC egress program today and I have it nearly finished. For some reason, when I modify the source address of the inner IP header after removing the outer IP header, the packet is never received from the destination host after returning 'TC_ACT_OK'. I did a tcpdump and can see the packets with the changed source IP along with all the checksums being calculated properly. They also have the correct MAC addresses in the Ethernet header. I plan to continue looking into it tomorrow and to my understanding, this mailing list is for XDP-specific threads. Therefore, I'll probably be creating a thread on the BPF mailing list if I can't figure things out (I didn't see any TC-specific mailing list).


I just wanted to thank everyone who has replied for the information and help! I really appreciate it.


On 4/1/2020 4:55 AM, Jesper Dangaard Brouer wrote:
On Tue, 31 Mar 2020 18:22:53 -0500
Christian Deacon <gamemann@xxxxxxxxxxx> wrote:

After looking into the TC Hook, it looks like this will work for my
case. I'll try to get a program made in the next few days or so.
If you want code examples of TC egress hook with BPF look at[1]:
  [1] https://github.com/xdp-project/xdp-cpumap-tc/

Notice that map pinning with libbpf have gotten easier (thanks to
Toke). This example does work (runs in production), it shares and reuse
maps between XDP and TC-bpf.  The example uses the old way to define
maps, and I recommend switching to the new BTF-based syntax instead
(requires LLVM 10), which defines ".maps" SEC, see example[2], and
notice "pinning" option, which obsoletes a lot of the map code in[1].

Attaching TC-bpf progs are different that XDP.  I've hidden the detail
in C-code function tc_egress_attach_bpf() (see[3]), which actually just
calls the "tc" command.  I was hoping that this would be replaced with a
libbpf call, like we have for XDP, but that have not happened.


[2] https://github.com/xdp-project/xdp-tools/blob/master/xdp-filter/xdpfilt_prog.h#L124-L131
[3] https://github.com/xdp-project/xdp-cpumap-tc/blob/master/src/common_user.c#L386



[Index of Archives]     [Linux Networking Development]     [Fedora Linux Users]     [Linux SCTP]     [DCCP]     [Gimp]     [Yosemite Campsites]

  Powered by Linux