git: 4bf3c8ea0d10 - stable/13 - libc sctp: improve conformance of sctp_getpaddrs()
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Fri, 10 Dec 2021 10:39:27 UTC
The branch stable/13 has been updated by tuexen:
URL: https://cgit.FreeBSD.org/src/commit/?id=4bf3c8ea0d107e24c62a96cd5e88c188c629d19b
commit 4bf3c8ea0d107e24c62a96cd5e88c188c629d19b
Author: Michael Tuexen <tuexen@FreeBSD.org>
AuthorDate: 2021-12-01 18:47:50 +0000
Commit: Michael Tuexen <tuexen@FreeBSD.org>
CommitDate: 2021-12-10 10:39:15 +0000
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)
---
lib/libc/net/sctp_sys_calls.c | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)
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);