Skip to content

fix(nat): gate endpoint evidence on external probe - #30

Open
hoshiizumiya wants to merge 2 commits into
masterfrom
feat/natmap-followup
Open

hoshiizumiya wants to merge 2 commits into
masterfrom
feat/natmap-followup

Conversation

@hoshiizumiya

@hoshiizumiya hoshiizumiya commented Oct 2, 2026 •

Copy link
Copy Markdown
Owner

Observed behavior

The NATMap port-test path used the local bound UDP port as the traversal server's external probe target. That is only correct when the NAT preserves the port. The mapping snapshot also had no state that distinguished a STUN observation from independently verified reachability.

Change

  • Probe the STUN-observed public UDP port while keeping the local port as the UI/session identity.
  • Record external probe completion and reachability only when the result still matches the exact local port, public address, public port and observation generation.
  • Invalidate that evidence on network recovery, STUN timeout/failover, endpoint change, stop or restart.
  • Reject a delayed result from an older mapping generation.
  • Keep this as evidence only: do not modify libtorrent announce_port, trackers, DHT, firewall authorization or automatic start behavior.
  • Retain the post-merge validation checkpoint for merge commit 30981bef.

Why this matters

A STUN response describes the mapping toward one STUN server; it does not prove that another Internet endpoint can reach it. Conversely, asking an external server to probe the private/local port can produce the wrong result whenever the NAT rewrites the port. This change creates a trustworthy gate for later endpoint advertisement without advertising anything yet.

Validation

  • NATMap tests 36999821656: all five jobs succeeded for exact HEAD dcc03e50.
  • Downloaded x64 Debug JUnit: tests=4, failures=0, skipped=0; the production udp_mapping test actually executed the new evidence gate and stale-generation checks.
  • Local GCC C++20 parser build passed with ASan/UBSan; leak detection alone was disabled because this workspace restricts /proc.
  • Canary 36999821600: exact HEAD x64/ARM64 application builds are still running and are not yet considered passed.
  • Post-merge baseline remains green:
    • NATMap tests 36972127899: 5/5 jobs succeeded.
    • Canary 36972127871: Release x64/ARM64, x64 native-unit build, artifacts and prerelease succeeded.

This PR remains intentionally draft. It does not modify master, the merged PR #26 branch, or packaging configuration; AppxBundle=Never remains unchanged.

@hoshiizumiya hoshiizumiya changed the title docs(nat): record post-merge validation fix(nat): gate endpoint evidence on external probe Oct 2, 2026
@hoshiizumiya
hoshiizumiya marked this pull request as ready for review October 3, 2026 10:05
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