git: 83a103ec429a - main - libc sctp: improve conformance of sctp_getpaddrs()
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Wed, 01 Dec 2021 19:14:41 UTC
The branch main has been updated by tuexen: URL: https://cgit.FreeBSD.org/src/commit/?id=83a103ec429a6dd862a73857ebeeff863a41a34d commit 83a103ec429a6dd862a73857ebeeff863a41a34d Author: Michael Tuexen <tuexen@FreeBSD.org> AuthorDate: 2021-12-01 18:47:50 +0000 Commit: Michael Tuexen <tuexen@FreeBSD.org> CommitDate: 2021-12-01 18:50:26 +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 --- 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);