diff options
| author | James Tucker <james@tailscale.com> | 2025-03-10 10:04:19 -0700 |
|---|---|---|
| committer | James Tucker <james@tailscale.com> | 2025-03-10 10:04:19 -0700 |
| commit | b267bc5e79c58c5b3071fc8213110350070531c7 (patch) | |
| tree | bab858b4e7898028ac1ba9bf505afd292dd58e80 | |
| parent | 5f515a3731a8f08a185d69d57fb66bf69e79561e (diff) | |
| download | tailscale-raggi/natc-6.tar.xz tailscale-raggi/natc-6.zip | |
cmd/natc: add an explicit error for missing peer stateraggi/natc-6
Updates tailscale/corp#26968
Signed-off-by: James Tucker <james@tailscale.com>
| -rw-r--r-- | cmd/natc/natc.go | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/cmd/natc/natc.go b/cmd/natc/natc.go index 73ba116ff..5bf5ae360 100644 --- a/cmd/natc/natc.go +++ b/cmd/natc/natc.go @@ -347,7 +347,11 @@ var tsMBox = dnsmessage.MustNewName("support.tailscale.com.") // generateDNSResponse generates a DNS response for the given request. The from // argument is the NodeID of the node that sent the request. func (c *connector) generateDNSResponse(req *dnsmessage.Message, from tailcfg.NodeID) ([]byte, error) { - pm, _ := c.perPeerMap.LoadOrStore(from, &perPeerState{c: c}) + pm, ok := c.perPeerMap.LoadOrStore(from, &perPeerState{c: c}) + if !ok { + // TODO(raggi): consider returning NXDOMAIN, but it is likely this result does not want to be cached. + return nil, fmt.Errorf("missing peer state for %s, unable to answer query: %v", from, req) + } var addrs []netip.Addr if len(req.Questions) > 0 { switch req.Questions[0].Type { |
