From nobody Tue Nov 10 01:22:00 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 4jNply21Lvz70q73; Tue, 10 Nov 2026 01:22:06 +0000 (UTC) (envelope-from zlei@FreeBSD.org) Received: from smtp.freebsd.org (smtp.freebsd.org [IPv6:2610:1c1:1:606c::24b:4]) (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 4jNply1Zkmz4NQf; Tue, 10 Nov 2026 01:22:06 +0000 (UTC) (envelope-from zlei@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1794273726; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=NrsW+5TTzv5TV5zy2v6AlMMTWHRCwa0JC9ZSIr2ctFQ=; b=WUxEeznH7yMbOz3Lh3oXrZZcQPl5RfbZtjRD1+mT+XG6wKn1fWkxuh+5ZNmmVoKRw1ffJB RMl7rWmzER1cV9K7EOGZcYxtOmZURv6doWJxW0mI59kcw+1O5bMecQkQYQrPz+MpvgxjiD E5L97vLJ97sCejGrXVvt2tPfpdQDZoRQBPJo7Ksuj+9Fw6LagNRzHrEx9xXjVNv93WaRaB QBO5RXr4RcyxkmZkFI2RHO0bXsV4zPDoCUCQySm1fXPoKR4HbWvG+iiGU+5/UleONvFXRw 5BiCcNbLo8K6r8dhaij8OwJwifQaUL3vikNqpt4qwbIrxlHL01CC+62/Iyio+w== ARC-Seal: i=1; a=rsa-sha256; d=freebsd.org; s=dkim; cv=none; t=1794273726; b=U4zryuU+vl59i/Isw62SJt4/wx2XAq5FKCXkGT4OZvYbBpEwkm7UIFSBEyTWuhrSnqCgRn wanw3s6En00ckyKo0EHWIQYmXDMXKT4YDNWK8p3ThfxsHHWuBkaIohRo7ohLY1yYgp9lRM Snt6hH/43M84gmH4a/WeqHkyL5Syou8FJCTqxH7jU8Qv0WRbVb234edmFzAlSdx7CQk2uX SlIWMNYVGkwqEh6LA9QApWqz6GJlZ1aZtB5FmyVRpENL0HE2d1nJyUFjnw5i50zBx4GgA5 0vrVbYbTk72EgUabv7Ck9rVwWyX60pQ0+j8Vam75m/6QGuTUSISBMsSW2BYRwg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1794273726; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=NrsW+5TTzv5TV5zy2v6AlMMTWHRCwa0JC9ZSIr2ctFQ=; b=YSVerUWHgbyQjANqR7WZBbPs2ER6QSRTPK0S0FE3BDQ5N4gUAJHwLcmlss9/CxXjVA1kl5 JCPiPoWTA5WpCrgHbmJ1Usbj/fLaRQWj+lbX2OwoEqMdrXd2wejNEFOvtp1PI9nJdUQ5dz SfA0owp+QRU6YOPLYjD3XwVQZyBLDLTND6XdW+yfrulNVhPY1pxNPx8P0LUYE+yCcLjUlo dOeEPMQXiS/cgz2KxXbw/0sbnjoS9xb+5R4npNn3mTizDQ/tQ7qaWQy3uHHgmp7P3Q7/z5 9JUB6/ucNe50lxBsgfLiwdy6g/kszndahWFcH5Brl+7oiQtycttCQnsyRcc7VQ== ARC-Authentication-Results: i=1; mx1.freebsd.org; none Received: from smtpclient.apple (ns1.oxydns.net [45.32.91.63]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) (Authenticated sender: zlei/mail) by smtp.freebsd.org (Postfix) with ESMTPSA id 4jNplw6RdnzZT2; Tue, 10 Nov 2026 01:22:04 +0000 (UTC) (envelope-from zlei@FreeBSD.org) Content-Type: text/plain; charset=us-ascii 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 (Mac OS X Mail 16.0 \(3696.120.41.1.10\)) Subject: Re: git: 86861520613f - main - ipfilter: Remove erroneous ntohs() From: Zhenlei Huang In-Reply-To: <6af255c9.9db2.513e412b@gitrepo.freebsd.org> Date: Tue, 10 Nov 2026 09:22:00 +0800 Cc: "src-committers@freebsd.org" , "dev-commits-src-all@freebsd.org" , "dev-commits-src-main@freebsd.org" Content-Transfer-Encoding: quoted-printable Message-Id: <80FDAF52-6DB4-4707-9C94-C1A5092604A3@FreeBSD.org> References: <6af255c9.9db2.513e412b@gitrepo.freebsd.org> To: Cy Schubert X-Mailer: Apple Mail (2.3696.120.41.1.10) > On Nov 10, 2026, at 7:22 AM, Cy Schubert wrote: >=20 > The branch main has been updated by cy: >=20 > URL: = https://cgit.FreeBSD.org/src/commit/?id=3D86861520613f99c85b5fbdf92b5c955a= 13ed6624 >=20 > commit 86861520613f99c85b5fbdf92b5c955a13ed6624 > Author: Cy Schubert > AuthorDate: 2026-11-09 23:13:21 +0000 > Commit: Cy Schubert > CommitDate: 2026-11-09 23:22:44 +0000 >=20 > ipfilter: Remove erroneous ntohs() >=20 > The original commit was wrong. ipf_nat_builddivertmp() builds the = UDP > template with the length in host byte order But ipf_nat_builddivertmp() build the ip header with network byte order, ``` ip->ip_len =3D htons(len); ``` I'd prefer consistent byte orders ( all in network byte order if = possible ) to make the maintenance easier. >=20 > M_DUP() copies that value unchanged. The old code was therefore = correct. > It added fin_plen in host order and then did a single htons(). >=20 > The original patch was discussed with Co-Pilot, which pointed out = the > original bug. claude-opus-5-5 discovered the ntohs() error that > co-pilot suggested. >=20 > Interestingly this code had been running here for a couple of = months. >=20 > Reported by: llm-postcr > Fixes: 72cc9e3766f4 > --- > sys/netpfil/ipfilter/netinet/ip_nat.c | 1 - > 1 file changed, 1 deletion(-) >=20 > diff --git a/sys/netpfil/ipfilter/netinet/ip_nat.c = b/sys/netpfil/ipfilter/netinet/ip_nat.c > index c8125c10e3f0..4b4890587f53 100644 > --- a/sys/netpfil/ipfilter/netinet/ip_nat.c > +++ b/sys/netpfil/ipfilter/netinet/ip_nat.c > @@ -5156,7 +5156,6 @@ ipf_nat_out(fr_info_t *fin, nat_t *nat, int = natadd, u_32_t nflags) >=20 > if (ip->ip_p =3D=3D IPPROTO_UDP) { > uh =3D (udphdr_t *)(ip + 1); > - uh->uh_ulen =3D ntohs(uh->uh_ulen); > uh->uh_ulen +=3D fin->fin_plen; > uh->uh_ulen =3D htons(uh->uh_ulen); > } >=20 Best regards, Zhenlei