From owner-dev-commits-src-branches@freebsd.org Thu Apr 1 13:26:01 2021 Return-Path: Delivered-To: dev-commits-src-branches@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id B1C2C5CE4AB; Thu, 1 Apr 2021 13:26:01 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4FB3pw1HDVz3nSB; Thu, 1 Apr 2021 13:25:58 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id ABA27592B; Thu, 1 Apr 2021 13:25:57 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 131DPvH7096167; Thu, 1 Apr 2021 13:25:57 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 131DPv7B096166; Thu, 1 Apr 2021 13:25:57 GMT (envelope-from git) Date: Thu, 1 Apr 2021 13:25:57 GMT Message-Id: <202104011325.131DPv7B096166@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Cy Schubert Subject: git: f4722627bce2 - stable/11 - MFC 874b1a35486b570513680c3d456b062ba097e1d9: MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: cy X-Git-Repository: src X-Git-Refname: refs/heads/stable/11 X-Git-Reftype: branch X-Git-Commit: f4722627bce29607179fa566c620cdda13fd96df Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commits to the stable branches of the FreeBSD src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 01 Apr 2021 13:26:01 -0000 The branch stable/11 has been updated by cy: URL: https://cgit.FreeBSD.org/src/commit/?id=f4722627bce29607179fa566c620cdda13fd96df commit f4722627bce29607179fa566c620cdda13fd96df Author: Cy Schubert AuthorDate: 2021-03-23 03:11:58 +0000 Commit: Cy Schubert CommitDate: 2021-04-01 13:23:59 +0000 MFC 874b1a35486b570513680c3d456b062ba097e1d9: ipfilter: simplify ipf_proxy_check() return codes ipf_proxy_check() returns -1 for an error and 0 or 1 for success. ipf_proxy_check()'s callers check for error and if the return code is 0, they change it to 1 prior to returning to their callers. Simply by returning -1 or 1 we reduce complexity and cycles burned changing 0 to 1. (cherry picked from commit 874b1a35486b570513680c3d456b062ba097e1d9) --- sys/contrib/ipfilter/netinet/ip_nat.c | 4 +--- sys/contrib/ipfilter/netinet/ip_nat6.c | 4 +--- sys/contrib/ipfilter/netinet/ip_proxy.c | 3 +-- 3 files changed, 3 insertions(+), 8 deletions(-) diff --git a/sys/contrib/ipfilter/netinet/ip_nat.c b/sys/contrib/ipfilter/netinet/ip_nat.c index 6c6479dd1616..d5abe81ee84d 100644 --- a/sys/contrib/ipfilter/netinet/ip_nat.c +++ b/sys/contrib/ipfilter/netinet/ip_nat.c @@ -5312,9 +5312,7 @@ ipf_nat_out(fin, nat, natadd, nflags) /* ------------------------------------------------------------- */ if ((np != NULL) && (np->in_apr != NULL)) { i = ipf_proxy_check(fin, nat); - if (i == 0) { - i = 1; - } else if (i == -1) { + if (i == -1) { NBUMPSIDED(1, ns_ipf_proxy_fail); } } else { diff --git a/sys/contrib/ipfilter/netinet/ip_nat6.c b/sys/contrib/ipfilter/netinet/ip_nat6.c index 921eefc0ea3f..baa3c302504a 100644 --- a/sys/contrib/ipfilter/netinet/ip_nat6.c +++ b/sys/contrib/ipfilter/netinet/ip_nat6.c @@ -2976,9 +2976,7 @@ ipf_nat6_out(fin, nat, natadd, nflags) /* ------------------------------------------------------------- */ if ((np != NULL) && (np->in_apr != NULL)) { i = ipf_proxy_check(fin, nat); - if (i == 0) { - i = 1; - } else if (i == -1) { + if (i == -1) { NBUMPSIDE6D(1, ns_ipf_proxy_fail); } } else { diff --git a/sys/contrib/ipfilter/netinet/ip_proxy.c b/sys/contrib/ipfilter/netinet/ip_proxy.c index b4773bb6f358..87051b6e6839 100644 --- a/sys/contrib/ipfilter/netinet/ip_proxy.c +++ b/sys/contrib/ipfilter/netinet/ip_proxy.c @@ -1048,9 +1048,8 @@ ipf_proxy_check(fin, nat) } aps->aps_bytes += fin->fin_plen; aps->aps_pkts++; - return 1; } - return 0; + return 1; }