Match the tailnet device name to the conf hostname by unambiguous prefix

master.conf says unRAID-Jayred36 and the tailnet device is unraid-jayred365, so the exact-key lookup found nothing and every remote card rendered with no IP, no online state and no containers.
This commit is contained in:
Gmer4Lfe
2026-08-17 14:41:35 -04:00
parent 90f3b0b7da
commit d417bd5360
+21 -1
View File
@@ -408,8 +408,28 @@ function vv_pt_nodes(): array {
$isOwner = (strtolower($ownerSlot) === $slot);
// Tailscale
//
// Exact key first, then a single unambiguous prefix match in either direction. The
// tailnet name and the OS hostname are not the same string and nothing keeps them in
// step: this mesh has master.conf saying "unRAID-Jayred36" while the tailnet device is
// "unraid-jayred365". An exact-key lookup found nothing, so every remote card rendered
// with no IP, no online state and no container count — a partner that was answering SSH
// the whole time displayed as though it were not there.
//
// Same rule as vv_resolve_tailscale_ip(), and the same refusal: one candidate or none.
// server1 must never resolve to server10 because it happens to share a prefix.
$tsLabel = strtolower($hostname);
$ts = $tsPeers[$tsLabel] ?? ['online' => null, 'active' => false, 'ip' => null];
$ts = $tsPeers[$tsLabel] ?? null;
if ($ts === null) {
$cand = [];
foreach ($tsPeers as $peerName => $peer) {
if (str_starts_with($peerName, $tsLabel) || str_starts_with($tsLabel, $peerName)) {
$cand[] = $peer;
}
}
if (count($cand) === 1) $ts = $cand[0];
}
if ($ts === null) $ts = ['online' => null, 'active' => false, 'ip' => null];
// Fallback state
$fbState = 'UNKNOWN';