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 Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 040D3C6FD1F for ; Sat, 25 Mar 2023 10:35:59 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231501AbjCYKf5 (ORCPT ); Sat, 25 Mar 2023 06:35:57 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59304 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229505AbjCYKfz (ORCPT ); Sat, 25 Mar 2023 06:35:55 -0400 Received: from orbyte.nwl.cc (orbyte.nwl.cc [IPv6:2001:41d0:e:133a::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id AC90F149AE for ; Sat, 25 Mar 2023 03:35:53 -0700 (PDT) Received: from n0-1 by orbyte.nwl.cc with local (Exim 4.94.2) (envelope-from ) id 1pg1FT-0001Kg-1Q; Sat, 25 Mar 2023 11:35:47 +0100 Date: Sat, 25 Mar 2023 11:35:47 +0100 From: Phil Sutter To: Florian Westphal Cc: Jeremy Sowden , Netfilter Devel Subject: Re: [PATCH nftables 8/8] test: py: add tests for shifted nat port-ranges Message-ID: Mail-Followup-To: Phil Sutter , Florian Westphal , Jeremy Sowden , Netfilter Devel References: <20230305101418.2233910-1-jeremy@azazel.net> <20230305101418.2233910-9-jeremy@azazel.net> <20230324225904.GB17250@breakpoint.cc> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20230324225904.GB17250@breakpoint.cc> Precedence: bulk List-ID: X-Mailing-List: netfilter-devel@vger.kernel.org On Fri, Mar 24, 2023 at 11:59:04PM +0100, Florian Westphal wrote: > Jeremy Sowden wrote: > > +ip daddr 10.0.0.1 tcp dport 55900-55910 dnat ip to 192.168.127.1:5900-5910/55900;ok > > +ip6 daddr 10::1 tcp dport 55900-55910 dnat ip6 to [::c0:a8:7f:1]:5900-5910/55900;ok > > This syntax is horrible (yes, I know, xtables fault). > > Do you think this series could be changed to grab the offset register from the > left edge of the range rather than requiring the user to specify it a > second time? Something like: > > ip daddr 10.0.0.1 tcp dport 55900-55910 dnat ip to 192.168.127.1:5900-5910 > > I'm open to other suggestions of course. Initially, a map came to mind. Something like: | dnat to : tcp dport map { 1000-2000 : 5000-6000 } To my surprise, nft accepts the syntax (listing is broken, though). But IIUC, it means "return 5000-6000 for any port in [1000;2000]" and dnat does round-robin? At least it's not what one would expect. Maybe one could control the lookup behaviour somehow via a flag? Cheers, Phil