git: d6f1acf94d3a - main - pf: use correct sized variables in pf_change_icmp()
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Mon, 01 Dec 2025 21:31:20 UTC
The branch main has been updated by kp:
URL: https://cgit.FreeBSD.org/src/commit/?id=d6f1acf94d3a1b310318ea3ff6c4f4b33bc8e85d
commit d6f1acf94d3a1b310318ea3ff6c4f4b33bc8e85d
Author: Kristof Provost <kp@FreeBSD.org>
AuthorDate: 2025-12-01 10:06:24 +0000
Commit: Kristof Provost <kp@FreeBSD.org>
CommitDate: 2025-12-01 21:30:21 +0000
pf: use correct sized variables in pf_change_icmp()
We're updating 16-bits checksums here, so should use a 16-bit integer,
not a 32-bit one.
No functional change.
Sponsored by: Rubicon Communications, LLC ("Netgate")
---
sys/netpfil/pf/pf.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/sys/netpfil/pf/pf.c b/sys/netpfil/pf/pf.c
index 74d2182fe77b..2f09d47dc6e1 100644
--- a/sys/netpfil/pf/pf.c
+++ b/sys/netpfil/pf/pf.c
@@ -3531,7 +3531,7 @@ pf_change_icmp(struct pf_addr *ia, u_int16_t *ip, struct pf_addr *oa,
/* Change inner protocol port, fix inner protocol checksum. */
if (ip != NULL) {
u_int16_t oip = *ip;
- u_int32_t opc;
+ u_int16_t opc;
if (pc != NULL)
opc = *pc;
@@ -3547,7 +3547,7 @@ pf_change_icmp(struct pf_addr *ia, u_int16_t *ip, struct pf_addr *oa,
switch (af) {
#ifdef INET
case AF_INET: {
- u_int32_t oh2c = *h2c;
+ u_int16_t oh2c = *h2c;
*h2c = pf_cksum_fixup(pf_cksum_fixup(*h2c,
oia.addr16[0], ia->addr16[0], 0),