From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-5.2 required=3.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED, USER_AGENT_SANE_1 autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 785DCCA9ECB for ; Thu, 31 Oct 2019 22:40:08 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 5817820873 for ; Thu, 31 Oct 2019 22:40:08 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729347AbfJaWkE (ORCPT ); Thu, 31 Oct 2019 18:40:04 -0400 Received: from www62.your-server.de ([213.133.104.62]:41146 "EHLO www62.your-server.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726506AbfJaWkE (ORCPT ); Thu, 31 Oct 2019 18:40:04 -0400 Received: from sslproxy01.your-server.de ([88.198.220.130]) by www62.your-server.de with esmtpsa (TLSv1.2:DHE-RSA-AES256-GCM-SHA384:256) (Exim 4.89_1) (envelope-from ) id 1iQJ6m-0003Q3-5I; Thu, 31 Oct 2019 23:40:00 +0100 Received: from [178.197.249.38] (helo=pc-63.home) by sslproxy01.your-server.de with esmtpsa (TLSv1.2:ECDHE-RSA-AES256-GCM-SHA384:256) (Exim 4.89) (envelope-from ) id 1iQJ6l-0004Nw-QI; Thu, 31 Oct 2019 23:39:59 +0100 Subject: Re: [PATCH nf-next,RFC 5/5] netfilter: Introduce egress hook To: Lukas Wunner Cc: Pablo Neira Ayuso , Jozsef Kadlecsik , Florian Westphal , netfilter-devel@vger.kernel.org, coreteam@netfilter.org, netdev@vger.kernel.org, Martin Mares References: From: Daniel Borkmann Message-ID: Date: Thu, 31 Oct 2019 23:39:58 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.7.2 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit X-Authenticated-Sender: daniel@iogearbox.net X-Virus-Scanned: Clear (ClamAV 0.101.4/25619/Thu Oct 31 09:55:29 2019) Sender: netfilter-devel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netfilter-devel@vger.kernel.org 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 > Cc: Daniel Borkmann