RDMA_GET_SRC_PORT(3)
β¨ RDMA_GET_SRC_PORT β¨
okay bestie, welcome to the rdma_get_src_port page from the Librdmacm Programmer's Manual π this one is short, sweet, and honestly iconic β it's the "hey what port am I even on??" function. let's go π¦
πΈ NAME πΈ
rdma_get_src_port β returns the local port number of a bound rdma_cm_id.
like... literally that's the whole thing. it hands you back the local port. no cap π
π SYNOPSIS π
#include <rdma/rdma_cma.h>
uint16_t rdma_get_src_port (struct rdma_cm_id *id);
look at her. one include, one function, zero drama β¨
π«Ά ARGUMENTS π«Ά
idβ the RDMA identifier. this is yourrdma_cm_id, the main character of every RDMA cm story π
π DESCRIPTION π
so here's the vibe: this function returns the local port number for an rdma_cm_id that has been bound to a local address.
that's it. that's the function. if you've already bound your id to a local address, this tells you which local port you're sitting on. lowkey essential, highkey simple πΈ
ngl though β the "bound to a local address" part is doing a LOT of work in that sentence. peep RETURN VALUE below before you go assuming things π
π RETURN VALUE π
it returns the 16-bit port identifier associated with the local endpoint. slay π
but β and this is the part everyone skips β if the rdma_cm_id is not bound to a port, the returned value is 0.
so if you're staring at a 0 and going "bestie why π" β it's not a bug, it's just not bound. go bind it (rdma_bind_addr(3) is right there in SEE ALSO, iykyk) π§
π₯ SEE ALSO π₯
rdma_bind_addr(3)rdma_resolve_addr(3)rdma_get_dst_port(3)rdma_get_local_addr(3)rdma_get_peer_addr(3)
the whole friend group honestly π«Ά go read them together, they make so much more sense as a squad β¨
and that's the page!! this absolute banger of a manual page comes to you from librdmacm, dated 2007-05-15 β yes she's been serving since 2007 and she has not missed a day ππ mwah, ily, go bind your ports β
π¦ where this page comes from
- alpine 3.24: rdma-core-doc 61.0-r0 Β· GPL-2.0-only OR BSD-2-Clause
- arch rolling: rdma-core 65.0-1 Β· GPL-2.0-or-later OR LicenseRef-OpenIB.org-BSD-MIT AND GPL-2.0-or-later OR LicenseRef-OpenIB.org-BSD-FreeBSD AND GPL-2.0-or-later OR LicenseRef-Intel-BSD-3-Clause AND GPL-2.0-or-later OR LicenseRef-PathScale-BSD-Patent-License AND CC0-1.0 AND MIT AND BSD-2-Clause AND CPL-1.0 OR BSD-2-Clause OR GPL-2.0-or-later
- centos-stream 10: rdma-core-devel 62.0-3.el10 Β· GPLv2 or BSD
- centos-stream 9: rdma-core-devel 61.0-3.el9 Β· GPLv2 or BSD
- centos-stream 9: rdma-core-devel 61.0-3.el9 Β· GPLv2 or BSD
- debian bookworm: librdmacm-dev 44.0-2 Β· BSD-MIT OR GPL-2.0-only
- debian trixie: librdmacm-dev 56.1-1 Β· BSD-MIT OR GPL-2.0-only
- fedora 43: rdma-core-devel 58.0-4.fc43 Β· GPL-2.0-only OR BSD-2-Clause AND BSD-3-Clause
- fedora 43: rdma-core-devel 58.0-4.fc43 Β· GPL-2.0-only OR BSD-2-Clause AND BSD-3-Clause
- fedora 44: rdma-core-devel 61.0-2.fc44 Β· GPL-2.0-only OR BSD-2-Clause AND BSD-3-Clause
- fedora 44: rdma-core-devel 61.0-2.fc44 Β· GPL-2.0-only OR BSD-2-Clause AND BSD-3-Clause
- fedora 44: rdma-core-devel 61.1^20260812git975bdaf-1.fc44 Β· GPL-2.0-only OR BSD-2-Clause AND BSD-3-Clause
- fedora 44: rdma-core-devel 61.1^20260812git975bdaf-1.fc44 Β· GPL-2.0-only OR BSD-2-Clause AND BSD-3-Clause
- freebsd 14.5: base 14.5
- freebsd 15.1: base 15.1
- nixos 26.05: rdma-core 62.0
- nixpkgs unstable: rdma-core 65.0
- opensuse-leap 16.0: rdma-core-devel 56.1-160000.2.2 Β· BSD-2-Clause OR GPL-2.0-only
- opensuse-leap 16.0: rdma-core-devel 56.1-160000.2.2 Β· BSD-2-Clause OR GPL-2.0-only
- opensuse-leap 16.0: rdma-core-devel 56.1-160000.2.2 Β· BSD-2-Clause OR GPL-2.0-only
- opensuse-leap 16.0: rdma-core-devel 56.1-160000.2.2 Β· BSD-2-Clause OR GPL-2.0-only
- ubuntu jammy: librdmacm-dev 39.0-1 Β· BSD-MIT OR GPL-2.0-only
- ubuntu noble: librdmacm-dev 50.0-2build2 Β· BSD-MIT OR GPL-2.0-only
- ubuntu noble: librdmacm-dev 50.0-2ubuntu0.2 Β· BSD-MIT OR GPL-2.0-only
- ubuntu questing: librdmacm-dev 56.1-1ubuntu1
- ubuntu resolute: librdmacm-dev 61.0-2ubuntu3 Β· BSD-MIT OR GPL-2.0-only
- ubuntu stonking: librdmacm-dev 64.0-1ubuntu1 Β· BSD-MIT OR GPL-2.0-only
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms