]> Cypherpunks repositories - gostls13.git/commit
net: do more faithful conversion from AddrPort to UDPAddr
authorJason A. Donenfeld <Jason@zx2c4.com>
Fri, 5 Nov 2021 12:02:09 +0000 (13:02 +0100)
committerJason A. Donenfeld <Jason@zx2c4.com>
Wed, 10 Nov 2021 22:16:25 +0000 (22:16 +0000)
commit4d0683965bd05aee6845bf6849c85c4bf2bb10d4
tree47e4ff8261e37583eed0f042e1f599fafd36ec0b
parent23f653df963ddf3ae618290edbb0c55530fcf483
net: do more faithful conversion from AddrPort to UDPAddr

A UDPAddr with a nil IP is a valid state, representing an AF-agnostic
unspecified address, so checking for addr.IsValid() isn't correct;
remove that, as it's only needed in the UDP rx path where it can be
added. Secondly, forcing everything to be IPv6 also is not correct, and
was likely done when the missing .AsSlice() made doing the right thing
less ergonomic. Fix this by using .AsSlice(), which properly preserves
IP version.

Change-Id: Idd1eaecd4076f32a843f859a0a9802ef98f956d3
Reviewed-on: https://go-review.googlesource.com/c/go/+/361478
Trust: Jason A. Donenfeld <Jason@zx2c4.com>
Trust: Josh Bleecher Snyder <josharian@gmail.com>
Run-TryBot: Jason A. Donenfeld <Jason@zx2c4.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Russ Cox <rsc@golang.org>
src/net/udpsock.go
src/net/udpsock_test.go