From 29924c13a6c0598bf58b7fc3fae74b10bab0f0ee Mon Sep 17 00:00:00 2001 From: Mateusz Poliwczak Date: Sun, 7 May 2023 15:47:19 +0200 Subject: [PATCH] update --- src/net/dnsclient_unix.go | 22 ++++++++++------------ 1 file changed, 10 insertions(+), 12 deletions(-) diff --git a/src/net/dnsclient_unix.go b/src/net/dnsclient_unix.go index 332dd5cd36e..f3c075c83fd 100644 --- a/src/net/dnsclient_unix.go +++ b/src/net/dnsclient_unix.go @@ -828,6 +828,15 @@ func (r *Resolver) goLookupPTR(ctx context.Context, addr string, order hostLooku } p, server, err := r.lookup(ctx, arpa, dnsmessage.TypePTR, conf) if err != nil { + var dnsErr *DNSError + if errors.As(err, &dnsErr) && dnsErr.IsNotFound { + if order == hostLookupDNSFiles { + names := lookupStaticAddr(addr) + if len(names) > 0 { + return names, nil + } + } + } return nil, err } var ptrs []string @@ -866,16 +875,5 @@ func (r *Resolver) goLookupPTR(ctx context.Context, addr string, order hostLooku } - if len(ptrs) > 0 { - return ptrs, nil - } - - if order == hostLookupDNSFiles { - names := lookupStaticAddr(addr) - if len(names) > 0 { - return names, nil - } - } - - return nil, &DNSError{Err: errNoSuchHost.Error(), Name: addr, IsNotFound: true} + return ptrs, nil }