git: 9642d948c08d - main - pf: reduce indentation
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Mon, 21 Aug 2023 13:24:59 UTC
The branch main has been updated by kp: URL: https://cgit.FreeBSD.org/src/commit/?id=9642d948c08d80a41679f2eaab26e85a8b9e3080 commit 9642d948c08d80a41679f2eaab26e85a8b9e3080 Author: Kajetan Staszkiewicz <vegeta@tuxpowered.net> AuthorDate: 2023-08-21 05:59:49 +0000 Commit: Kristof Provost <kp@FreeBSD.org> CommitDate: 2023-08-21 11:18:52 +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 --- sys/netpfil/pf/pf.c | 44 +++++++++++++++++++------------------------- 1 file changed, 19 insertions(+), 25 deletions(-) diff --git a/sys/netpfil/pf/pf.c b/sys/netpfil/pf/pf.c index 7fb47a297f9e..c2b9ee21d04c 100644 --- a/sys/netpfil/pf/pf.c +++ b/sys/netpfil/pf/pf.c @@ -7542,40 +7542,34 @@ pf_test(int dir, int pflags, struct ifnet *ifp, struct mbuf **m0, 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; } - action = pf_test(dir, pflags, ifp, &msyn, inp, &pd.act); + action = pf_test(dir, pflags, ifp, &msyn, inp, + &pd.act); m_freem(msyn); + if (action != PF_PASS) + break; - if (action == PF_PASS) { - action = pf_test_state_tcp(&s, 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, 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 { - action = pf_test_rule(&r, &s, kif, m, off, - &pd, &a, &ruleset, inp); + } else { + action = pf_test_rule(&r, &s, kif, m, off, &pd, + &a, &ruleset, inp); } } break;