git: afc32641e293 - main - pf: make pf_change_ap() usable without a port
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Wed, 12 Feb 2025 19:39:03 UTC
The branch main has been updated by kp: URL: https://cgit.FreeBSD.org/src/commit/?id=afc32641e2932d2f7c47d2fbcfde9a063e72b85b commit afc32641e2932d2f7c47d2fbcfde9a063e72b85b Author: Kristof Provost <kp@FreeBSD.org> AuthorDate: 2025-02-05 16:26:13 +0000 Commit: Kristof Provost <kp@FreeBSD.org> CommitDate: 2025-02-12 19:38:37 +0000 pf: make pf_change_ap() usable without a port If the port pointer is NULL, just return after being done with the address. ok bluhm ryan mikeb Obtained from: OpenBSD, henning <henning@openbsd.org>, 17f4816165 Sponsored by: Rubicon Communications, LLC ("Netgate") --- sys/netpfil/pf/pf.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/sys/netpfil/pf/pf.c b/sys/netpfil/pf/pf.c index 79e50be6cd13..17c23f6d4194 100644 --- a/sys/netpfil/pf/pf.c +++ b/sys/netpfil/pf/pf.c @@ -3217,7 +3217,7 @@ pf_change_ap(struct mbuf *m, struct pf_addr *a, u_int16_t *p, u_int16_t *ic, sa_family_t af, sa_family_t naf) { struct pf_addr ao; - u_int16_t po = *p; + u_int16_t po; PF_ACPY(&ao, a, af); if (af == naf) @@ -3226,6 +3226,9 @@ pf_change_ap(struct mbuf *m, struct pf_addr *a, u_int16_t *p, u_int16_t *ic, if (m->m_pkthdr.csum_flags & (CSUM_DELAY_DATA | CSUM_DELAY_DATA_IPV6)) *pc = ~*pc; + if (p == NULL) /* no port -> done. no cksum to worry about. */ + return; + po = *p; *p = pn; switch (af) {