git: 5640fea1e373 - stable/13 - pf: drop redundant 'else' in pf_normalize_*

Mateusz Guzik mjg at FreeBSD.org
Wed Aug 11 15:22:42 UTC 2021


The branch stable/13 has been updated by mjg:

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

commit 5640fea1e37323133cc8447e050ec44012389883
Author:     Mateusz Guzik <mjg at FreeBSD.org>
AuthorDate: 2021-07-24 05:17:27 +0000
Commit:     Mateusz Guzik <mjg at FreeBSD.org>
CommitDate: 2021-08-11 13:37:53 +0000

    pf: drop redundant 'else' in pf_normalize_*
    
    Reviewed by:    kp
    Sponsored by:   Rubicon Communications, LLC ("Netgate")
    
    (cherry picked from commit 6f1fb6561236fa933835a9a67bd442053fb509e9)
---
 sys/netpfil/pf/pf_norm.c | 21 +++++++++------------
 1 file changed, 9 insertions(+), 12 deletions(-)

diff --git a/sys/netpfil/pf/pf_norm.c b/sys/netpfil/pf/pf_norm.c
index 561181eb1b56..3df4e06f15b6 100644
--- a/sys/netpfil/pf/pf_norm.c
+++ b/sys/netpfil/pf/pf_norm.c
@@ -1065,10 +1065,9 @@ pf_normalize_ip(struct mbuf **m0, int dir, struct pfi_kkif *kif, u_short *reason
 
 	if (r == NULL || r->action == PF_NOSCRUB)
 		return (PF_PASS);
-	else {
-		counter_u64_add(r->packets[dir == PF_OUT], 1);
-		counter_u64_add(r->bytes[dir == PF_OUT], pd->tot_len);
-	}
+
+	counter_u64_add(r->packets[dir == PF_OUT], 1);
+	counter_u64_add(r->bytes[dir == PF_OUT], pd->tot_len);
 
 	/* Check for illegal packets */
 	if (hlen < (int)sizeof(struct ip)) {
@@ -1207,10 +1206,9 @@ pf_normalize_ip6(struct mbuf **m0, int dir, struct pfi_kkif *kif,
 
 	if (r == NULL || r->action == PF_NOSCRUB)
 		return (PF_PASS);
-	else {
-		counter_u64_add(r->packets[dir == PF_OUT], 1);
-		counter_u64_add(r->bytes[dir == PF_OUT], pd->tot_len);
-	}
+
+	counter_u64_add(r->packets[dir == PF_OUT], 1);
+	counter_u64_add(r->bytes[dir == PF_OUT], pd->tot_len);
 
 	/* Check for illegal packets */
 	if (sizeof(struct ip6_hdr) + IPV6_MAXPACKET < m->m_pkthdr.len)
@@ -1369,10 +1367,9 @@ pf_normalize_tcp(int dir, struct pfi_kkif *kif, struct mbuf *m, int ipoff,
 
 	if (rm == NULL || rm->action == PF_NOSCRUB)
 		return (PF_PASS);
-	else {
-		counter_u64_add(r->packets[dir == PF_OUT], 1);
-		counter_u64_add(r->bytes[dir == PF_OUT], pd->tot_len);
-	}
+
+	counter_u64_add(r->packets[dir == PF_OUT], 1);
+	counter_u64_add(r->bytes[dir == PF_OUT], pd->tot_len);
 
 	if (rm->rule_flag & PFRULE_REASSEMBLE_TCP)
 		pd->flags |= PFDESC_TCP_NORM;


More information about the dev-commits-src-branches mailing list