12 Commits
Author SHA1 Message Date
iceBear67 ac27db76f9 fix: connectivity check fails on split-DNS destinations at startup
The diagnostics never got the split-DNS fix from 20097a0. That commit
  taught the dial path to resolve through the tailnet's own resolver
  (resolveDialAddr) but left getPeerFromRules on resolveAddr, so the two
  disagreed about how to look a destination up: connecting through a
  split-DNS name worked while the startup check called it unresolvable.

  Both paths now share resolveHostToIP, which honors MagicDNS, split-DNS
  routes and the DoH fallback.

  The check also resolved once at startup and cached the result for the
  process lifetime. tsnet reports Running before the netmap's DNS config
  reaches its resolver, and accept-routes is only applied after Up()
  returns, so a split-DNS name can fail for the first few seconds and
  resolve fine after. That transient failure dropped the peer permanently
  -- and when every rule failed, the goroutine returned and diagnostics
  never ran at all. Peers are re-resolved every round now, with a warm-up
  retry so the first report waits for DNS rather than racing it.

  Destinations outside the tailnet are no longer reported as failures.
  mc.lxns.net resolves fine but belongs to no peer, which is not an error,
  just not something to ping. errNotTailnetPeer separates "cannot resolve"
  from "resolved, not a peer"; only the former is retried or warned about.
  Unresolved rules now log their tag and dst, which the old message
  omitted entirely.

  Also fixed:

    * NormalizeDstAddrWithSuffix passed "host:port" to resolveAddr, so
      every existence check failed on the stray colon. Fixing that made
      the pass wait on cold-start DNS and delayed the listeners by ~5s,
      so it is now bounded by normalizeDNSBudget.

    * Peer lookup matched any AllowedIPs prefix containing the address.
      An exit node advertises 0.0.0.0/0, which contains everything, so a
      tailnet with an exit node picked the wrong peer at random depending
      on map iteration order. Default routes are skipped, the most
      specific route wins, ties break deterministically.

    * peer.AllowedIPs is a nillable pointer, dereferenced unguarded.
2026-07-26 14:52:14 +08:00
nc 125bc4bf3d feat(utils): resolveAddr can resolve subnet ip at domain properly 2026-06-05 03:56:52 +08:00
nc 390946e0a2 fix(utils): normalizer cannot handle domain with dot
such as cm.any->cm.any.ts.net
2026-06-05 02:35:09 +08:00
nullcat 186e29663e chore(utils): remove deprecated code 2026-06-01 16:32:46 +08:00
nullcat e60a6b76c7 feat(utils): implement MagicDNS suffix handling and normalization for dst_addr
- Added support for extracting and setting MagicDNS suffix.
- Normalized `dst_addr` using the MagicDNS suffix to simplify configuration.
- Improved logging for normalized and failed addresses during `connect` rule processing.
2026-06-01 16:07:23 +08:00
nullcat da17faa6dc fix(utils): adjust getPeerInfo position 2026-05-30 17:11:44 +08:00
nullcat c853084a7b fix(utils): move ping logic after peer info lookup and deduplicate address retrieval logic 2026-05-29 14:56:17 +08:00
nullcat 4dde0942ce fix(utils): panic on ping logic 2026-05-29 14:31:32 +08:00
nullcat f97540b8d0 chore(utils): add remote name into ping logger 2026-05-25 15:12:31 +08:00
nullcat d12ad615cf feat(utils): add timeout on ping request 2026-05-24 23:38:46 +08:00
nullcat 56f37faa84 feat(main): add connectivityCheck for diagnostics 2026-05-18 15:04:48 +08:00
nullcat 15bda1a807 fix(main): node expired when system sleep too long 2026-05-18 04:04:11 +08:00