From nobody Thu Feb 13 12:39:05 2025 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4YtvrB5g6fz5nRXq; Thu, 13 Feb 2025 12:39:06 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R11" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Ytvr94Y0Vz3fnW; Thu, 13 Feb 2025 12:39:05 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1739450345; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=Jlnv6/dmcM6R6RYkDTiWXkyIHw+5u38VirWNnP53i3c=; b=eGTSXICgk9pEi2eK3EyQlzvDoAm4M4g0FWHAyU95D7NGLGhLrPh+EgHblKaM7TLnEIHK9E VjIU9Qe9c6JsnA9lXNRmSio2up/pmBVEAYvE8iH5K9wKYt4ZtA/MajzGN4ekVRWw3sjTij FWlnjnid8I0Hw2zTTVCdgQ509NlrXW7khjkxlqK5x7Bnr0xmJwXnW26TMgHIplzCAnRHxA xQt+9UoOYZjVYeK/XR+p1AQT7SW9SlRgllFnKlQW3PDWkouLjhAHv1VpQ9JhYe+PhBKAej 67zEfbTBwPqHCAme+hAzBCtufEAeh2Tmwv9OMBqet0pZ5KEx98tmap+oGlnEYg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1739450345; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=Jlnv6/dmcM6R6RYkDTiWXkyIHw+5u38VirWNnP53i3c=; b=OM+A+nHF2P93FB9ikskF8JF+taYDp6zDkd6URe8jiC46bVjnhjFGj58qrZL3rvTVIw0mu2 bNC/kp+wLFrbBaujROGf5STRqtlu5bRo4lZpO+QZ7hB8SJNUPrqtl/SA3ZPz8qEJrEJatk QBWJnKDvyt36ezdePh3scqjZ7z8R2MWoCxvI0R12Kb820+fHH3w/yB5GMYmLIzdx+9oKJn NsXCrWzo3V8uwHxiM7S98xFwsNS5TIoJtlx+nG0hKD7yZtCHt3u3mEE3ZAmLRRME5rbvQo IpIms9xMnYkD6DPtmnrspFCP8nDuZchgJIJj7T3p+c61oSbDv6CfxT/7VzsfqQ== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1739450345; a=rsa-sha256; cv=none; b=U2iVQUBEUhGzbT0AAxjCmeVHCHJW75zgJqdFrXBqNRfRAnL0U5ZW874GAhMDs0YLBwyleJ 6SLxa2YQ0czhEsfEzX6YaLNCRVtQuK2dBYPWbzXsLPfEn3hLkba/qt6coljBgG/ERk/clQ jlQ079ZjyXIS+uxNvL51yd1I7kaWlJT40jeXZ7B6QbKL6aI81ATKANvDrFHi3g33qtzkAW /jpIWistEgAWqfSImjp15Sxv903kpSee8PrOmRyaaq9wUY3f3GvW7b3Z0RYl/DnbZwaGKi +vLE83h3y1G6wBRaV8j3PBN1QzkPxmQrPmfn9YfmeeUi91Keh2Hr3antWP3sDg== ARC-Authentication-Results: i=1; mx1.freebsd.org; none Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4Ytvr94812zlyc; Thu, 13 Feb 2025 12:39:05 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.18.1/8.18.1) with ESMTP id 51DCd5sx075588; Thu, 13 Feb 2025 12:39:05 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 51DCd5bT075585; Thu, 13 Feb 2025 12:39:05 GMT (envelope-from git) Date: Thu, 13 Feb 2025 12:39:05 GMT Message-Id: <202502131239.51DCd5bT075585@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Kristof Provost Subject: git: 25dbba4fc6e1 - main - pf: improve UDP-in-ICMP handling List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-all@freebsd.org Sender: owner-dev-commits-src-all@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kp X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 25dbba4fc6e152a05e091180b2e031ab495ba337 Auto-Submitted: auto-generated The branch main has been updated by kp: URL: https://cgit.FreeBSD.org/src/commit/?id=25dbba4fc6e152a05e091180b2e031ab495ba337 commit 25dbba4fc6e152a05e091180b2e031ab495ba337 Author: Kristof Provost AuthorDate: 2025-02-10 15:33:18 +0000 Commit: Kristof Provost CommitDate: 2025-02-13 12:38:44 +0000 pf: improve UDP-in-ICMP handling Translate port numbers for inner udp packets when they're returned as a payload of icmp error messages. Makes traceroute6 operate across a nat64 gateway. prompted by sthen, ok henning Previous udp port number rewrite fix turned out to be a work around the incorrect pf_change_ap call. While here make the tcp case use pf_change_ap since it shares the same properties. ok henning Obtained from: OpenBSD, mikeb , 7a304f30d6 Obtained from: OpenBSD, mikeb , 5d4200d304 Sponsored by: Rubicon Communications, LLC ("Netgate") --- sys/netpfil/pf/pf.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/sys/netpfil/pf/pf.c b/sys/netpfil/pf/pf.c index 65eb5736d43d..1b0eb6d6dd80 100644 --- a/sys/netpfil/pf/pf.c +++ b/sys/netpfil/pf/pf.c @@ -7972,8 +7972,12 @@ pf_test_state_icmp(struct pf_kstate **state, struct pf_pdesc *pd, pd->proto = IPPROTO_ICMP; else pd->proto = IPPROTO_ICMPV6; - th.th_sport = nk->port[sidx]; - th.th_dport = nk->port[didx]; + pf_change_ap(pd->m, pd2.src, &th.th_sport, + pd->ip_sum, &th.th_sum, &nk->addr[pd2.sidx], + nk->port[sidx], 1, pd->af, nk->af); + pf_change_ap(pd->m, pd2.dst, &th.th_dport, + pd->ip_sum, &th.th_sum, &nk->addr[pd2.didx], + nk->port[didx], 1, pd->af, nk->af); m_copyback(pd2.m, pd2.off, 8, (c_caddr_t)&th); PF_ACPY(pd->src, &nk->addr[pd2.sidx], nk->af);