mirror of
https://github.com/safing/portmaster
synced 2025-09-02 10:39:22 +00:00
Merge pull request #158 from safing/fix/no-extra-section-dns-response
Fix second write when responding with extra section
This commit is contained in:
commit
03830b4ea7
2 changed files with 3 additions and 3 deletions
|
@ -53,7 +53,7 @@ func writeDNSResponse(w dns.ResponseWriter, m *dns.Msg) (err error) {
|
||||||
}()
|
}()
|
||||||
|
|
||||||
err = w.WriteMsg(m)
|
err = w.WriteMsg(m)
|
||||||
if err == nil {
|
if err != nil {
|
||||||
// If we receive an error we might have exceeded the message size with all
|
// If we receive an error we might have exceeded the message size with all
|
||||||
// our extra information records. Retry again without the extra section.
|
// our extra information records. Retry again without the extra section.
|
||||||
m.Extra = nil
|
m.Extra = nil
|
||||||
|
|
|
@ -309,7 +309,7 @@ retry:
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func resolveAndCache(ctx context.Context, q *Query, oldCache *RRCache) (rrCache *RRCache, err error) { //nolint:gocognit
|
func resolveAndCache(ctx context.Context, q *Query, oldCache *RRCache) (rrCache *RRCache, err error) { //nolint:gocognit,gocyclo
|
||||||
// get resolvers
|
// get resolvers
|
||||||
resolvers, tryAll := GetResolversInScope(ctx, q)
|
resolvers, tryAll := GetResolversInScope(ctx, q)
|
||||||
if len(resolvers) == 0 {
|
if len(resolvers) == 0 {
|
||||||
|
@ -377,7 +377,7 @@ resolveLoop:
|
||||||
// Defensive: This should normally not happen.
|
// Defensive: This should normally not happen.
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
// Check if request suceeded and whether we should try another resolver.
|
// Check if request succeeded and whether we should try another resolver.
|
||||||
if rrCache.RCode != dns.RcodeSuccess && tryAll {
|
if rrCache.RCode != dns.RcodeSuccess && tryAll {
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue