From nobody Fri Nov 13 19:33:14 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 4jR6qZ6w2cz718Tt for ; Fri, 13 Nov 2026 19:33:14 +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 4jR6qZ15bjz4f46 for ; Fri, 13 Nov 2026 19:33:14 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1794598394; 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=NeEy41vSfkoCak2gVtdAPDrRC/24JiN/CQvRLoqGmS4=; b=icFK43FU0LaGcsQ6gfwxhqdj0lAyrUyvvmb6sqpCsghEdzbOq/iq+sTitAZRvXUsTxh4BL scs1stXmkSEYI02uXvrNpT+Lwirk2negeET7BACgnaLP+H7IkCuYUMP+DIZd9MAYbGg7IW ZK1UMWN7TVltjm63yHgmUrSJpRJZSph9XD94NSa/4DumhIGIdb5Yx6DOmbOzuOgQuW8V/I gm59St0fBLcFJ943sLqkUmFF3JSpHA6K/jfeQNrfhgC+EG0htPt3RM99ASyfgbcs0kwKfK tWlQiC9dUwqVFO6MeYKkLoHoXhexnvnbKWLzaEZoduQOCiFwLmlnp+S0xCjfxQ== ARC-Seal: i=1; a=rsa-sha256; d=freebsd.org; s=dkim; cv=none; t=1794598394; b=nLz+PBIcnfUcKewDz/wuvHvPE+Kit9KkVpuKQZaSzqhNUJfeAVccOHg93Nh+plGQyrjwe8 aRx00eENqdpcInthKTtYtbdKQS2ii8BersM6zGNzxlikpyEhSt6xPdz9owRIIUxZ4T7T4h YJuwiHoN7Na5y4IW3X8liJUm+4NccY2wHn8OCoXaQdhRwsAC4L/HdGKIrgdnocYy3GacCW 4KzeMVvnNXqeC4ITpoxzHcFRbfbBarP3se8aTlFCgkejHRAPkVRn1xm58dhTk/iac7QX0x 68Ui7TbLO3rmA1OUwAQeiWA2/k6hr4pfa3bK8YlvYuuanOQOkKk0wShm5X1jfg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1794598394; 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=NeEy41vSfkoCak2gVtdAPDrRC/24JiN/CQvRLoqGmS4=; b=eZflYyaSAY1M35nMR6KYGj56k3dROjNsZjtVnPfrxAo/uvzFDs6eNLCreOfc98RM6RWXA5 UxtCDDT/8+EGJOVNrVNBI7zPi+df/fYnMkEBxki2H3BMSzp8YqMmqKZmBo9BAMkOzWvlUv sa2RTBFj3JkLcjQsLT5X003BQfWg+8TUDz9R83+eiIJ23W1D9kBXlEenHWg4yJN9e0XQeO idLpuwrSBbyOeqqG78nwwJ2jXRyYynYmbpdBLeHr/++odr6DDGnZD81JfoiW21lDq9lApw 8sT5c+MonsAXP8Z5tORtqIqG+moj0/xiwjGTeSAhq7cFUb62rLBZEI7Td+C+DA== 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 4jR6qZ0Ng3zpmp for ; Fri, 13 Nov 2026 19:33:14 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from git (uid 1279) (envelope-from git@FreeBSD.org) id 23ef4 by gitrepo.freebsd.org (DragonFly Mail Agent v0.13+ on gitrepo.freebsd.org); Fri, 13 Nov 2026 19:33:14 +0000 To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Cy Schubert Subject: git: 10207d1d01ad - stable/14 - 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 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/stable/14 X-Git-Reftype: branch X-Git-Commit: 10207d1d01ad8c79fbb0a885e8dbdf952b30e4f0 Auto-Submitted: auto-generated Date: Fri, 13 Nov 2026 19:33:14 +0000 Message-Id: <6af765fa.23ef4.31dae2c@gitrepo.freebsd.org> The branch stable/14 has been updated by cy: URL: https://cgit.FreeBSD.org/src/commit/?id=10207d1d01ad8c79fbb0a885e8dbdf952b30e4f0 commit 10207d1d01ad8c79fbb0a885e8dbdf952b30e4f0 Author: Cy Schubert AuthorDate: 2026-08-26 05:27:28 +0000 Commit: Cy Schubert CommitDate: 2026-11-13 19:33:05 +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 (cherry picked from commit 72cc9e3766f4222fa7fc462bc669dcf668e8b334) --- 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 b021657134cd..8e6c3107c782 100644 --- a/sys/netpfil/ipfilter/netinet/ip_nat.c +++ b/sys/netpfil/ipfilter/netinet/ip_nat.c @@ -5158,9 +5158,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);