mirror of
https://github.com/safing/portmaster
synced 2025-09-02 02:29:12 +00:00
Stop randomizing dns answer records
This commit is contained in:
parent
990524e289
commit
fa595a53d5
1 changed files with 2 additions and 9 deletions
|
@ -3,7 +3,6 @@ package resolver
|
||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
"fmt"
|
"fmt"
|
||||||
"math/rand"
|
|
||||||
"net"
|
"net"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
|
@ -286,7 +285,8 @@ func (rrCache *RRCache) ReplaceAnswerNames(fqdn string) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// ReplyWithDNS creates a new reply to the given query with the data from the RRCache, and additional informational records.
|
// ReplyWithDNS creates a new reply to the given query with the data from the
|
||||||
|
// RRCache, and additional informational records.
|
||||||
func (rrCache *RRCache) ReplyWithDNS(ctx context.Context, request *dns.Msg) *dns.Msg {
|
func (rrCache *RRCache) ReplyWithDNS(ctx context.Context, request *dns.Msg) *dns.Msg {
|
||||||
// reply to query
|
// reply to query
|
||||||
reply := new(dns.Msg)
|
reply := new(dns.Msg)
|
||||||
|
@ -295,13 +295,6 @@ func (rrCache *RRCache) ReplyWithDNS(ctx context.Context, request *dns.Msg) *dns
|
||||||
reply.Ns = rrCache.Ns
|
reply.Ns = rrCache.Ns
|
||||||
reply.Extra = rrCache.Extra
|
reply.Extra = rrCache.Extra
|
||||||
|
|
||||||
// Randomize the order of the answer records a little to allow dumb clients
|
|
||||||
// (who only look at the first record) to reliably connect.
|
|
||||||
for i := range reply.Answer {
|
|
||||||
j := rand.Intn(i + 1)
|
|
||||||
reply.Answer[i], reply.Answer[j] = reply.Answer[j], reply.Answer[i]
|
|
||||||
}
|
|
||||||
|
|
||||||
return reply
|
return reply
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue