Page MenuHomeFreeBSD

tcp: allow SOL_SOCKET level socket options via sysctl interface
ClosedPublic

Authored by tuexen on Dec 9 2023, 9:38 AM.
Tags
None
Referenced Files
Unknown Object (File)
Thu, Jun 27, 12:35 AM
Unknown Object (File)
Thu, Jun 27, 12:17 AM
Unknown Object (File)
Mon, Jun 24, 10:03 AM
Unknown Object (File)
Fri, Jun 21, 8:30 AM
Unknown Object (File)
Thu, Jun 20, 5:23 PM
Unknown Object (File)
Thu, Jun 20, 4:48 AM
Unknown Object (File)
Wed, Jun 19, 11:12 PM
Unknown Object (File)
Wed, Jun 19, 11:01 PM
Subscribers

Details

Summary

When setting a SOL_SOCKET-level socket option, the TCP handler refers to the IP handler, which only handles SO_SETFIB and SO_MAX_PACING_RATE. So call sosetopt(), which handles all SOL_SOCKET-level options.
We could call sosetopt() always, but that would do a INP_WUNLOCK() followed up by a INP_WLOCK() in cases where the level is not SOL_SOCKET.

Diff Detail

Repository
rG FreeBSD src repository
Lint
Lint Not Applicable
Unit
Tests Not Applicable

Event Timeline

tuexen requested review of this revision.Dec 9 2023, 9:38 AM

Since this is from tcpsso - just curious if it wouldn't be possible to call setsockopt from within that utility after getting the socket from the inpcb id?

This revision is now accepted and ready to land.Dec 9 2023, 10:25 AM

Since this is from tcpsso - just curious if it wouldn't be possible to call setsockopt from within that utility after getting the socket from the inpcb id?

tcpsso does not get the socket. It is the kernel in sysctl_setsockopt(), which can access the socket. It already does so to add a reference to it.

So, no way to change the e.g. SO_SNDBUF on existing kernels then.. :(

So, no way to change the e.g. SO_SNDBUF on existing kernels then.. :(

No, but you know which patch to apply...