Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 01 Dec 2025 21:31:20 +0000
From:      Kristof Provost <kp@FreeBSD.org>
To:        src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org
Subject:   git: d6f1acf94d3a - main - pf: use correct sized variables in pf_change_icmp()
Message-ID:  <692e0928.365ed.2ee91c72@gitrepo.freebsd.org>

index | next in thread | raw e-mail

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),


help

Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?692e0928.365ed.2ee91c72>