On 10/31/19 2:41 PM, Lukas Wunner wrote:
Commit e687ad60af09 ("netfilter: add netfilter ingress hook after handle_ing() under unique static key") introduced the ability to classify packets on ingress. Allow the same on egress. The need for this arose because I had to filter egress packets which do not match a specific ethertype. The most common solution appears to be
This seems like a /very/ weak justification for something that sits in critical fastpath. NAK.
to enslave the interface to a bridge and use ebtables, but that's cumbersome to configure and comes with a (small) performance penalty. An alternative approach is tc, but that doesn't afford equivalent matching options as netfilter.
Hmm, have you tried tc BPF on the egress hook (via sch_cls_act -> cls_bpf)?
people have expressed a desire for egress filtering in the past: https://www.spinics.net/lists/netfilter/msg50038.html
Adding another hook to catch misconfigurations of NAT in postrouting ...?
https://unix.stackexchange.com/questions/512371
This talks about filtering / limiting ARP packets which can be done today easily with existing means, including writing ARP responders sitting on tc ingress/egress hook.
An egress hook therefore seems like an obvious addition. Signed-off-by: Lukas Wunner <lukas@xxxxxxxxx> Cc: Daniel Borkmann <daniel@xxxxxxxxxxxxx>