Commit 83a103ec authored by Michael Tuexen's avatar Michael Tuexen
Browse files

libc sctp: improve conformance of sctp_getpaddrs()

When there is no association, don't return -1 and indicate ENOENT,
but return 0 instead. This is specified in RFC 6458.

PR:		260117
MFC after:	1 week
parent 94a72c5a
...@@ -405,7 +405,11 @@ sctp_getpaddrs(int sd, sctp_assoc_t id, struct sockaddr **raddrs) ...@@ -405,7 +405,11 @@ sctp_getpaddrs(int sd, sctp_assoc_t id, struct sockaddr **raddrs)
opt_len = (socklen_t)sizeof(uint32_t); opt_len = (socklen_t)sizeof(uint32_t);
if (getsockopt(sd, IPPROTO_SCTP, SCTP_GET_REMOTE_ADDR_SIZE, if (getsockopt(sd, IPPROTO_SCTP, SCTP_GET_REMOTE_ADDR_SIZE,
&size_of_addresses, &opt_len) != 0) { &size_of_addresses, &opt_len) != 0) {
return (-1); if (errno == ENOENT) {
return (0);
} else {
return (-1);
}
} }
opt_len = (socklen_t)((size_t)size_of_addresses + sizeof(struct sctp_getaddresses)); opt_len = (socklen_t)((size_t)size_of_addresses + sizeof(struct sctp_getaddresses));
addrs = calloc(1, (size_t)opt_len); addrs = calloc(1, (size_t)opt_len);
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment