git: ed3875392697 - stable/13 - pf: reduce indentation
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Mon, 28 Aug 2023 12:03:20 UTC
The branch stable/13 has been updated by kp: URL: https://cgit.FreeBSD.org/src/commit/?id=ed38753926973fbd84135523efefcfcb887064ee commit ed38753926973fbd84135523efefcfcb887064ee Author: Kajetan Staszkiewicz <vegeta@tuxpowered.net> AuthorDate: 2023-08-21 05:59:49 +0000 Commit: Kristof Provost <kp@FreeBSD.org> CommitDate: 2023-08-28 08:17:18 +0000 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) --- sys/netpfil/pf/pf.c | 37 +++++++++++++++---------------------- 1 file 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); }