Ticket 23658

Summary: Fix FreeBSD bind() and connect() calls: pass correct sockaddr length
Product: Slurm Reporter: Rikka Göring <rikka.goering>
Component: slurmdAssignee: Tim Wickberg <tim>
Status: OPEN --- QA Contact:
Severity: C - Contributions    
Priority: ---    
Version: 23.11.7   
Hardware: Other   
OS: Other   
Site: -Other- Slinky Site: ---
Alineos Sites: --- Atos/Eviden Sites: ---
Confidential Site: --- Coreweave sites: ---
Cray Sites: --- DS9 clusters: ---
Google sites: --- HPCnow Sites: ---
HPE Sites: --- IBM Sites: ---
NOAA SIte: --- NoveTech Sites: ---
Nvidia HWinf-CS Sites: --- OCF Sites: ---
Recursion Pharma Sites: --- SFW Sites: ---
SNIC sites: --- Tzag Elita Sites: ---
Linux Distro: --- Machine Name:
CLE Version: Version Fixed:
Target Release: --- DevPrio: ---
Emory-Cloud Sites: ---
Attachments: Patch to fix FreeBSD bind()/connect() calls by passing correct sockaddr lengths (uses _bsd_sockaddr_len_fix() and sets sun_len where needed). No functional changes for Linux.

Description Rikka Göring 2025-09-06 04:52:57 MDT
Created attachment 43024 [details]
Patch to fix FreeBSD bind()/connect() calls by passing correct sockaddr lengths (uses _bsd_sockaddr_len_fix() and sets sun_len where needed). No functional changes for Linux.

On FreeBSD, bind() and connect() require the correct sockaddr length
to be passed, including the sa_len/sun_len fields, otherwise the call
may fail with EINVAL. This patch ensures the correct length is computed
and applied in all affected places.

The changes are minimal and guarded by #if defined(__FreeBSD__), so
there is no impact on Linux or other platforms.

Original patch prepared for the FreeBSD port of Slurm; refined during
review by Vladimir Druzenko to minimize scope and keep diffs clean.