Received: by 2002:a05:6a10:eb17:0:0:0:0 with SMTP id hx23csp255923pxb; Tue, 7 Sep 2021 23:56:33 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxbPii+cx7en7jl7wnCfCbfRBufhkcqNeGCyV/UStPoNLfsD4od/7dlm5D5WwlUHKN0Kzef X-Received: by 2002:a05:6402:1bd1:: with SMTP id ch17mr2306652edb.99.1631084193401; Tue, 07 Sep 2021 23:56:33 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1631084193; cv=none; d=google.com; s=arc-20160816; b=l30Za8MSCBIlFvTpvT4xwuLOvznwKhD72xmgGnCRvmXqK2CF+LJKCMKDQvPoeZtkxj qMAZmpFFnDPOjVM6y/cuIMCO4jqlQYsdWo5iVsWDAlXDJ4Fh/4PEDw2NAdzxSvdPItfF fUxkVlvkfuqM5WFCGE4EH6FDi4V/mogHM5MOyzJZbbW3RsrLWTogpF+SatmyJILfcaLy OJnuWBJJYv/68Q9HbXAHc2auoo9yQyItrPevCcuTHrOccYl0m/edMSYz50cRSkOju/13 AmK0uC5D8v/dSCNJXAWHT6Bel4n8RSe3bp9Z3WxdHC7WDOezsfSlDk1D8/g8ucjH5t3F 3ceg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:user-agent:references:message-id :in-reply-to:subject:cc:to:from:date; bh=cTA0d3mxP8tO66ncbQhXNL+30ouHWk/hSpHQ3g5xv3k=; b=YLZAj8HhsxpxGztEz7R2u6qTMQXdeQZH7dG1XgedFZs/557TjzvQaKMxemKMdV6mCD /bpHgADUZSZnNkA3pvlF6MCssIKKHE71DcSx7diJisTTe/QFT0+hHWzZ+JLfzl4NB4ps FpHgWSBEyJ1JA7vEc4ZVFd801RgNGSJtvUeAX9QU8436/7Qiex47gg5foy6ADK//8NYe q6bflneOFQF4gmAFjL6Ba81jGJnW/fOWuDhcH39JMAKBNIBtCtYnmTJjf2H0WQvvqT7c 61UI8Bq3FksPFekKx3OMcCqbQGKYwpNOfS1dT/a2GugVVTLZKjdf4+iPf7MeXBxAmPNV PYCA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id l4si1451363ejo.650.2021.09.07.23.56.02; Tue, 07 Sep 2021 23:56:33 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1347898AbhIHGyD (ORCPT + 99 others); Wed, 8 Sep 2021 02:54:03 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39492 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1347867AbhIHGx6 (ORCPT ); Wed, 8 Sep 2021 02:53:58 -0400 Received: from a3.inai.de (a3.inai.de [IPv6:2a01:4f8:10b:45d8::f5]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id BAF5FC061575; Tue, 7 Sep 2021 23:52:50 -0700 (PDT) Received: by a3.inai.de (Postfix, from userid 25121) id 18D675871A455; Wed, 8 Sep 2021 08:52:49 +0200 (CEST) Received: from localhost (localhost [127.0.0.1]) by a3.inai.de (Postfix) with ESMTP id 14AE660DD5B27; Wed, 8 Sep 2021 08:52:49 +0200 (CEST) Date: Wed, 8 Sep 2021 08:52:49 +0200 (CEST) From: Jan Engelhardt To: Duncan Roe cc: Florian Westphal , Cole Dishington , pablo@netfilter.org, kadlec@netfilter.org, davem@davemloft.net, kuba@kernel.org, shuah@kernel.org, linux-kernel@vger.kernel.org, netfilter-devel@vger.kernel.org, coreteam@netfilter.org, netdev@vger.kernel.org, Anthony Lineham , Scott Parlane , Blair Steven Subject: Re: [PATCH net v2] net: netfilter: Fix port selection of FTP for NF_NAT_RANGE_PROTO_SPECIFIED In-Reply-To: Message-ID: <4o2rqroo-orpr-1so2-4s5n-o1pn8no16553@vanv.qr> References: <20210907021415.962-1-Cole.Dishington@alliedtelesis.co.nz> <20210907135458.GF23554@breakpoint.cc> User-Agent: Alpine 2.24 (LSU 510 2020-10-10) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wednesday 2021-09-08 04:22, Duncan Roe wrote: >> >Either use if (nat->range_info.min_proto.all || ... >> > >> >or use ntohs(). I will leave it up to you if you prefer >> >ntohs(nat->range_info.min_proto.all) == 0 or >> >nat->range_info.min_proto.all == ntohs(0). >> >> If one has the option, one should always prefer to put htons/htonl on >> the side with the constant literal; >> Propagation of constants and compile-time evaluation is the target. >> >> That works for some other functions as well (e.g. >> strlen("fixedstring")). > >When comparing against constant zero, why use htons/htonl at all? Logical correctness. Remember, it was the sparse tool that complained in the first place.