setsockopt() and kern.ipc.maxsockbuf

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view

setsockopt() and kern.ipc.maxsockbuf

Cameron Sparr

I'm not sure if this is the correct place to do it, but I'd like to put out
a proposal for changing the way that the setsockopt() function handles the
max socket buffer setting.

Currently, it's a bit unintuitive that SO_RCVBUF & SO_SNDBUF can not
actually be set to the kern.ipc.maxsockbuf value, even though it is
described as being possible in the man page:

This is because setsockopt() will error out if the value passed is over the
_adjusted_ maximum, which on my system (amd64) turns out to be something
like kern.ipc.maxsockbuf * 0.889 (kern.ipc.maxsockbuf * (1 << 11) / (256 +
(1 << 11)) = kern.ipc.maxsockbuf * (2048) / (2304)).

see here:
and here:

I believe that the behavior could be made more intuitive by checking if the
value passed is under the _actual_ max before erroring out, and if it is
under the actual max, then set it to the adjusted max and continue the
function, this would be a simple change and would look something like this
(apologies for the whitespace diffs):

Also, I'm a newb to the freebsd mailing lists, so please let me know if
this sort of request should go elsewhere.

Thanks all,
[hidden email] mailing list
To unsubscribe, send any mail to "[hidden email]"