From e079ba1ad3172efc7a8c5a32e8a3c9160e4a09c6 Mon Sep 17 00:00:00 2001 From: Meta Vens Date: Wed, 30 Sep 2026 13:52:26 +0200 Subject: [PATCH] cultmesh-kotlin: the bind self-test observes a wildcard, not its family A JVM wildcard socket is dual-stack, so a client bound to 0.0.0.0 reports the IPv6 wildcard as its local address and the self-test's first check failed on Linux. Assert that a client for a remote endpoint binds a wildcard, and keep the exact loopback checks. Co-Authored-By: Claude Opus 5.5 --- .../src/main/kotlin/org/gamecult/cultmesh/CultMesh.kt | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/packages/cultmesh-kotlin/src/main/kotlin/org/gamecult/cultmesh/CultMesh.kt b/packages/cultmesh-kotlin/src/main/kotlin/org/gamecult/cultmesh/CultMesh.kt index 3197bb24..368b5338 100644 --- a/packages/cultmesh-kotlin/src/main/kotlin/org/gamecult/cultmesh/CultMesh.kt +++ b/packages/cultmesh-kotlin/src/main/kotlin/org/gamecult/cultmesh/CultMesh.kt @@ -5400,14 +5400,16 @@ private fun rudpClientBoundHost(endpoint: String, bindHost: String? = null): Ine } // A client bound to loopback cannot send to another host on Windows, so a -// client for a remote endpoint binds the unspecified address of its family. +// client for a remote endpoint binds the unspecified address. A JVM wildcard +// socket is dual-stack and reports one wildcard for either family, so the +// family is not observable here. private fun rudpClientBindsLoopbackOnlyForALoopbackEndpoint() { - check(rudpClientBoundHost("rudp://10.77.0.1:17872") == InetAddress.getByName("0.0.0.0")) - check(rudpClientBoundHost("rudp://[2001:db8::1]:17872") == InetAddress.getByName("::")) + check(rudpClientBoundHost("rudp://10.77.0.1:17872").isAnyLocalAddress) + check(rudpClientBoundHost("rudp://[2001:db8::1]:17872").isAnyLocalAddress) check(rudpClientBoundHost("rudp://127.0.0.1:17872") == InetAddress.getByName("127.0.0.1")) check(rudpClientBoundHost("rudp://[::1]:17872") == InetAddress.getByName("::1")) check(rudpClientBoundHost("rudp://10.77.0.1:17872", "127.0.0.1") == InetAddress.getByName("127.0.0.1")) - check(rudpClientBoundHost("rudp://127.0.0.1:17872", "0.0.0.0") == InetAddress.getByName("0.0.0.0")) + check(rudpClientBoundHost("rudp://127.0.0.1:17872", "0.0.0.0").isAnyLocalAddress) CultMesh.createRudpServer("kotlin-rudp-bind-server", 0x10203061L).use { server -> check(InetAddress.getByName(server.profile.transports.single().host) == InetAddress.getByName("127.0.0.1")) }