Skip to content

Commit 7a648fe

Browse files
committed
Fix ineffectual assignment to answers
1 parent e838aee commit 7a648fe

File tree

1 file changed

+4
-15
lines changed

1 file changed

+4
-15
lines changed

netbox.go

Lines changed: 4 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ func (n *Netbox) ServeDNS(ctx context.Context, w dns.ResponseWriter, r *dns.Msg)
7171
// server handling the request.
7272
requestCount.WithLabelValues(metrics.WithServer(ctx)).Inc()
7373

74-
answers := []dns.RR{}
74+
var answers []dns.RR
7575

7676
// check record type here and bail out if not A, AAAA or PTR
7777
switch state.QType() {
@@ -94,21 +94,10 @@ func (n *Netbox) ServeDNS(ctx context.Context, w dns.ResponseWriter, r *dns.Msg)
9494
return dnserror(dns.RcodeServerFailure, state, err)
9595
}
9696

97-
if len(answers) == 0 {
98-
// always fallthrough if configured
99-
if n.Fall.Through(qname) {
100-
return plugin.NextOrFailure(n.Name(), n.Next, ctx, w, r)
101-
}
102-
103-
if err != nil {
104-
// return SERVFAIL here without fallthrough
105-
return dnserror(dns.RcodeServerFailure, state, err)
106-
}
107-
108-
// otherwise return NXDOMAIN
109-
return dnserror(dns.RcodeNameError, state, nil)
97+
if err != nil {
98+
// return SERVFAIL here without fallthrough
99+
return dnserror(dns.RcodeServerFailure, state, err)
110100
}
111-
112101
// create DNS response
113102
m := new(dns.Msg)
114103
m.SetReply(r)

0 commit comments

Comments
 (0)