Copy queries prior to packing them in resolvers (#290)

* Copy queries prior to packing them in resolvers

* Fix race in quic restart logic

* Remove bad lock
This commit is contained in:
Frank Olbricht
2023-04-01 09:16:55 +02:00
committed by GitHub
parent bf6dff4b63
commit 017544e9f4
4 changed files with 12 additions and 0 deletions

View File

@@ -65,6 +65,9 @@ func NewDNSClient(id, endpoint, network string, opt DNSClientOptions) (*DNSClien
// Resolve a DNS query.
func (d *DNSClient) Resolve(q *dns.Msg, ci ClientInfo) (*dns.Msg, error) {
// Packing a message is not always a read-only operation, make a copy
q = q.Copy()
logger(d.id, q, ci).WithFields(logrus.Fields{
"resolver": d.endpoint,
"protocol": d.net,

View File

@@ -101,6 +101,9 @@ func NewDoHClient(id, endpoint string, opt DoHClientOptions) (*DoHClient, error)
// Resolve a DNS query.
func (d *DoHClient) Resolve(q *dns.Msg, ci ClientInfo) (*dns.Msg, error) {
// Packing a message is not always a read-only operation, make a copy
q = q.Copy()
logger(d.id, q, ci).WithFields(logrus.Fields{
"resolver": d.endpoint,
"protocol": "doh",

View File

@@ -71,6 +71,9 @@ func NewDoTClient(id, endpoint string, opt DoTClientOptions) (*DoTClient, error)
// Resolve a DNS query.
func (d *DoTClient) Resolve(q *dns.Msg, ci ClientInfo) (*dns.Msg, error) {
// Packing a message is not always a read-only operation, make a copy
q = q.Copy()
logger(d.id, q, ci).WithFields(logrus.Fields{
"resolver": d.endpoint,
"protocol": "dot",

View File

@@ -93,6 +93,9 @@ func NewDTLSClient(id, endpoint string, opt DTLSClientOptions) (*DTLSClient, err
// Resolve a DNS query.
func (d *DTLSClient) Resolve(q *dns.Msg, ci ClientInfo) (*dns.Msg, error) {
// Packing a message is not always a read-only operation, make a copy
q = q.Copy()
logger(d.id, q, ci).WithFields(logrus.Fields{
"resolver": d.endpoint,
"protocol": "dtls",