Skip to content

Commit 38af5d3

Browse files
committed
dnsx/plus: m debug logs
1 parent 48c20c6 commit 38af5d3

3 files changed

Lines changed: 20 additions & 6 deletions

File tree

intra/dnsx/alg.go

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1959,6 +1959,14 @@ func idstr(t Transport) string {
19591959
return t.ID().V()
19601960
}
19611961

1962+
func infcsv(ts ...Transport) string {
1963+
var s []string
1964+
for _, t := range ts {
1965+
s = append(s, idstr(t)+":"+getaddrstr(t))
1966+
}
1967+
return strings.Join(s, ",")
1968+
}
1969+
19621970
func getaddrstr(t Transport) string {
19631971
if t == nil {
19641972
return notransport

intra/dnsx/plus.go

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -159,6 +159,11 @@ func (t *plus) ordered() ([]Transport, error) {
159159
ord = append(ord, preferred...)
160160
ord = append(ord, recov...)
161161

162+
ord = core.CopyUniq(ord)
163+
if len(ord) < plusMaxTries {
164+
ord = core.CopyUniq(ord, errored)
165+
}
166+
162167
prev := ord
163168
strat := settings.PlusStrat.Load()
164169
switch strat {
@@ -173,11 +178,12 @@ func (t *plus) ordered() ([]Transport, error) {
173178
}
174179

175180
if len(ord) <= 0 {
176-
log.W("plus: zero transports avail [exp: %d]: errored: %v / ended: %v",
177-
expected, errored, ended)
181+
log.W("plus: strat %d: zero transports avail [exp: %d]: sys? %s / pref: %s / errored: %v / ended: %v",
182+
strat, expected, idstr(sys), infcsv(preferred...), infcsv(errored...), infcsv(ended...))
178183
return nil, errNoSuchTransport
179184
} else if len(ord) < len(prev) {
180-
log.VV("plus: filtered %d < chosen %d; chosen: %v", len(ord), len(prev), ord)
185+
log.VV("plus: strat %d: filtered %d < chosen %d; chosen: %s / pref: %v",
186+
strat, len(ord), len(prev), infcsv(ord...), infcsv(preferred...))
181187
}
182188

183189
return ord, nil
@@ -205,7 +211,7 @@ func (t *plus) forward(network string, q *dns.Msg, outSmm *x.DNSSummary, all ...
205211
defer func() {
206212
fillSummary(finalsmm, outSmm)
207213
if finalans != nil { // suppress errors
208-
log.D("plus: suppressing errors for %s:%d[%s]: %v", qname, qtype, finalsmm.RData, errs)
214+
log.D("plus: suppressing errors for %s:%d[%s]: %v", qname, qtyp, outSmm.RData, errs)
209215
errs = nil
210216
}
211217
}()

intra/dnsx/transport.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -638,8 +638,8 @@ func (r *resolver) forward(q []byte, uid string, chosenids ...string) (res0 []by
638638
}
639639
ansblocked := xdns.AQuadAUnspecified(ans1)
640640

641-
log.V("dns: fwd: 5 for %s[%s]; query %s, smm[data: %s, status: %d]; new-ans? %t, blocklists? %t, blocked? %t",
642-
smm.ID, uid, qname, smm.RData, smm.Status, isnewans, hasblocklists, ansblocked)
641+
log.V("dns: fwd: 5 for %s[%s]; query %s:%d, smm[data: %s, status: %d]; new-ans? %t, blocklists? %t, blocked? %t",
642+
smm.ID, uid, qname, qtyp, smm.RData, smm.Status, isnewans, hasblocklists, ansblocked)
643643

644644
return res2, smm.ID, nil
645645
}

0 commit comments

Comments
 (0)