From nobody Thu Jun 20 16:30:32 2024 X-Original-To: bugs@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 4W4mF45hJFz5P4w1 for ; Thu, 20 Jun 2024 16:30:32 +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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4W4mF440ghz4n35 for ; Thu, 20 Jun 2024 16:30:32 +0000 (UTC) (envelope-from bugzilla-noreply@freebsd.org) ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1718901032; a=rsa-sha256; cv=none; b=Ika+Pjo9PQEsHhW9ZOt+IjSOvr/r5JauMSrbsZOtSpaPVC7FF8aECpIUongcBSQtpBGuHU QKTYEdg/VELpIEfNHwGASpoAL8Wv61t0WOZmoEc1yPw25u52rFPhkNxlVzYY1o/UgqWmnq fT8kspiV0R+1cgBmX5AEZSK1UWYzVmZ9OrBaXIW4wi4IeOUHB+77KPEnSniSDMIqmrZy4m B1P7+B0O9DKMaRQVwCXmBQtQgobPdH+VZ6betqIzNwQMHuBpZjf6uUcCMAE7ao+3AD8eiL xLdUZyWuXuVEtayYkGarqjQ8E7vokEX8xFO/ewBkgIiI4iPS90HTGjht/2B8QA== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1718901032; 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=DiGHGL47BuJDKv+pgakdBKM6H95aRFvEm6UNT0yUkSs=; b=Id8PjNsCtmtv+jkrC7yMseiKYYyAxCysa4UJRYrSrnvJ+ZQk7i6Uny2lPrUaipjkKFGkFq h0E6hdy40xnlKc+CJWVVQHQxG3kL4csjgZ6Bh3raPyDYRLD/hCe9u7GLWEPKyJPacZisRG NAU3UGUmUv3BzzXoSaJbusVbEHYpLfCvnqPw/hq7+DbJ/O0IzAth5e//uTkSRwQhWomB3g zEyBvrvS/erLYEnC0WCpytSoVT2/dBfjr8NmUDXrcTJ+c/Pi2CizrDayZwECrwdWWEZUTo 5qIKg++jOR1hWQhimsQgI16mb6sk1hzOh0AyHFXijA/GFKjob5bbp0rs8wi16w== 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 4W4mF43KTNzXtB for ; Thu, 20 Jun 2024 16:30:32 +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 45KGUW2Y013486 for ; Thu, 20 Jun 2024 16:30:32 GMT (envelope-from bugzilla-noreply@freebsd.org) Received: (from www@localhost) by kenobi.freebsd.org (8.15.2/8.15.2/Submit) id 45KGUWgo013485 for bugs@FreeBSD.org; Thu, 20 Jun 2024 16:30:32 GMT (envelope-from bugzilla-noreply@freebsd.org) X-Authentication-Warning: kenobi.freebsd.org: www set sender to bugzilla-noreply@freebsd.org using -f From: bugzilla-noreply@freebsd.org To: bugs@FreeBSD.org Subject: [Bug 279881] socket support for IPv4-mapped IPv6 misbehave Date: Thu, 20 Jun 2024 16:30:32 +0000 X-Bugzilla-Reason: AssignedTo X-Bugzilla-Type: new X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: Base System X-Bugzilla-Component: kern X-Bugzilla-Version: 14.1-STABLE X-Bugzilla-Keywords: X-Bugzilla-Severity: Affects Many People X-Bugzilla-Who: zonyitoo@gmail.com X-Bugzilla-Status: New X-Bugzilla-Resolution: X-Bugzilla-Priority: --- X-Bugzilla-Assigned-To: bugs@FreeBSD.org X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: bug_id short_desc product version rep_platform op_sys bug_status bug_severity priority component assigned_to reporter Message-ID: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Bugzilla-URL: https://bugs.freebsd.org/bugzilla/ Auto-Submitted: auto-generated List-Id: Bug reports List-Archive: https://lists.freebsd.org/archives/freebsd-bugs List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-freebsd-bugs@FreeBSD.org MIME-Version: 1.0 https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=3D279881 Bug ID: 279881 Summary: socket support for IPv4-mapped IPv6 misbehave Product: Base System Version: 14.1-STABLE Hardware: Any OS: Any Status: New Severity: Affects Many People Priority: --- Component: kern Assignee: bugs@FreeBSD.org Reporter: zonyitoo@gmail.com When using IPv4-mapped IPv6 address with socket, no matter sysctl net.inet6.ip6.v6only was set to 0 or 1, operations will always success. Here is a test program in Python: import socket s =3D socket.socket(socket.AF_INET6, socket.SOCK_DGRAM, 0) s.setsockopt(socket.IPPROTO_IPV6, socket.IPV6_V6ONLY, 0) s.connect(('::ffff:169.254.1.1', 53)) print(s.getsockname()) 1. No matter net.inet6.ip6.v6only was set to 0 or 1, the program above will always run without any errors. 2. No matter net.inet6.ip6.v6only was set to 0 or 1, delete the call setsockopt(IPV6_V6ONLY) will always run without any errors. (UNEXPECTED) 3. If changed the set(IPV6_V6ONLY) line to 1, then the connect() call will = fail with an EINVAL error. (EXPECTED) Based on my experience on Linux, if sockopt IPV6_V6ONLY was not set explici= tly, it should derived from the system's global configuration, in FreeBSD it sho= uld be net.inet6.ip6.v6only. Here is another problem, which I think it should be a special design in FreeBSD: If net.inet6.ip6.v6only was set to 1, even the problem like above could run without error, and then send packets to the target address (IPv4-mapped IPv= 6) with sendto(), the target socket couldn't receive the packet from recvfrom(= ). I suspected that it is because net.inet6.ip6.v6only=3D1 disables routing IPv4-mapped IPv6 to IPv4 target. Overall, in this issue I want to suggest: 1. sockopt IPV6_V6ONLY default value should derive from net.inet6.ip6.v6only 2. If sockopt IPV6_V6ONLY was set to 0 explicitly, then IPv4-mapped IPv6 packets send from or receive by this socket should be allowed / properly routed. --=20 You are receiving this mail because: You are the assignee for the bug.=