fix: avoid modifying the request message id

This commit is contained in:
gVisor bot 2023-02-14 21:09:37 +08:00
parent 7d50bea4d2
commit b4862b7124
2 changed files with 2 additions and 0 deletions

View File

@ -109,6 +109,7 @@ func (doh *dnsOverHTTPS) ExchangeContext(ctx context.Context, m *D.Msg) (msg *D.
// formats that include the ID field from the DNS message header, such
// as "application/dns-message", SHOULD use a DNS ID of 0 in every DNS
// request.
m=m.Copy()
id := m.Id
m.Id = 0
defer func() {

View File

@ -89,6 +89,7 @@ func (doq *dnsOverQUIC) Address() string { return doq.addr }
func (doq *dnsOverQUIC) ExchangeContext(ctx context.Context, m *D.Msg) (msg *D.Msg, err error) {
// When sending queries over a QUIC connection, the DNS Message ID MUST be
// set to zero.
m = m.Copy()
id := m.Id
m.Id = 0
defer func() {