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=-2.2 required=3.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_SANE_1 autolearn=no 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 79BE4C10DCE for ; Sat, 14 Mar 2020 00:12:09 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 52E522074B for ; Sat, 14 Mar 2020 00:12:09 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727669AbgCNAMI (ORCPT ); Fri, 13 Mar 2020 20:12:08 -0400 Received: from www62.your-server.de ([213.133.104.62]:56300 "EHLO www62.your-server.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726736AbgCNAMI (ORCPT ); Fri, 13 Mar 2020 20:12:08 -0400 Received: from sslproxy05.your-server.de ([78.46.172.2]) by www62.your-server.de with esmtpsa (TLSv1.2:DHE-RSA-AES256-GCM-SHA384:256) (Exim 4.89_1) (envelope-from ) id 1jCuPL-0002eS-Mi; Sat, 14 Mar 2020 01:12:03 +0100 Received: from [85.7.42.192] (helo=pc-9.home) by sslproxy05.your-server.de with esmtpsa (TLSv1.3:TLS_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1jCuPL-0000x0-8u; Sat, 14 Mar 2020 01:12:03 +0100 Subject: Re: [PATCH nf-next 3/3] netfilter: Introduce egress hook To: Pablo Neira Ayuso Cc: Lukas Wunner , Jozsef Kadlecsik , Florian Westphal , netfilter-devel@vger.kernel.org, coreteam@netfilter.org, netdev@vger.kernel.org, Martin Mares , Dmitry Safonov <0x7f454c46@gmail.com>, Thomas Graf , Alexei Starovoitov , David Miller References: <14ab7e5af20124a34a50426fd570da7d3b0369ce.1583927267.git.lukas@wunner.de> <20200313145526.ikovaalfuy7rnkdl@salvia> From: Daniel Borkmann Message-ID: <1bd50836-33c4-da44-5771-654bfb0348cc@iogearbox.net> Date: Sat, 14 Mar 2020 01:12:02 +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: <20200313145526.ikovaalfuy7rnkdl@salvia> 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.102.2/25750/Fri Mar 13 14:03:09 2020) Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org On 3/13/20 3:55 PM, Pablo Neira Ayuso wrote: > On Wed, Mar 11, 2020 at 03:05:16PM +0100, Daniel Borkmann wrote: >> On 3/11/20 12:59 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. Position the hook immediately before a packet >>> is handed to tc and then sent out on an interface, thereby mirroring the >>> ingress order. This order allows marking packets in the netfilter >>> egress hook and subsequently using the mark in tc. Another benefit of >>> this order is consistency with a lot of existing documentation which >>> says that egress tc is performed after netfilter hooks. >>> >>> Egress hooks already exist for the most common protocols, such as >>> NF_INET_LOCAL_OUT or NF_ARP_OUT, and those are to be preferred because >>> they are executed earlier during packet processing. However for more >>> exotic protocols, there is currently no provision to apply netfilter on >>> egress. A common workaround is to enslave the interface to a bridge and >> >> Sorry for late reply, but still NAK. > > I agree Lukas use-case is very specific. > > However, this is useful. > > We have plans to support for NAT64 and NAT46, this is the right spot > to do this mangling. There is already support for the tunneling But why is existing local-out or post-routing hook _not_ sufficient for NAT64 given it being IP based? > infrastructure in netfilter from ingress, this spot from egress will > allow us to perform the tunneling from here. There is also no way to > drop traffic generated by dhclient, this also allow for filtering such > locally generated traffic. And many more. This is a known fact for ~17 years [0] or probably more by now and noone from netfilter folks cared to address it in all the years, so I presume it cannot be important enough, and these days it can be filtered through other means already. Tbh, it's a bit laughable that you bring this up as an argument ... [0] https://www.spinics.net/lists/netfilter/msg19488.html > Performance impact is negligible, Lukas already provided what you > asked for. Sure, and the claimed result was "as said the fast-path gets faster, not slower" without any explanation or digging into details on why this might be, especially since it appears counter-intuitive as was stated by the author ... and later demonstrated w/ measurements that show the opposite.