Skip to content

Commit f3985f3

Browse files
committed
net/dns: Increase UDP response buffer to 1232 bytes
This resolves #51127 in the near term by defaulting to a larger buffer size. This is not a permanent fix or implementation of EDNS(0) or [IETF RFC6891](https://datatracker.ietf.org/doc/html/rfc6891). These changes should be reviewed by someone with more experience than I. :) Signed-off-by: Aaron Friel <[email protected]>
1 parent 656d3f4 commit f3985f3

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

src/net/dnsclient_unix.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@ func dnsPacketRoundTrip(c Conn, id uint16, query dnsmessage.Question, b []byte)
8282
return dnsmessage.Parser{}, dnsmessage.Header{}, err
8383
}
8484

85-
b = make([]byte, 512) // see RFC 1035
85+
b = make([]byte, 1232) // see RFC 6891, https://dnsflagday.net/2020/
8686
for {
8787
n, err := c.Read(b)
8888
if err != nil {

src/net/dnsclient_unix_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -881,7 +881,7 @@ func (f *fakeDNSPacketConn) Close() error {
881881
func TestIgnoreDNSForgeries(t *testing.T) {
882882
c, s := Pipe()
883883
go func() {
884-
b := make([]byte, 512)
884+
b := make([]byte, 1232)
885885
n, err := s.Read(b)
886886
if err != nil {
887887
t.Error(err)

0 commit comments

Comments
 (0)