Skip to content

relay: don't advertise non-global observed addresses#40

Merged
frdomovic merged 1 commit into
masterfrom
fix/ignore-non-global-observed-addrs
Jul 8, 2026
Merged

relay: don't advertise non-global observed addresses#40
frdomovic merged 1 commit into
masterfrom
fix/ignore-non-global-observed-addrs

Conversation

@frdomovic

Copy link
Copy Markdown
Member

Problem

The devnet boot-node (12D3KooWR5V4... @ 63.181.86.34) hands out rendezvous registrations whose relay circuit addresses start with its private VPC IP:

/ip4/10.0.8.121/udp/4001/quic-v1/p2p/12D3KooWR5V4.../p2p-circuit/p2p/<peer>

Root cause: the identify handler blindly promotes every observed_addr to an external address. Any peer in the same VPC (relayer, monitoring, co-located nodes) observes the boot-node's private interface IP and reports it back via identify; the boot-node then advertises it. Relay reservation clients compose their circuit addresses from the relay's advertised addrs, so undialable /ip4/10.x.x.x/.../p2p-circuit records propagate into rendezvous + Kademlia, and NAT-bound peers can't be reached through the relay.

Observed on 2026-07-06 while debugging namespace-invite join failures (calimero-network/core#3211 context): the global-discovery fallback couldn't rescue joins because the discovered circuit addresses pointed at 10.0.8.121.

Fix

Filter observed addresses through a global-reachability check before add_external_address:

  • IPv4: reject private (RFC 1918), loopback, link-local, CGNAT (RFC 6598 100.64/10), unspecified, broadcast, documentation ranges
  • IPv6: reject loopback, unspecified, unique-local (fc00::/7), link-local (fe80::/10)
  • DNS multiaddrs pass through

Rejected addresses are logged at info level so misconfigured deployments stay visible.

Testing

  • 3 new unit tests covering private/special IPv4, non-global IPv6, and global/DNS accept cases (cargo test green)
  • cargo check --release green

Deployment note

This needs a release + AMI rebuild + instance roll to take effect on the devnet relay. Separately, the devnet relay was still returning ResourceLimitExceeded on 2026-07-06, which suggests the instance may still be running a pre-0.8.0 binary despite infrastructure#91 — worth verifying the deployed version while rolling this out.

🤖 Generated with Claude Code

The identify handler added every observed_addr as an external address.
Peers in the same VPC observe the node's private interface IP (e.g.
10.0.8.121), which then gets advertised in relay reservations — clients
compose circuit addresses from the relay's advertised addrs, so
undialable /ip4/10.x.x.x/.../p2p-circuit records end up in rendezvous
and Kademlia, breaking cross-NAT joins via the devnet relay.

Filter observed addresses through a global-reachability check before
adding them: private/loopback/link-local/CGNAT IPv4, and
loopback/ULA/link-local IPv6 are ignored.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@frdomovic frdomovic merged commit facdd5b into master Jul 8, 2026
1 check passed
@frdomovic frdomovic deleted the fix/ignore-non-global-observed-addrs branch July 8, 2026 12:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant