From nobody Mon Nov 09 22:21:07 2026 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 4jNkl81dnvz70Zxb for ; Mon, 09 Nov 2026 22:21:08 +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) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id 4jNkl76kNgz4sKD for ; Mon, 09 Nov 2026 22:21:07 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1794262867; 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=bC5tz9AvB4p+aSt0AOievN4LL8L525bKBkGEVVJrU2Y=; b=qDXm4WOToKeATTyle3MXYYdfTBaYK1lp5+/Q7EY8dEAToPvtuhueVmC12uHKw4STbUpeTH Js7ynaMt75xNHPj/a0SqO4SYByz5NgkTrWW0jKe2gUhpRuV4eWmyR8AL/nPdNUYrIAb1jP aogNS0uAiZcCeUf1iTnnHxu2sm/3l1el/ajrVrfj9qjQEDGDK9AOEtTHHD8GM7eiSCCLVW eI3udffbl6tn02l50JzLir5PqbEjNGzVYWGQ3NnmzSrdEKg7El+vHv+ijVY3niBCL4LEP+ AqZQih1/HVW5i3iqkn83369gOm3pLopxgpEuewgaTHODo1yVHgg32V672Zf+Tg== ARC-Seal: i=1; a=rsa-sha256; d=freebsd.org; s=dkim; cv=none; t=1794262867; b=dkRWQclvRzFHcmZNNKcmltyrZnaIft9gcGFhcX4Q6WBovzNiD5d3260NXM+dVOAfzodQal y6rEyrlt3lCOtKv7dEzxVFXpRqlLyELWh0HcV+yHQoEo/+TdvupV6JCqxPuuAbkp3lZQu1 ben7US1mAoXjDK1qvBU5lIUBIXlJ88OGyfO7X9drv9wYJe9+vgJTZGDYccfe/few57lOyQ Ppc38pgtCCPBd//zxV5noxx/wbJzxZggrYbLti/hhCK0pBaHESg9PHBXDSYrNDUyFBOhsi 9BFFvandLx+hWp5XEaVO0YEAysaKVJ5CjRbwJp+i1Q5kBhcWSLR7+uuWMINbrg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1794262867; 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=bC5tz9AvB4p+aSt0AOievN4LL8L525bKBkGEVVJrU2Y=; b=IZdP9Rxoi8o0zI+zCBwOaNEFcqidUduNHV3HJ88aFP21KunhLMswU0mGkr8PHw6b9t8hnO 4eNTX+euWpltKB73kx6Bv3v5yUZpFzJlPU2vyovQUXRS+T6Z2ZCnpQhBv3Uy2OOcjrz66Y kQ5iOStG6EcBTjI7t8SCCMd3O3/LZTmTHBH5NdX7qHt7NGeFVAEwF/TvfnbRjKP3Ek/JL6 2z1NIaCuxQcjKszDMraa0eXh2UaF+ZOAu2VU+OrX5T9KzrIrHZJRWlTQJTxDqVVyfk17GD qTd8gNVaL85khsRt2ZKRGTkK9DrV7CzEzr2t46lkoQwUpGHX0np5AW97o2EQCw== ARC-Authentication-Results: i=1; mx1.freebsd.org; none Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) by mxrelay.nyi.freebsd.org (Postfix) with ESMTP id 4jNkl761kLz10Xx for ; Mon, 09 Nov 2026 22:21:07 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from git (uid 1279) (envelope-from git@FreeBSD.org) id 26a2 by gitrepo.freebsd.org (DragonFly Mail Agent v0.13+ on gitrepo.freebsd.org); Mon, 09 Nov 2026 22:21:07 +0000 To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Cy Schubert Subject: git: 72cc9e3766f4 - main - ipfilter: Only recalculate the UDP header when we have one List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all X-BeenThere: dev-commits-src-all@freebsd.org Sender: owner-dev-commits-src-all@FreeBSD.org List-Id: Commit messages for all branches of the src repository List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: cy X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 72cc9e3766f4222fa7fc462bc669dcf668e8b334 Auto-Submitted: auto-generated Date: Mon, 09 Nov 2026 22:21:07 +0000 Message-Id: <6af24753.26a2.e3e3196@gitrepo.freebsd.org> The branch main has been updated by cy: URL: https://cgit.FreeBSD.org/src/commit/?id=72cc9e3766f4222fa7fc462bc669dcf668e8b334 commit 72cc9e3766f4222fa7fc462bc669dcf668e8b334 Author: Cy Schubert AuthorDate: 2026-08-26 05:27:28 +0000 Commit: Cy Schubert CommitDate: 2026-11-09 22:20:49 +0000 ipfilter: Only recalculate the UDP header when we have one When ipf_nat_out processes NAT_DIVERTOUT (ipnat rdr statements) it also fixes the checksum in the UDP header. Test for a UDP header before adjusting its length. While we are here, the length in the UDP header must be converted from network byte order to host byte order. Add the missing ntohs(). PR: 296944 MFC after: 3 days --- sys/netpfil/ipfilter/netinet/ip_nat.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/sys/netpfil/ipfilter/netinet/ip_nat.c b/sys/netpfil/ipfilter/netinet/ip_nat.c index b7f5eb94b1dd..c8125c10e3f0 100644 --- a/sys/netpfil/ipfilter/netinet/ip_nat.c +++ b/sys/netpfil/ipfilter/netinet/ip_nat.c @@ -5154,9 +5154,12 @@ ipf_nat_out(fr_info_t *fin, nat_t *nat, int natadd, u_32_t nflags) s2 += ntohs(ip->ip_len); CALC_SUMD(s1, s2, sumd); - uh = (udphdr_t *)(ip + 1); - uh->uh_ulen += fin->fin_plen; - uh->uh_ulen = htons(uh->uh_ulen); + if (ip->ip_p == IPPROTO_UDP) { + uh = (udphdr_t *)(ip + 1); + uh->uh_ulen = ntohs(uh->uh_ulen); + uh->uh_ulen += fin->fin_plen; + uh->uh_ulen = htons(uh->uh_ulen); + } #if !defined(_KERNEL) || SOLARIS || \ defined(BRIDGE_IPF) || defined(__FreeBSD__) ipf_fix_outcksum(0, &ip->ip_sum, sumd, 0);