Opened 9 months ago

Closed 9 months ago

Last modified 9 months ago

#18534 closed bug (fixed)

AF_UNIX: Second socket created with socketpair fails with ENOTCONN upon getpeername

Reported by: kohlschuetter Owned by: nobody
Priority: high Milestone: R1/beta5
Component: Network & Internet Version: R1/Development
Keywords: Cc:
Blocked By: Blocking:
Platform: All

Description

When creating a socket pair using the POSIX "socketpair" call, it is assumed that both sockets are interconnected.

To check that they are indeed connected, and connected with each other, one can compare the addresses returned by getsockname and getpeername respectively.

However, as of hrev57177, calling getpeername on the second socket in the AF_UNIX domain returns ENOTCONN ("Socket is not connected"). It works fine for AF_INET.

This is critical for code that checks for the correct connection state (regardless of the actual address, for what it's worth).

Attachments (1)

socketpairtest.c (902 bytes ) - added by kohlschuetter 9 months ago.
test case; compile with "gcc -o socketpairtest -lnetwork socketpairtest.c"

Download all attachments as: .zip

Change History (6)

by kohlschuetter, 9 months ago

Attachment: socketpairtest.c added

test case; compile with "gcc -o socketpairtest -lnetwork socketpairtest.c"

comment:1 by waddlesplash, 9 months ago

Component: Network & InternetNetwork & Internet/UDP
Owner: changed from nobody to axeld

comment:2 by waddlesplash, 9 months ago

Priority: criticalhigh

comment:3 by kohlschuetter, 9 months ago

Upon further investigation, it looks like getpeername is also broken for other AF_UNIX sockets (not just those created via socketpair).

Last edited 9 months ago by kohlschuetter (previous) (diff)

comment:4 by korli, 9 months ago

Component: Network & Internet/UDPNetwork & Internet
Owner: changed from axeld to nobody

comment:5 by pulkomandy, 9 months ago

Milestone: UnscheduledR1/beta5
Resolution: fixed
Status: newclosed

Fixed in hrev57189

Note: See TracTickets for help on using tickets.