The branch main has been updated by kp:

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

commit ec30ca2e13aec6c1778a008f2ca404bca8d7575f
Author:     Kristof Provost <k...@freebsd.org>
AuthorDate: 2024-12-28 16:00:39 +0000
Commit:     Kristof Provost <k...@freebsd.org>
CommitDate: 2024-12-30 20:42:12 +0000

    pf: remove impossible condition
    
    There's no need to account for pd->af == pd->naf in this section of
    pf_state_key_setup() because we only get here if pd->af != pd->naf (i.e. 
nat64).
    
    Pointed out by: markj
    Sponsored by:   Rubicon Communications, LLC ("Netgate")
---
 sys/netpfil/pf/pf.c | 10 ++++------
 1 file changed, 4 insertions(+), 6 deletions(-)

diff --git a/sys/netpfil/pf/pf.c b/sys/netpfil/pf/pf.c
index 695ecfc0269d..cd557a9614d1 100644
--- a/sys/netpfil/pf/pf.c
+++ b/sys/netpfil/pf/pf.c
@@ -1706,12 +1706,10 @@ pf_state_key_setup(struct pf_pdesc *pd, u_int16_t 
sport, u_int16_t dport,
                bzero(&(*nk)->addr[0], sizeof((*nk)->addr[0]));
                bzero(&(*nk)->addr[1], sizeof((*nk)->addr[1]));
 
-               PF_ACPY(&(*nk)->addr[pd->af == pd->naf ? pd->sidx : pd->didx],
-                   &pd->nsaddr, pd->naf);
-               PF_ACPY(&(*nk)->addr[pd->af == pd->naf ? pd->didx : pd->sidx],
-                   &pd->ndaddr, pd->naf);
-               (*nk)->port[pd->af == pd->naf ? pd->sidx : pd->didx] = 
pd->nsport;
-               (*nk)->port[pd->af == pd->naf ? pd->didx : pd->sidx] = 
pd->ndport;
+               PF_ACPY(&(*nk)->addr[pd->didx], &pd->nsaddr, pd->naf);
+               PF_ACPY(&(*nk)->addr[pd->sidx], &pd->ndaddr, pd->naf);
+               (*nk)->port[pd->didx] = pd->nsport;
+               (*nk)->port[pd->sidx] = pd->ndport;
                switch (pd->proto) {
                case IPPROTO_ICMP:
                        (*nk)->proto = IPPROTO_ICMPV6;

Reply via email to