1
0
mirror of https://github.com/golang/go synced 2024-09-30 00:04:28 -06:00

net: return "cannot unmarshal" error while parsing DNS messages

Change-Id: I407f5d3d3a3e8b3d43ff154f731d885e831971e9
GitHub-Last-Rev: d6a400d1ba
GitHub-Pull-Request: golang/go#62155
Reviewed-on: https://go-review.googlesource.com/c/go/+/520980
Run-TryBot: Ian Lance Taylor <iant@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@google.com>
Auto-Submit: Ian Lance Taylor <iant@google.com>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
Run-TryBot: Mateusz Poliwczak <mpoliwczak34@gmail.com>
This commit is contained in:
Mateusz Poliwczak 2023-08-19 07:52:34 +00:00 committed by Gopher Robot
parent 69285cd778
commit 0b6ea6bb04

View File

@ -718,7 +718,7 @@ func (r *Resolver) goLookupIPCNAMEOrder(ctx context.Context, network, name strin
h, err := result.p.AnswerHeader()
if err != nil && err != dnsmessage.ErrSectionDone {
lastErr = &DNSError{
Err: "cannot marshal DNS message",
Err: errCannotUnmarshalDNSMessage.Error(),
Name: name,
Server: result.server,
}
@ -731,7 +731,7 @@ func (r *Resolver) goLookupIPCNAMEOrder(ctx context.Context, network, name strin
a, err := result.p.AResource()
if err != nil {
lastErr = &DNSError{
Err: "cannot marshal DNS message",
Err: errCannotUnmarshalDNSMessage.Error(),
Name: name,
Server: result.server,
}
@ -746,7 +746,7 @@ func (r *Resolver) goLookupIPCNAMEOrder(ctx context.Context, network, name strin
aaaa, err := result.p.AAAAResource()
if err != nil {
lastErr = &DNSError{
Err: "cannot marshal DNS message",
Err: errCannotUnmarshalDNSMessage.Error(),
Name: name,
Server: result.server,
}
@ -761,7 +761,7 @@ func (r *Resolver) goLookupIPCNAMEOrder(ctx context.Context, network, name strin
c, err := result.p.CNAMEResource()
if err != nil {
lastErr = &DNSError{
Err: "cannot marshal DNS message",
Err: errCannotUnmarshalDNSMessage.Error(),
Name: name,
Server: result.server,
}
@ -774,7 +774,7 @@ func (r *Resolver) goLookupIPCNAMEOrder(ctx context.Context, network, name strin
default:
if err := result.p.SkipAnswer(); err != nil {
lastErr = &DNSError{
Err: "cannot marshal DNS message",
Err: errCannotUnmarshalDNSMessage.Error(),
Name: name,
Server: result.server,
}
@ -866,7 +866,7 @@ func (r *Resolver) goLookupPTR(ctx context.Context, addr string, order hostLooku
}
if err != nil {
return nil, &DNSError{
Err: "cannot marshal DNS message",
Err: errCannotUnmarshalDNSMessage.Error(),
Name: addr,
Server: server,
}
@ -875,7 +875,7 @@ func (r *Resolver) goLookupPTR(ctx context.Context, addr string, order hostLooku
err := p.SkipAnswer()
if err != nil {
return nil, &DNSError{
Err: "cannot marshal DNS message",
Err: errCannotUnmarshalDNSMessage.Error(),
Name: addr,
Server: server,
}
@ -885,7 +885,7 @@ func (r *Resolver) goLookupPTR(ctx context.Context, addr string, order hostLooku
ptr, err := p.PTRResource()
if err != nil {
return nil, &DNSError{
Err: "cannot marshal DNS message",
Err: errCannotUnmarshalDNSMessage.Error(),
Name: addr,
Server: server,
}