aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKajetan Staszkiewicz <vegeta@tuxpowered.net>2023-08-21 05:59:49 +0000
committerKristof Provost <kp@FreeBSD.org>2023-08-28 08:17:18 +0000
commited38753926973fbd84135523efefcfcb887064ee (patch)
tree08ee646d36dd46c937b2fb0976929e9466b50fc9
parentb1b8f5a15fc0fde1aea5eea5d1ecb7cfbee89d19 (diff)
downloadsrc-ed38753926973fbd84135523efefcfcb887064ee.tar.gz
src-ed38753926973fbd84135523efefcfcb887064ee.zip
pf: reduce indentation
Early-return to reduce syncookie-related indentation. No functional change. MFC after: 1 week Reviewed by: kp Sponsored by: InnoGames GmbH Differential Revision: https://reviews.freebsd.org/D41502 (cherry picked from commit 9642d948c08d80a41679f2eaab26e85a8b9e3080)
-rw-r--r--sys/netpfil/pf/pf.c37
1 files changed, 15 insertions, 22 deletions
diff --git a/sys/netpfil/pf/pf.c b/sys/netpfil/pf/pf.c
index 0717c0ac0992..9c1d11952a90 100644
--- a/sys/netpfil/pf/pf.c
+++ b/sys/netpfil/pf/pf.c
@@ -6729,8 +6729,8 @@ pf_test(int dir, int pflags, struct ifnet *ifp, struct mbuf **m0, struct inpcb *
pd.dir == PF_IN) {
struct mbuf *msyn;
- msyn = pf_syncookie_recreate_syn(h->ip_ttl,
- off,&pd);
+ msyn = pf_syncookie_recreate_syn(h->ip_ttl, off,
+ &pd);
if (msyn == NULL) {
action = PF_DROP;
break;
@@ -6738,29 +6738,22 @@ pf_test(int dir, int pflags, struct ifnet *ifp, struct mbuf **m0, struct inpcb *
action = pf_test(dir, pflags, ifp, &msyn, inp);
m_freem(msyn);
+ if (action != PF_PASS)
+ break;
- if (action == PF_PASS) {
- action = pf_test_state_tcp(&s, dir,
- kif, m, off, h, &pd, &reason);
- if (action != PF_PASS || s == NULL) {
- action = PF_DROP;
- break;
- }
-
- s->src.seqhi = ntohl(pd.hdr.tcp.th_ack)
- - 1;
- s->src.seqlo = ntohl(pd.hdr.tcp.th_seq)
- - 1;
- pf_set_protostate(s, PF_PEER_SRC,
- PF_TCPS_PROXY_DST);
-
- action = pf_synproxy(&pd, &s, &reason);
- if (action != PF_PASS)
- break;
+ action = pf_test_state_tcp(&s, dir,
+ kif, m, off, h, &pd, &reason);
+ if (action != PF_PASS || s == NULL) {
+ action = PF_DROP;
+ break;
}
+
+ s->src.seqhi = ntohl(pd.hdr.tcp.th_ack) - 1;
+ s->src.seqlo = ntohl(pd.hdr.tcp.th_seq) - 1;
+ pf_set_protostate(s, PF_PEER_SRC, PF_TCPS_PROXY_DST);
+ action = pf_synproxy(&pd, &s, &reason);
break;
- }
- else {
+ } else {
action = pf_test_rule(&r, &s, dir, kif, m, off,
&pd, &a, &ruleset, inp);
}