-
Notifications
You must be signed in to change notification settings - Fork 18.5k
Open
Labels
NeedsInvestigationSomeone must examine and confirm this is a valid issue and not a duplicate of an existing one.Someone must examine and confirm this is a valid issue and not a duplicate of an existing one.ProposalProposal-Hold
Milestone
Description
What version of Go are you using (go version)?
$ go version go version go1.18.3 linux/amd64
Does this issue reproduce with the latest release?
It does with go version devel go1.19-d3ffff2790 Tue Jun 28 13:01:41 2022 +0000 linux/amd64, haven't tried a more recent one.
What operating system and processor architecture are you using (go env)?
go env Output
$ go env GO111MODULE="on" GOARCH="amd64" GOBIN="" GOCACHE="/home/ainar/.cache/go-build" GOENV="/home/ainar/.config/go/env" GOEXE="" GOEXPERIMENT="" GOFLAGS="" GOHOSTARCH="amd64" GOHOSTOS="linux" GOINSECURE="" GOMODCACHE="/home/ainar/go/pkg/mod" GONOPROXY="REMOVED" GONOSUMDB="REMOVED" GOOS="linux" GOPATH="/home/ainar/go" GOPRIVATE="REMOVED" GOPROXY="https://proxy.golang.org,direct" GOROOT="/home/ainar/go/go1.18" GOSUMDB="sum.golang.org" GOTMPDIR="" GOTOOLDIR="/home/ainar/go/go1.18/pkg/tool/linux_amd64" GOVCS="" GOVERSION="go1.18.3" GCCGO="gccgo" GOAMD64="v1" AR="ar" CC="clang" CXX="clang++" CGO_ENABLED="1" GOMOD="/dev/null" GOWORK="" CGO_CFLAGS="-g -O2" CGO_CPPFLAGS="" CGO_CXXFLAGS="-g -O2" CGO_FFLAGS="-g -O2" CGO_LDFLAGS="-g -O2" PKG_CONFIG="pkg-config" GOGCCFLAGS="-fPIC -m64 -pthread -fno-caret-diagnostics -Qunused-arguments -fmessage-length=0 -fdebug-prefix-map=/tmp/go-build1722739114=/tmp/go-build -gno-record-gcc-switches"
What did you do?
c, err := net.ListenUDP("udp", &net.UDPAddr{
IP: net.IPv4zero,
Port: 10000,
})
if err != nil {
panic(err)
}
var buf [64]byte
_, raddr, err := c.ReadFromUDPAddrPort(buf[:])
if err != nil {
panic(err)
}
fmt.Println(raddr)
fmt.Println("is4:", raddr.Addr().Is4())
fmt.Println("is6:", raddr.Addr().Is6())
fmt.Println("is4in6:", raddr.Addr().Is4In6())
_, oldRAddr, err := c.ReadFromUDP(buf[:])
if err != nil {
panic(err)
}
raddr = oldRAddr.AddrPort()
fmt.Println(oldRAddr.Network())
fmt.Println(raddr)
fmt.Println("is4:", raddr.Addr().Is4())
fmt.Println("is6:", raddr.Addr().Is6())
fmt.Println("is4in6:", raddr.Addr().Is4In6())https://go.dev/play/p/9qs4KxGRPjq
go run ./main.goecho 'hello' | nc -4 -u -w 1 127.0.0.1 10000
echo 'world' | nc -4 -u -w 1 127.0.0.1 10000Note: the requests are sent using -4 and an IPv4 address.
What did you expect to see?
127.0.0.1:58848
is4: true
is6: false
is4in6: false
udp
127.0.0.1:38564
is4: true
is6: false
is4in6: false
What did you see instead?
[::ffff:127.0.0.1]:58848
is4: false
is6: true
is4in6: true
udp
[::ffff:127.0.0.1]:38564
is4: false
is6: true
is4in6: true
I haven't tried the TCP ones, but looking at the code, they probably have the same issue.
ignoramous and betamos
Metadata
Metadata
Assignees
Labels
NeedsInvestigationSomeone must examine and confirm this is a valid issue and not a duplicate of an existing one.Someone must examine and confirm this is a valid issue and not a duplicate of an existing one.ProposalProposal-Hold
Type
Projects
Status
Hold