From nobody Sat Oct 25 04:30:37 2025 X-Original-To: net@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 4ctmzK0y9Sz6DnvL for ; Sat, 25 Oct 2025 04:30:37 +0000 (UTC) (envelope-from bugzilla-noreply@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 "R12" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4ctmzJ6msnz45H5 for ; Sat, 25 Oct 2025 04:30:36 +0000 (UTC) (envelope-from bugzilla-noreply@freebsd.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1761366637; 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: in-reply-to:in-reply-to:references:references; bh=6O007JkZjUndTwPpFjTRDggKgucAD/CVAWpup4oIHz0=; b=FoOUI385uQsvZR5AyXYPAUP2t6C1vNe8RqKQz/NBWykKL5zqFQ+W3XDMJfCr0W+6Dxvb8u I20LSFzgIy8TKEDKQLIiVlH1lIj0YYqmtiZBUtjg0JClOENN655uVEXWCkS/u7Awlr0S0a PYQmaPZ1EtupXFCmaVpgbtos+ldO6BmZqVYtYmlZS1W+oPmGP+venjV4Ir+k96GU+XoASI 2hVO40Fyxczl/1dfwFgv3kmUUJCPL5i94U+nIzp0fk+8T15SOYDEm/8QM9LIuPOGJvsNO4 Tgd3Xy+PVs5yxYrp7FYxXXTVYk1WsRE6PbKqtCMfQWJjUK/lyleZ3XYWffaeAA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1761366637; 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: in-reply-to:in-reply-to:references:references; bh=6O007JkZjUndTwPpFjTRDggKgucAD/CVAWpup4oIHz0=; b=awl7o4QVdJGHLQv3/rhybMjGt/XQInutIAWhoFa//KXJyRua0DHEatKuqt8JYhNvALrDKT 4/WsxUKrRI5pGEZOgsu/XA2a17lSLQd/jcI8Yd+zCEX2cRcBjtQQSoFFcgDigX6bcjeGYQ Qre0gbqg9jJ7NKQw/KZUhFlBZ7QRMjeCYhXfvVx26UYtO4fod/pI88tjRLUqCGEMu8uHQ2 t5RTWvLJmBzrIacf1a9Pucn5IKm4iyABnd4w1rKT/krDPtRdAoxlmNxAIfdNjVwOkcm0oa hYxCxJ5y+TVCw2WwnE7k42UaKymX0gws3GYHtp+QImYBUxsXYDeMD6l/6eZ0zw== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1761366637; a=rsa-sha256; cv=none; b=OLVAp+Ml5pyP2GNxgesc2bkk/13tcGukbGTcEPQfwMyuNwG7L56dxO7ZTYiv71W8CcSi24 gCcp0vXFKUdVhBKnbQWFsLCIDBk2jUy9Ur/zksH2XdD3cGJ26FWlp4+myeI+wcQAYWkR6L LepI9raWu5RF6lLuPamRA6LQ/+cZFik+ACxFq/5KNRfGIGx58UuGN/YNjA0JfnT8zUQ8Ml MsZVLunfjnhdnmy53sxO9djuHGqmDn5y53IWqY9oOFEK01T3vrN5627n6uFDj5ZKTlDEP/ +c79FzI+/pV3RVgLxtKQFejVxhcAc6NfEylzRhYFI+yuSHUdWYVuYP+u2duAUg== ARC-Authentication-Results: i=1; mx1.freebsd.org; none Received: from kenobi.freebsd.org (kenobi.freebsd.org [IPv6:2610:1c1:1:606c::50:1d]) (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 4ctmzJ64v7zXTv for ; Sat, 25 Oct 2025 04:30:36 +0000 (UTC) (envelope-from bugzilla-noreply@freebsd.org) Received: from kenobi.freebsd.org ([127.0.1.5]) by kenobi.freebsd.org (8.15.2/8.15.2) with ESMTP id 59P4UauD093580 for ; Sat, 25 Oct 2025 04:30:36 GMT (envelope-from bugzilla-noreply@freebsd.org) Received: (from bugzilla@localhost) by kenobi.freebsd.org (8.15.2/8.15.2/Submit) id 59P4UaiM093579 for net@FreeBSD.org; Sat, 25 Oct 2025 04:30:36 GMT (envelope-from bugzilla-noreply@freebsd.org) X-Authentication-Warning: kenobi.freebsd.org: bugzilla set sender to bugzilla-noreply@freebsd.org using -f From: bugzilla-noreply@freebsd.org To: net@FreeBSD.org Subject: [Bug 289198] inet_net_pton is broken with AF_INET6 Date: Sat, 25 Oct 2025 04:30:37 +0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: Base System X-Bugzilla-Component: bin X-Bugzilla-Version: 14.3-RELEASE X-Bugzilla-Keywords: X-Bugzilla-Severity: Affects Only Me X-Bugzilla-Who: commit-hook@FreeBSD.org X-Bugzilla-Status: In Progress X-Bugzilla-Resolution: X-Bugzilla-Priority: --- X-Bugzilla-Assigned-To: ivy@FreeBSD.org X-Bugzilla-Flags: mfc-stable15+ mfc-stable14? mfc-stable13? X-Bugzilla-Changed-Fields: Message-ID: In-Reply-To: References: Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="UTF-8" X-Bugzilla-URL: https://bugs.freebsd.org/bugzilla/ Auto-Submitted: auto-generated List-Id: Networking and TCP/IP with FreeBSD List-Archive: https://lists.freebsd.org/archives/freebsd-net List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-freebsd-net@FreeBSD.org MIME-Version: 1.0 https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=3D289198 --- Comment #7 from commit-hook@FreeBSD.org --- A commit in branch stable/14 references this bug: URL: https://cgit.FreeBSD.org/src/commit/?id=3Db4871be3490de56975777079c1767d1fd= 346ac7a commit b4871be3490de56975777079c1767d1fd346ac7a Author: Lexi Winter AuthorDate: 2025-10-18 14:18:40 +0000 Commit: Lexi Winter CommitDate: 2025-10-25 04:29:04 +0000 libc: Import OpenBSD's inet_net_{ntop,pton} Our versions of these functions (originally taken from BIND) simply don't work correctly for AF_INET6. These were removed from BIND itself quite a while ago, but OpenBSD has made several fixes in the mean time, so import their code. Add tests for both functions. PR: 289198 Reported by: Nico Sonack MFC after: 1 week Reviewed by: des Obtained from: OpenBSD (lib/libc/net) Sponsored by: https://www.patreon.com/bsdivy Differential Revision: https://reviews.freebsd.org/D52629 (cherry picked from commit 8f4a0d2f7b96099001dbc51e06114df1a0e6d291) inet_net_test: Compare pointers against nullptr GCC does not like passing NULL (__null) to std::ostringstream::operator= << inside of ATF_REQUIRE_EQ: lib/libc/tests/net/inet_net_test.cc: In member function 'virtual void {anonymous}::atfu_tc_inet_net_ntop_invalid::body() const': lib/libc/tests/net/inet_net_test.cc:306:9: error: passing NULL to non-pointer argument 1 of 'std::__1::basic_ostream<_CharT, _Traits>& std::__1::basic_ostream<_CharT, _Traits>::operator<<(long int) [with _CharT= =3D char; _Traits =3D std::__1::char_traits]' [-Werror=3Dconversion-null] 306 | ATF_REQUIRE_EQ(ret, NULL); | ^~~~~~~~~~~~~~ In file included from /usr/obj/.../amd64.amd64/tmp/usr/include/c++/v1/sstream:317, from /usr/obj/.../amd64.amd64/tmp/usr/include/atf-c++/macros.hpp:29, from /usr/obj/.../amd64.amd64/tmp/usr/include/atf-c++.hpp:29, from lib/libc/tests/net/inet_net_test.cc:33: =20=20=20 /usr/obj/.../amd64.amd64/tmp/usr/include/c++/v1/__ostream/basic_ostream.h:3= 38:81: note: declared here 338 | basic_ostream<_CharT, _Traits>& basic_ostream<_CharT, _Traits>::operator<<(long __n) { |=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20= =20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20= =20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20 ~~~~~^~~ ... Fixes: 8f4a0d2f7b96 ("libc: Import OpenBSD's inet_net_{ntop,pton}") (cherry picked from commit aa358ce3ca8e1fcfb305025fd00beb2a119c7c77) inet_net_test: Use int to hold expected return values from inet_net_pton GCC warns about the sign mismatch in comparisons: lib/libc/tests/net/inet_net_test.cc: In member function 'virtual void {anonymous}::atfu_tc_inet_net_inet4::body() const': lib/libc/tests/net/inet_net_test.cc:86:17: error: comparison of integer expressions of different signedness: 'int' and 'const unsigned int' [-Werror=3Dsign-compare] 86 | ATF_REQUIRE_EQ(bits, addr.bits); | ^~~~~~~~~~~~~~ lib/libc/tests/net/inet_net_test.cc: In member function 'virtual void {anonymous}::atfu_tc_inet_net_inet6::body() const': lib/libc/tests/net/inet_net_test.cc:205:17: error: comparison of integer expressions of different signedness: 'int' and 'const unsigned int' [-Werror=3Dsign-compare] 205 | ATF_REQUIRE_EQ(bits, addr.bits); | ^~~~~~~~~~~~~~ Fixes: 8f4a0d2f7b96 ("libc: Import OpenBSD's inet_net_{ntop,pton}") (cherry picked from commit e1aeb58cbbc3839db93ec38ce491b7b9383d5649) lib/libc/inet/inet_net_ntop.c | 206 +++++------------ lib/libc/inet/inet_net_pton.c | 363 +++++++++-----------------= ---- lib/libc/tests/net/Makefile | 2 + lib/libc/tests/net/inet_net_test.cc (new) | 333 +++++++++++++++++++++++++++ 4 files changed, 492 insertions(+), 412 deletions(-) --=20 You are receiving this mail because: You are on the CC list for the bug.=