Bug 167712 - Missing CANT_STR_ASSOC notification with SCTP stream socket.
Summary: Missing CANT_STR_ASSOC notification with SCTP stream socket.
Keywords:
Status: CLOSED NOTABUG
Alias: None
Product: Red Hat Enterprise Linux 4
Classification: Red Hat
Component: kernel
Version: 4.0
Hardware: i386
OS: Linux
medium
medium
Target Milestone: ---
: ---
Assignee: Neil Horman
QA Contact: Brian Brock
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2005-09-07 14:48 UTC by Jere Leppanen
Modified: 2007-11-30 22:07 UTC (History)
3 users (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2005-11-01 20:56:44 UTC
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)

Description Jere Leppanen 2005-09-07 14:48:47 UTC
Description of problem:
An SCTP SOCK_STREAM socket does not deliver an SCTP_CANT_STR_ASSOC notification 
when a non-blocking connect() fails. Instead, recvmsg() returns -1 with errno = 
ENOTCONN. With SCTP SOCK_SEQPACKET sockets SCTP_CANT_STR_ASSOC is correctly 
delivered.

Version-Release number of selected component (if applicable):
kernel-2.6.9-5.EL

How reproducible:
Every time.

Steps to Reproduce:
In step 5, connect to an IP that either does not respond, or responds with an 
SCTP ABORT.
1. socket(PF_INET, SOCK_STREAM, 0x84 /* IPPROTO_??? */) = 3
2. bind(3, {sa_family=AF_INET, sin_port=htons(0), sin_addr=inet_addr
("0.0.0.0")}, 16) = 0
3. setsockopt(3, 0x84 /* IPPROTO_SCTP */, 11 /* SCTP_EVENTS */, "\1\1\1
\1\1\1\1\1", 8) = 0
4. fcntl64(3, F_SETFL, O_RDONLY|O_NONBLOCK) = 0
5. connect(3, {sa_family=AF_INET, sin_port=htons(10000), sin_addr=inet_addr
("131.228.201.36")}, 16) = -1 EINPROGRESS (Operation now in progress)
6. select(4, [0 3], NULL, NULL, {2147483647, 0}) = 1 (in [3], left {8589934, 
588000})
7. recvmsg(3, 0xbfa86000, MSG_NOSIGNAL)    = -1 ENOTCONN (Transport endpoint is 
not connected)
  
Actual results:
All SCTP events are subscribed in step 3. In steps 4 and 5 we do a non-blocking 
connect. In step 6, we wait in select() for all of the INITs to expire. In step 
7, recvmsg() returns -1 with errno = ENOTCONN.

Expected results:
In step 7, recvmsg() should return an SCTP_CANT_STR_ASSOC notification.

Additional info:
This is RFC draft non-compliance. The required behaviour is defined in "Sockets 
API Extensions for Stream Control Transmission Protocol" (draft-ietf-tsvwg-
sctpsocket-10.txt). The obvious workaround is to treat recvmsg()=-1 with 
errno=ENOTCONN as if an SCTP_CANT_STR_ASSOC notification had been received.

Comment 1 Jere Leppanen 2005-09-07 14:52:00 UTC
Also tested in RHEL4 U2beta and kernel-2.6.13-git6+lksctp-tools-1.0.3-1 with 
identical results.


Comment 2 Neil Horman 2005-11-01 20:56:44 UTC
This doesn't appear to be a bug to me.  Opening a socket as SOCK_STREAM,
indicates to the kernel that this is a connection oriented protocol, and as SUS
defines that unconnected sockets which are opened to connection oriented
protocols must return -1 as an error code and set errno to ENOTCONN:
http://www.opengroup.org/onlinepubs/000095399/toc.htm

I realize that the sctp protocol defines a event notification that should be
queued to the socket for the user to read, but the POSIX specification really
needs to take precedence here.  If you need to see these notifications, the
connection should be opened as a SEQPACKET type socket.


Note You need to log in before you can comment on or make changes to this bug.