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
F154140994: D42985.id131205.diff
Sun, Apr 26, 12:44 PM
Unknown Object (File)
Sat, Apr 25, 6:51 AM
Unknown Object (File)
Fri, Apr 24, 6:30 PM
Unknown Object (File)
Thu, Apr 23, 7:05 AM
Unknown Object (File)
Thu, Apr 23, 6:07 AM
Unknown Object (File)
Wed, Apr 22, 4:15 AM
Unknown Object (File)
Tue, Apr 21, 9:29 PM
Unknown Object (File)
Tue, Apr 14, 12:15 AM
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...