mirror of
https://github.com/tailscale/tailscale.git
synced 2025-07-30 07:43:42 +00:00
cmd/natc: add an explicit error for missing peer state
Updates tailscale/corp#26968 Signed-off-by: James Tucker <james@tailscale.com>
This commit is contained in:
parent
5f515a3731
commit
b267bc5e79
@ -347,7 +347,11 @@ var tsMBox = dnsmessage.MustNewName("support.tailscale.com.")
|
|||||||
// generateDNSResponse generates a DNS response for the given request. The from
|
// generateDNSResponse generates a DNS response for the given request. The from
|
||||||
// argument is the NodeID of the node that sent the request.
|
// argument is the NodeID of the node that sent the request.
|
||||||
func (c *connector) generateDNSResponse(req *dnsmessage.Message, from tailcfg.NodeID) ([]byte, error) {
|
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
|
var addrs []netip.Addr
|
||||||
if len(req.Questions) > 0 {
|
if len(req.Questions) > 0 {
|
||||||
switch req.Questions[0].Type {
|
switch req.Questions[0].Type {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user