Skip to content

fix: Add FreeBSD compatibility for TCP socket options#1187

Merged
FlorentinDUBOIS merged 1 commit intosozu-proxy:mainfrom
yonasBSD:fix/freebsd-build
Nov 30, 2025
Merged

fix: Add FreeBSD compatibility for TCP socket options#1187
FlorentinDUBOIS merged 1 commit intosozu-proxy:mainfrom
yonasBSD:fix/freebsd-build

Conversation

@yonas
Copy link
Contributor

@yonas yonas commented Nov 21, 2025

  • Replace Linux-only SOL_TCP with IPPROTO_TCP for FreeBSD
  • Add OS-specific TCP option constants (TCP_KEEPIDLE, TCP_KEEPINTVL, TCP_KEEPCNT)
  • Add missing imports: std::iter::repeat, libc::c_void
  • Wrap setsockopt / getsockopt calls for cross-platform compatibility

@FlorentinDUBOIS
Copy link
Collaborator

Hello @yonas,

Thanks you for the pull request, I hope those changes will help Sozu to run under FreeBSD.
@Wonshtrum could you review the changes here and test it as well?

Copy link
Collaborator

@FlorentinDUBOIS FlorentinDUBOIS left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me, but will wait another review to merge

Copy link
Member

@Wonshtrum Wonshtrum left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Seems good to me.
I would just move the iter::repeat import inside the get_executable_path of freebsd to avoid the unused import warnings.
Or get rid of repeat entirely.

Replace Linux-only SOL_TCP with IPPROTO_TCP for FreeBSD
Add OS-specific TCP option constants (TCP_KEEPIDLE, TCP_KEEPINTVL, TCP_KEEPCNT)
Add missing imports: std::iter::repeat, libc::c_void
Wrap setsockopt / getsockopt calls for cross-platform compatibility
@yonas yonas force-pushed the fix/freebsd-build branch from 01386d3 to ab485fc Compare November 21, 2025 17:21
@yonas
Copy link
Contributor Author

yonas commented Nov 21, 2025

I've added @Wonshtrum changes and formatting fixes via rustfmt.

@FlorentinDUBOIS FlorentinDUBOIS merged commit 0cc5d79 into sozu-proxy:main Nov 30, 2025
11 of 12 checks passed
@yonas yonas deleted the fix/freebsd-build branch November 30, 2025 16:35
@yonas
Copy link
Contributor Author

yonas commented Nov 30, 2025

Thanks @FlorentinDUBOIS !

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants