mirror of
https://github.com/EasyTier/EasyTier.git
synced 2026-05-07 10:14:35 +00:00
9e9916efa5
When two EasyTier instances run on the same machine and share the same network, the direct connector would expand a remote peer's 0.0.0.0 listener into local interface IPs and then attempt to connect to itself, causing an infinite loop of failed connection attempts. The existing `peer_id != my_peer_id` guard does not cover this case because the two instances have different peer IDs despite sharing the same physical network interfaces. Fix by adding a self-connection check in `spawn_direct_connect_task`: before spawning a connect task, compare the candidate (scheme, IP, port) against the local running listeners. If a local listener matches on all three dimensions — accounting for 0.0.0.0/:: wildcards by checking membership in the local interface IP sets — the candidate is silently dropped with a DEBUG log message. The fix covers all four code paths: - IPv4 unspecified (0.0.0.0) expansion loop - IPv4 specific-address branch - IPv6 unspecified (::) expansion loop - IPv6 specific-address branch The TESTING flag logic is untouched so existing unit tests are unaffected. * refactor(connector): replace is_self_connect closure with GlobalCtx::should_deny_proxy (#1954) --------- Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com> Co-authored-by: Copilot <198982749+Copilot@users.noreply.github.com>