git: fdf2f69042fa - stable/13 - ipfilter: Avoid more null if-then-else blocks

From: Cy Schubert <cy_at_FreeBSD.org>
Date: Thu, 09 Dec 2021 18:59:02 UTC
The branch stable/13 has been updated by cy:

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

commit fdf2f69042fa915b44e5faad3c618b3eb27878f8
Author:     Cy Schubert <cy@FreeBSD.org>
AuthorDate: 2021-10-20 03:11:40 +0000
Commit:     Cy Schubert <cy@FreeBSD.org>
CommitDate: 2021-12-09 18:50:22 +0000

    ipfilter: Avoid more null if-then-else blocks
    
    As in 73db3b64f167, when WITHOUT_INET6 is selected, null if-then-else
    blocks are generated because #if statements are incorrectly placed.
    Moving the #if statements reduces unnecessary runtime comparisons or
    compiler optimizations.
    
    (cherry picked from commit 130df64793d7d3c680c0f7177a707867a8a19665)
---
 sys/contrib/ipfilter/netinet/ip_proxy.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/sys/contrib/ipfilter/netinet/ip_proxy.c b/sys/contrib/ipfilter/netinet/ip_proxy.c
index b90ad09d8c00..af5ed81a5765 100644
--- a/sys/contrib/ipfilter/netinet/ip_proxy.c
+++ b/sys/contrib/ipfilter/netinet/ip_proxy.c
@@ -1367,8 +1367,8 @@ ipf_proxy_rule_rev(nat)
 		if (ipn->in_v[0] == 4) {
 			ipn->in_snip = ntohl(nat->nat_odstaddr);
 			ipn->in_dnip = ntohl(nat->nat_osrcaddr);
-		} else {
 #ifdef USE_INET6
+		} else {
 			ipn->in_snip6 = nat->nat_odst6;
 			ipn->in_dnip6 = nat->nat_osrc6;
 #endif
@@ -1443,8 +1443,8 @@ ipf_proxy_rule_fwd(nat)
 	if (ipn->in_v[0] == 4) {
 		ipn->in_snip = ntohl(nat->nat_nsrcaddr);
 		ipn->in_dnip = ntohl(nat->nat_ndstaddr);
-	} else {
 #ifdef USE_INET6
+	} else {
 		ipn->in_snip6 = nat->nat_nsrc6;
 		ipn->in_dnip6 = nat->nat_ndst6;
 #endif