Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id D0F9AC4332F for ; Fri, 9 Dec 2022 00:25:43 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229521AbiLIAZl (ORCPT ); Thu, 8 Dec 2022 19:25:41 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56232 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229592AbiLIAZk (ORCPT ); Thu, 8 Dec 2022 19:25:40 -0500 Received: from orbyte.nwl.cc (orbyte.nwl.cc [IPv6:2001:41d0:e:133a::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C69957286B for ; Thu, 8 Dec 2022 16:25:39 -0800 (PST) Received: from n0-1 by orbyte.nwl.cc with local (Exim 4.94.2) (envelope-from ) id 1p3RCs-0002zb-2R; Fri, 09 Dec 2022 01:25:38 +0100 Date: Fri, 9 Dec 2022 01:25:38 +0100 From: Phil Sutter To: Pablo Neira Ayuso Cc: netfilter-devel@vger.kernel.org, Florian Westphal Subject: Re: [iptables PATCH 4/7] nft: Fix match generator for '! -i +' Message-ID: Mail-Followup-To: Phil Sutter , Pablo Neira Ayuso , netfilter-devel@vger.kernel.org, Florian Westphal References: <20221201163916.30808-1-phil@nwl.cc> <20221201163916.30808-5-phil@nwl.cc> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: Precedence: bulk List-ID: X-Mailing-List: netfilter-devel@vger.kernel.org On Thu, Dec 08, 2022 at 09:31:56PM +0100, Pablo Neira Ayuso wrote: > On Thu, Dec 08, 2022 at 02:19:46PM +0100, Phil Sutter wrote: > > On Thu, Dec 08, 2022 at 01:23:56PM +0100, Pablo Neira Ayuso wrote: > > > On Thu, Dec 01, 2022 at 05:39:13PM +0100, Phil Sutter wrote: > > > > It's actually nonsense since it will never match, but iptables accepts > > > > it and the resulting nftables rule must behave identically. Reuse the > > > > solution implemented into xtables-translate (by commit e179e87a1179e) > > > > and turn the above match into 'iifname INVAL/D'. > > > > > > Maybe starting bailing out in iptables-nft when ! -i + is used at > > > ruleset load time? > > > > > > As you mentioned, this rule is really useless / never matching. > > > > Are you fine with doing it in legacy, too? > > Have you seen any autogenerated ruleset using this silly ! -i + that > might easily break? Or you are just being conservative while keeping > this around? The latter: I was fixing for '-i +' which is legal in iptables but 'iifname "*"' in nftables is not and I also had to find a way to translate it correctly if inverted. In theory neither '-i +' nor '! -i +' make sense, from my perspective we could reject both. Or only the latter since it seems even more bogus than the former. I was asking about legacy because I really think we should not change iptables-nft in a way we wouldn't with legacy. At least rejecting rulesets which worked fine with legacy is a no go. Cheers, Phil