Skip to content

Commit 74da9e0

Browse files
committed
Improve DNS server error handling for non-Tailscale clients
- Enhance logging to indicate fallback to server grants when whois lookup fails for non-Tailscale clients. - Implement logic to return server grants in case of a whois failure, ensuring continued functionality.
1 parent 2dcdc12 commit 74da9e0

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

internal/dns/server.go

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -377,7 +377,12 @@ func (s *Server) getGrantsForSource(ctx context.Context, addr string) ([]grants.
377377
return s.LocalClient.WhoIs(whoisCtx, host)
378378
})
379379
if err != nil {
380-
return nil, fmt.Errorf("whois lookup: %w", err)
380+
// For non-Tailscale clients, fall back to server's own grants
381+
s.Logf("[v] whois failed for %s (%v), using server grants", host, err)
382+
s.grantsMu.RLock()
383+
serverGrants := s.serverGrants
384+
s.grantsMu.RUnlock()
385+
return serverGrants, nil
381386
}
382387

383388
identity := s.getIdentity(whois)

0 commit comments

Comments
 (0)