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

UnixDomainSocketEndPoint should set length instead of null-terminating #17361

Closed
tmds opened this issue May 20, 2016 · 3 comments
Closed

UnixDomainSocketEndPoint should set length instead of null-terminating #17361

tmds opened this issue May 20, 2016 · 3 comments
Labels
area-System.Net os-linux Linux OS (any supported distro)
Milestone

Comments

@tmds
Copy link
Member

tmds commented May 20, 2016

I've used (a copy of) UnixDomainSocketEndPoint to connect to a unix socket with an abstract address (path starts with a zero-byte). The connect call failed with ECONNREFUSED. When I changed the implementation to pass 2 + _encodedPath.Length instead of s_nativeAddressSize in Serialize the connect works.

\cc @stephentoub

@tmds
Copy link
Member Author

tmds commented May 21, 2016

This class is internal, so there is no hurry to fix this.

@ericeil
Copy link
Contributor

ericeil commented May 27, 2016

From the Linux "unix (7)" man page:

   *  abstract: an abstract socket address is distinguished (from a
      pathname socket) by the fact that sun_path[0] is a null byte
      ('\0').  The socket's address in this namespace is given by the
      additional bytes in sun_path that are covered by the specified
      length of the address structure.  (Null bytes in the name have no
      special significance.)  The name has no connection with filesystem
      pathnames.  When the address of an abstract socket is returned,
      the returned addrlen is greater than sizeof(sa_family_t) (i.e.,
      greater than 2), and the name of the socket is contained in the
      first (addrlen - sizeof(sa_family_t)) bytes of sun_path.  The
      abstract socket namespace is a nonportable Linux extension.

So, this is a Linux-specific, and special-purpose, usage of UNIX-domain sockets. I think this is outside of the scope of the (internal) UnixDomainSocketEndPoint type.

@ericeil ericeil closed this as completed May 27, 2016
@tmds
Copy link
Member Author

tmds commented May 29, 2016

@ericeil the null terminating is idependent of the socket being abstract. Please also have a look at the BUGS section in the man page you referenced.

@msftgits msftgits transferred this issue from dotnet/corefx Jan 31, 2020
@msftgits msftgits added this to the 1.1.0 milestone Jan 31, 2020
@ghost ghost locked as resolved and limited conversation to collaborators Dec 31, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
area-System.Net os-linux Linux OS (any supported distro)
Projects
None yet
Development

No branches or pull requests

3 participants