bugThe GNU Hurd - Bugs: bug #12434, Unix-domain (local) sockets do not...

 
 

bug #12434: Unix-domain (local) sockets do not support getsockname() or getpeername()

Submitted by:  Marcus Brinkmann <marcus>
Submitted on:  Wed 23 Mar 2005 09:18:30 PM UTC  
 
Category: Hurd InterfacesSeverity: 1 - Wish
Priority: 1 - LaterItem Group: Compatibility
Status: ConfirmedPrivacy: Public
Assigned to: NoneOriginator Name: deven@ties.org
Open/Closed: OpenReproducibility: Every Time
Size (loc): NonePlanned Release: None
Effort: 0.00
Wiki-like text discussion box: 

Add a New Comment (Rich MarkupRich Markup):
   

You are not logged in

Please log in, so followups can be emailed to you.

 

Wed 23 Mar 2005 09:23:34 PM UTC, comment #1:

Calling getsockname() on a Unix Domain Socket does not seem to be widely supported. I found the following two references:

Cygwin:
http://www.cygwin.com/ml/cygwin-patches/2002-q4/msg00064.html

> (fhandler_socket::getsockname): Call ::getsockname() even for UNIX
> domain sockets as an error check.


Note the formula: "as an error check".

AIX:
http://publib16.boulder.ibm.com/pseries/en_US/libs/commtrf2/getsockname.htm
Note:
The getsockname subroutine does not perform operations on UNIX domain sockets.

FreeBSD:
http://www.gsp.com/cgi-bin/man.cgi?section=2&topic=getsockname
BUGS
Names bound to sockets in the UNIX domain are inaccessible; getsockname returns a zero length name.

There is a fundamental issue with supporting it: The filename used in the filesystem space in the creator may not be the same as one in the task querying it.

So, it is questionable what the semantics of this call on Unix Domain Sockets should be.

Marcus Brinkmann <marcus>
Project Administrator
Wed 23 Mar 2005 09:18:30 PM UTC, original submission:

Hi folks...

I'll start with a very brief introduction -- I just joined this mailing list, so that I could report a Hurd bug I found last night. I never used the Hurd before yesterday, but I would be interested in working with it, if I can just find the time...

Anyway, I was on #hug on IRC last night, talking to "bddebian", who was having trouble getting "orbit2" (GNOME's CORBA broker) to run on the Hurd. I offered to help, so he gave me an account on his machine and I traced the problem, which turned out to be that getsockname() was returning a null pathname instead of the correct pathname of the Unix-domain socket. Since orbit2 expects this call to work, it broke the software. After I found the problem, I stripped down the code to a 36-line test case (attached) which exhibits the bug. Under Linux, getsockname() returns the same sockaddr_un structure that was sent to bind(), while the Hurd is returning a null path instead.

This morning, I took a quick glance at the Hurd sources, and noticed the following comment on S_socket_whatis_address() in hurd/pflocal/pf.c:

/* Implement socket_whatis_address as described in <hurd/socket.defs>.
Since we cannot tell what our adress is, return an empty string as
the file name. This is primarily for the implementation of accept
and recvfrom. The functions getsockname and getpeername remain
unsupported for the local namespace. */

So it appears that no attempt was ever made to implement getsockname() or getpeername() for Unix-domain sockets.

Since this bug (unsupported feature) may break other applications
besides orbit2, perhaps someone would like to take a stab at filling in the gap?

Deven

Marcus Brinkmann <marcus>
Project Administrator

 

(Note: upload size limit is set to 16384 kB, after insertion of the required escape characters.)

Attach File(s):
   
   
Comment:
   

Attached Files
file #2777:  getsockname_bug.c added by marcus (883B - text/x-csrc - Testcase for getsockname() on Unix Domain Socket)

 

Depends on the following items: None found

Items that depend on this one: None found

 

CC list is empty

 

Do you think this task is very important?
If so, you can click here to add your encouragement to it.
This task has 0 encouragements so far.

Only logged-in users can vote.

 

Please enter the title of George Orwell's famous dystopian book (it's a date):

 

 

Follow 3 latest changes.

Date Changed By Updated Field Previous Value => Replaced By
Sat 31 Dec 2005 12:13:17 PM UTCamsStatusNone=>Confirmed
Wed 23 Mar 2005 09:23:34 PM UTCmarcusOriginator Name=>-unavailable-
Wed 23 Mar 2005 09:18:30 PM UTCmarcusAttached File-=>Added getsockname_bug.c, #2343

Back to the top


Powered by Savane 3.1-cleanup