Skip to content

Commit 4b4d6b8

Browse files
Fixed large number of SERVFAILs (#413)
* removed suspicious code, test case passing. Need to confirm why that was added * remove unused fn
1 parent 0a02b64 commit 4b4d6b8

File tree

2 files changed

+0
-56
lines changed

2 files changed

+0
-56
lines changed

src/zdns/lookup.go

-24
Original file line numberDiff line numberDiff line change
@@ -404,30 +404,6 @@ func (r *Resolver) cachedRetryingLookup(ctx context.Context, q Question, nameSer
404404
}
405405
}
406406

407-
// Now, we check the authoritative:
408-
name := strings.ToLower(q.Name)
409-
layer = strings.ToLower(layer)
410-
authName, err := nextAuthority(name, layer)
411-
if err != nil {
412-
var r SingleQueryResult
413-
return r, isCached, StatusAuthFail, 0, err
414-
}
415-
if name != layer && authName != layer {
416-
if authName == "" {
417-
var r SingleQueryResult
418-
return r, isCached, StatusAuthFail, 0, nil
419-
}
420-
var qAuth Question
421-
qAuth.Name = authName
422-
qAuth.Type = dns.TypeNS
423-
qAuth.Class = dns.ClassINET
424-
425-
if cachedResult, ok = r.cache.GetCachedResult(qAuth, true, depth+2); ok {
426-
isCached = true
427-
return cachedResult, isCached, StatusNoError, 0, nil
428-
}
429-
}
430-
431407
// Alright, we're not sure what to do, go to the wire.
432408
result, status, try, err := r.retryingLookup(ctx, q, nameServer, false)
433409

src/zdns/util.go

-32
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@
1515
package zdns
1616

1717
import (
18-
"errors"
1918
"fmt"
2019
"net"
2120
"strings"
@@ -56,37 +55,6 @@ func nameIsBeneath(name, layer string) (bool, string) {
5655
return false, ""
5756
}
5857

59-
func nextAuthority(name, layer string) (string, error) {
60-
// We are our own authority for PTRs
61-
// (This is dealt with elsewhere)
62-
if strings.HasSuffix(name, "in-addr.arpa") && layer == "." {
63-
return "in-addr.arpa", nil
64-
}
65-
66-
idx := strings.LastIndex(name, ".")
67-
if idx < 0 || (idx+1) >= len(name) {
68-
return name, nil
69-
}
70-
if layer == "." {
71-
return name[idx+1:], nil
72-
}
73-
74-
if !strings.HasSuffix(name, layer) {
75-
return "", errors.New("server did not provide appropriate resolvers to continue recursion")
76-
}
77-
78-
// Limit the search space to the prefix of the string that isnt layer
79-
idx = strings.LastIndex(name, layer) - 1
80-
if idx < 0 || (idx+1) >= len(name) {
81-
// Out of bounds. We are our own authority
82-
return name, nil
83-
}
84-
// Find the next step in the layer
85-
idx = strings.LastIndex(name[0:idx], ".")
86-
next := name[idx+1:]
87-
return next, nil
88-
}
89-
9058
func checkGlue(server string, result SingleQueryResult) (SingleQueryResult, Status) {
9159
for _, additional := range result.Additional {
9260
ans, ok := additional.(Answer)

0 commit comments

Comments
 (0)