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.

MFC after:	1 week
This commit is contained in:
Cy Schubert 2021-03-22 20:11:58 -07:00
parent 9e5aeba51b
commit 874b1a3548
3 changed files with 3 additions and 8 deletions

View File

@ -5318,9 +5318,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 {

View File

@ -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 {

View File

@ -1048,9 +1048,8 @@ ipf_proxy_check(fin, nat)
}
aps->aps_bytes += fin->fin_plen;
aps->aps_pkts++;
return 1;
}
return 0;
return 1;
}