Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

net: unbound, unnamed socket support for UnixConn #4636

Closed
gopherbot opened this issue Jan 9, 2013 · 3 comments

Comments

Projects
None yet
3 participants
@gopherbot
Copy link

commented Jan 9, 2013

by jeff.allen:

This problem has been reported before in issue #945 and issue #3875. Each time, a related
problem was solved, but the previous fixes did not solve this exact problem.

What steps will reproduce the problem?

1. http://play.golang.org/p/VUAfi_vznp

(cannot be run on play due to need for socket access)

What is the expected output?

n: 5, addr: <nil>, err: <nil>, buf: []byte{0x1, 0x2, 0x3, 0x4, 0x5}

What do you see instead?

n: 0, addr: <nil>, err: read unixgram /tmp/sname: address family not supported by
protocol, buf: []byte{}

But strace -f sees this:

[pid  9818] recvfrom(3, "\1\2\3\4\5", 1024, 0, {sa_family=AF_UNSPEC,
sa_data="\0\0\0\0\0\0\0\0\0\0\0\0\0\0"}, [0]) = 5

So there are 5 bytes received that should make it out of ReadFrom, but are lost.

The problem is in syscall.Recvfrom, when anyToSockaddr is called after the kernel told
us the data at &rsa is invalid by setting len to 0.
(man 2 recvfrom: "The argument addrlen is a value-result  argument, which  the 
caller should initialize before the call to the size of the buffer associated with
src_addr, and modified on return to indicate the actual  size  of the source
address.")

A CL is forthcoming, needs testing on other OSes.

Which compiler are you using (5g, 6g, 8g, gccgo)?

6g

Which operating system are you using?

Linux

Which version are you using?  (run 'go version')

go version devel 08a1396e9aa7 Tue Jan 08 17:23:46 2013 +1100 linux/amd64
@gopherbot

This comment has been minimized.

Copy link
Author

commented Jan 9, 2013

Comment 1 by jeff.allen:

See CL in https://golang.org/cl/7058062/
@davecheney

This comment has been minimized.

Copy link
Contributor

commented Jan 14, 2013

Comment 2:

Status changed to Started.

@rsc

This comment has been minimized.

Copy link
Contributor

commented Jan 30, 2013

Comment 4:

This issue was closed by revision 6563d86.

Status changed to Fixed.

@rsc rsc added this to the Go1.1 milestone Apr 14, 2015

@rsc rsc removed the go1.1 label Apr 14, 2015

@golang golang locked and limited conversation to collaborators Jun 24, 2016

This issue was closed.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
You can’t perform that action at this time.