Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 1 Apr 2021 13:25:46 GMT
From:      Cy Schubert <cy@FreeBSD.org>
To:        src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org
Subject:   git: 671c492e884a - stable/12 - MFC 874b1a35486b570513680c3d456b062ba097e1d9:
Message-ID:  <202104011325.131DPkC1096033@gitrepo.freebsd.org>

next in thread | raw e-mail | index | archive | help
The branch stable/12 has been updated by cy:

URL: https://cgit.FreeBSD.org/src/commit/?id=671c492e884ad51d7fed89c14fd5eb48d5a9567d

commit 671c492e884ad51d7fed89c14fd5eb48d5a9567d
Author:     Cy Schubert <cy@FreeBSD.org>
AuthorDate: 2021-03-23 03:11:58 +0000
Commit:     Cy Schubert <cy@FreeBSD.org>
CommitDate: 2021-04-01 13:24:11 +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 6fdc006e88f0..bbf78877249c 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;
 }
 
 



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202104011325.131DPkC1096033>