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 -- Best regards, Jesper Dangaard Brouer MSc.CS, Principal Kernel Engineer at Red Hat LinkedIn: http://www.linkedin.com/in/brouer google keywords: tc qdisc clsact cls_bpf egress filter