aboutsummaryrefslogtreecommitdiff
path: root/lib/libc/net
diff options
context:
space:
mode:
authorMichael Tuexen <tuexen@FreeBSD.org>2021-12-01 18:47:50 +0000
committerMichael Tuexen <tuexen@FreeBSD.org>2021-12-10 10:39:15 +0000
commit4bf3c8ea0d107e24c62a96cd5e88c188c629d19b (patch)
treeadedd8b100652490ce753dcdd603fed9bfae5f14 /lib/libc/net
parent6a5487e34b13f9b7e184a4cca23b715a76f2a375 (diff)
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 (cherry picked from commit 83a103ec429a6dd862a73857ebeeff863a41a34d)
Diffstat (limited to 'lib/libc/net')
-rw-r--r--lib/libc/net/sctp_sys_calls.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/lib/libc/net/sctp_sys_calls.c b/lib/libc/net/sctp_sys_calls.c
index 615b14ede5aa..7c3652ff5d3c 100644
--- a/lib/libc/net/sctp_sys_calls.c
+++ b/lib/libc/net/sctp_sys_calls.c
@@ -405,7 +405,11 @@ sctp_getpaddrs(int sd, sctp_assoc_t id, struct sockaddr **raddrs)
opt_len = (socklen_t)sizeof(uint32_t);
if (getsockopt(sd, IPPROTO_SCTP, SCTP_GET_REMOTE_ADDR_SIZE,
&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));
addrs = calloc(1, (size_t)opt_len);