From nobody Fri Nov 13 19:32:50 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 4jR6q65Qy9z7182g for ; Fri, 13 Nov 2026 19:32:50 +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 4jR6q64Y4lz4dPq for ; Fri, 13 Nov 2026 19:32:50 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1794598370; 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=Yu+7uLDnctGT+hPCyBI4RwwNZykcqwqeOJZiBwzAI5w=; b=OXU5+rln3vbddx8xgUhm37d2WTOxJsguEItr6sOoC8cDcYOFhgyI2c8T27Uwxj6wn9gfW7 X8I/jiCWpPw+PtD+lyZY43NwAFg7N+gaZ8V46jqLCDRjKzDhzLpQlDHliO/Z7lz3yXrTOf mSPmwWXqndQQMTwkQi6FZ6vGhojYSwPF4i527WwqPN0LhzwdsaqetEqwFnjPRlKYHUDNA9 7W4q2i3p8GAMyRe/Mx3Od0HIXmznxU93vV4C+3tajLH8/Qxk0sIW7M0NnhgT2QfPQoubPb eJc+ChD8ZwLVmrr8VLO0PFFU+TLFkEd9q0ffoojoKVrKQWSEx3svCp5sR2u7Eg== ARC-Seal: i=1; a=rsa-sha256; d=freebsd.org; s=dkim; cv=none; t=1794598370; b=QtXaUPd1YRFkEQqw3FWv2N966bMtIuR/RFDHrcv4LPuxmMOwEI2rpubQjK29m8F5w0kM+h b2QARLZ1OTHnOacEcu1nqY5Bn26iojNW3ImjaFbitiGYiXIlyPv8Ts4CAQyn5HgkAhIm7n w2SlxgrCftuh1toogNME6bQmPkypi3Jf7dONBTHQIru/erEJp3OGiBIVZXxLw20UVteU5j n0kQsRf4kuqWNK6LxVlLlXzrofdrAj0pUiKm4bunY04fE0FqQoDLznDYfig7Gu4L7I8MRO EqVdXaIeLvoPbTUGwGNJceCMFK2i7j/VUcNwqnabsVzfaMdbxg8c7epQ5v1uMw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1794598370; 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=Yu+7uLDnctGT+hPCyBI4RwwNZykcqwqeOJZiBwzAI5w=; b=VqKNtU2mKqduE2ekwnog81LBY0HhlTQwzlg2g4ZCtW8QNwyYhcO+LfYgGaeU+E97bQGyP5 tv0QXkxSwo6hAUX+2j5WX20Uc001p0SX6wtZlAKieN/f/pAnIim0f2ElQ2Up+CSbhke0YI Kgu7f3Zsq6T3TMlWChVFlgdbz8g6+dUPpIWwIqhllytKjJYbn/gy2wTay6wfQ9DUKCyNR2 11L7qrwwYJoDm6VEveWsG5cQRqkCKRoivDsPEIts7z5K70u4HM3k6MVwS6m3ddFAgRx6ci 5r1l7MR5c4u21owoobQl+Kg69yoy+PqrPJSIfCI0E1JQz6CyTT8jQQ71RWs2KA== 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 4jR6q63l8lzppG for ; Fri, 13 Nov 2026 19:32:50 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from git (uid 1279) (envelope-from git@FreeBSD.org) id 263fe by gitrepo.freebsd.org (DragonFly Mail Agent v0.13+ on gitrepo.freebsd.org); Fri, 13 Nov 2026 19:32:50 +0000 To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Cy Schubert Subject: git: dd721990e8c0 - stable/15 - 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/15 X-Git-Reftype: branch X-Git-Commit: dd721990e8c03b3ff9be0523e5af452d6890b72f Auto-Submitted: auto-generated Date: Fri, 13 Nov 2026 19:32:50 +0000 Message-Id: <6af765e2.263fe.6572b9df@gitrepo.freebsd.org> The branch stable/15 has been updated by cy: URL: https://cgit.FreeBSD.org/src/commit/?id=dd721990e8c03b3ff9be0523e5af452d6890b72f commit dd721990e8c03b3ff9be0523e5af452d6890b72f Author: Cy Schubert AuthorDate: 2026-08-26 05:27:28 +0000 Commit: Cy Schubert CommitDate: 2026-11-13 19:32:36 +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 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);