#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)
Change History (6)
by , 16 months ago
Attachment: | socketpairtest.c added |
---|
comment:1 by , 16 months ago
Component: | Network & Internet → Network & Internet/UDP |
---|---|
Owner: | changed from | to
comment:2 by , 16 months ago
Priority: | critical → high |
---|
comment:3 by , 16 months ago
Upon further investigation, it looks like getpeername is also broken for other AF_UNIX sockets (not just those created via socketpair).
comment:4 by , 16 months ago
Component: | Network & Internet/UDP → Network & Internet |
---|---|
Owner: | changed from | to
comment:5 by , 16 months ago
Milestone: | Unscheduled → R1/beta5 |
---|---|
Resolution: | → fixed |
Status: | new → closed |
Fixed in hrev57189
test case; compile with "gcc -o socketpairtest -lnetwork socketpairtest.c"