SCTP_GETPADDRS(3)
π SCTP_GETPADDRS(3) π
okay bestie, so this is a page from the Linux Programmer's Manual, and it's all about a lil libsctp function called sctp_getpaddrs β she's the one who tells you every single peer address chillin' in your SCTP association. no cap. let's get into it π¦
β¨ NAME β¨
sctp_getpaddrs β Returns all peer addresses in an association.
like, all of them. the whole friend group. periodt π
πΈ SYNOPSIS πΈ
#include <sys/types.h>
#include <sys/socket.h>
#include <netinet/sctp.h>
int sctp_getpaddrs(int sd, sctp_assoc_t assoc_id,
struct sockaddr **addrs);
void sctp_freepaddrs(struct sockaddr *addrs);
π DESCRIPTION π
so sctp_getpaddrs returns all peer addresses in an association. on return, addrs will point to a dynamically allocated packed array of sockaddr structures β and it's the appropriate type for each address, bestie, it's not playing games. the caller should use sctp_freepaddrs to free the memory afterwards, because we are responsible queens who clean up after themselves π§
not me stressing this but: the in/out parameteraddrsmust not beNULL. like, do not. π
if sd is an IPv4 socket, the addresses returned will be all IPv4 addresses. if sd is an IPv6 socket, the addresses returned can be a mix of IPv4 or IPv6 addresses β¨
for one-to-many style sockets, id specifies the association to query. for one-to-one style sockets, id is just... ignored. she said "not my business" π
sctp_freepaddrs frees all the resources allocated by sctp_getpaddrs. it's giving cleanup crew, it's giving closure π«Ά
β RETURN VALUE β
on success, sctp_getpaddrs returns the number of peer addresses in the association. iconic, honestly.
if there is no association on this socket, 0 is returned and the value of *addrs is undefined. π
on error, sctp_getpaddrs returns -1 and the value of *addrs is undefined. yes bestie, undefined means undefined, don't go reading it and acting surprised π
π₯ SEE ALSO π₯
sctp(7)sctp_bindx(3)sctp_connectx(3)sctp_sendmsg(3)sctp_sendv(3)sctp_send(3)sctp_recvmsg(3)sctp_recvv(3)sctp_peeloff(3)sctp_getladdrs(3)sctp_opt_info(3)
and that's the whole page, bestie π this one's from Linux 2.6, dated 2005-10-25 β yeah she's an elder but she still ate π go free your addrs, stay hydrated, and never pass NULL π
πΈ
π¦ where this page comes from
- alpine 3.22: lksctp-tools-doc 1.0.19-r5 Β· GPL-2.0-or-later AND LGPL-2.1-or-later
- alpine 3.23: lksctp-tools-doc 1.0.19-r5 Β· GPL-2.0-or-later AND LGPL-2.1-or-later
- alpine 3.24: lksctp-tools-doc 1.0.19-r5 Β· GPL-2.0-or-later AND LGPL-2.1-or-later
- arch rolling: lksctp-tools 1.0.21-1 Β· GPL-2.0-or-later AND LGPL-2.1-only
- centos-stream 10: lksctp-tools-devel 1.0.21-1.el10 Β· GPLv2 and GPLv2+ and LGPLv2 and MIT
- centos-stream 9: lksctp-tools-devel 1.0.19-2.el9 Β· GPLv2 and GPLv2+ and LGPLv2 and MIT
- centos-stream 9: lksctp-tools-devel 1.0.19-2.el9 Β· GPLv2 and GPLv2+ and LGPLv2 and MIT
- debian bookworm: libsctp-dev 1.0.19+dfsg-2 Β· GPL-2.0-or-later
- debian trixie: libsctp-dev 1.0.21+dfsg-1 Β· GPL-2.0-or-later
- fedora 43: lksctp-tools-devel 1.0.21-1.fc43 Β· GPL-2.0-or-later AND LGPL-2.0-only AND MIT
- fedora 43: lksctp-tools-devel 1.0.21-1.fc43 Β· GPL-2.0-or-later AND LGPL-2.0-only AND MIT
- fedora 44: lksctp-tools-devel 1.0.21-3.fc44 Β· GPL-2.0-or-later AND LGPL-2.0-only AND MIT
- fedora 44: lksctp-tools-devel 1.0.21-3.fc44 Β· GPL-2.0-or-later AND LGPL-2.0-only AND MIT
- nixos 26.05: lksctp-tools 1.0.21
- nixpkgs unstable: lksctp-tools 1.0.21
- opensuse-leap 16.0: lksctp-tools-devel 1.0.21-160000.3.2 Β· LGPL-2.1-or-later
- opensuse-leap 16.0: lksctp-tools-devel 1.0.21-160000.3.2 Β· LGPL-2.1-or-later
- opensuse-leap 16.0: lksctp-tools-devel 1.0.21-160000.3.2 Β· LGPL-2.1-or-later
- opensuse-leap 16.0: lksctp-tools-devel 1.0.21-160000.3.2 Β· LGPL-2.1-or-later
- ubuntu jammy: libsctp-dev 1.0.19+dfsg-1build1 Β· GPL-2.0-or-later
- ubuntu noble: libsctp-dev 1.0.19+dfsg-2build1 Β· GPL-2.0-or-later
- ubuntu questing: libsctp-dev 1.0.21+dfsg-1build1
- ubuntu resolute: libsctp-dev 1.0.21+dfsg-1build2 Β· GPL-2.0-or-later
- ubuntu stonking: libsctp-dev 1.0.21+dfsg-2 Β· GPL-2.0-or-later
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms