-
Notifications
You must be signed in to change notification settings - Fork 12
Open
Description
Summary
The IPv6 addresses used for offline connectivity checks are incorrect. The address groups are written as decimal literals in Rust, but IPv6 groups are hexadecimal values. This causes connections to completely wrong addresses, making IPv6 offline detection non-functional.
The Bug
In crates/utils/src/net.rs, the IPv6 addresses are defined like:
SocketAddr::from(([2606, 4700, 4700, 0, 0, 0, 0, 1111], 53)) // Intended: Cloudflare 2606:4700:4700::1111
SocketAddr::from(([2001, 4860, 4860, 0, 0, 0, 0, 8888], 53)) // Intended: Google 2001:4860:4860::8888
However, Rust interprets these as decimal values, not hex:
2606decimal =0x0a2ehex4700decimal =0x125chex1111decimal =0x0457hex
This produces 0a2e:125c:125c::0457 instead of 2606:4700:4700::1111.
Evidence
With MOON_LOG=trace, the addresses being checked show the mangled values:
[TRACE] starbase_utils::net::offline Resolving [a2e:125c:125c::457]:53
[TRACE] starbase_utils::net::offline Resolving [7d1:12fc:12fc::22b8]:53
These are unroutable addresses that always timeout, causing ~3-4 second delays on IPv6-only networks as each address fails sequentially.
The Fix
Use hex literals:
SocketAddr::from(([0x2606, 0x4700, 0x4700, 0, 0, 0, 0, 0x1111], 53)) // Cloudflare
SocketAddr::from(([0x2606, 0x4700, 0x4700, 0, 0, 0, 0, 0x1001], 53)) // Cloudflare
SocketAddr::from(([0x2001, 0x4860, 0x4860, 0, 0, 0, 0, 0x8888], 53)) // Google
SocketAddr::from(([0x2001, 0x4860, 0x4860, 0, 0, 0, 0, 0x8844], 53)) // Google
Impact
- IPv6 offline detection has never worked correctly
- IPv6-only hosts experience 3-4 second delays on every moon run command
- Each malformed address times out at PROTO_OFFLINE_TIMEOUT (default 750ms) sequentially
Environment
- moon v1.41.7
- IPv6-only network with NAT64
Metadata
Metadata
Assignees
Labels
No labels