hi_glenn
hi_glenn

Reputation: 67

eBPF: TC on egress how to recognize and ignore the packet that is replied by TC on ingress directly?

The TC on egress unexpectedly catch the packet that TC on ingress replied directly.

TC on egress how to recognize and ignore the packet that is by TC repled on ingress directly rather than produced by userspace app?

Upvotes: 1

Views: 779

Answers (1)

Qeole
Qeole

Reputation: 9134

One simple solution would be to mark your packet from your first program (on the ingress side), and then to look up for the mark on the egress side.

You could mark your packet on the ingress side by writing either to the skb->mark or one of the cb fields in your eBPF program, such as skb->cb[0]. You can later read from the same fields in your egress program.

The mark field (generic packet mark) of the socket buffer is used by applications to mark a packet (iptables may use it for some use cases, for example). The five entries in the cb (control buffer) array are also free to use by applications, to pass user-defined marks or values.

Upvotes: 1

Related Questions