[Bug 243532] kern.ipc.maxsockets wrong init value
bugzilla-noreply at freebsd.org
bugzilla-noreply at freebsd.org
Thu Jan 23 00:10:23 UTC 2020
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=243532
Bug ID: 243532
Summary: kern.ipc.maxsockets wrong init value
Product: Base System
Version: CURRENT
Hardware: Any
OS: Any
Status: New
Severity: Affects Some People
Priority: ---
Component: kern
Assignee: bugs at FreeBSD.org
Reporter: rozhuk.im at gmail.com
I got:
kern.ipc.maxsockets: 517552
kern.maxfiles: 262144
/sys/kern/uipc_socket.c
static void
init_maxsockets(void *ignored)
{
TUNABLE_INT_FETCH("kern.ipc.maxsockets", &maxsockets);
maxsockets = imax(maxsockets, maxfiles);
}
SYSINIT(param, SI_SUB_TUNABLES, SI_ORDER_ANY, init_maxsockets, NULL);
looks like imin() should be used instead of imax():
sysctl_maxsockets(SYSCTL_HANDLER_ARGS)
{
int error, newmaxsockets;
newmaxsockets = maxsockets;
error = sysctl_handle_int(oidp, &newmaxsockets, 0, req);
if (error == 0 && req->newptr) {
if (newmaxsockets > maxsockets &&
newmaxsockets <= maxfiles) {
maxsockets = newmaxsockets;
EVENTHANDLER_INVOKE(maxsockets_change);
} else
error = EINVAL;
...
Also, IMHO sysctl_maxsockets() (and some other sysctl val handlers) should not
return EINVAL in case: oldval == newval.
This will avoid multiple error generation on system boot in case sysctl.conf
contains kern.ipc.maxsockets, kern.maxfiles and other things that could not be
decreased.
--
You are receiving this mail because:
You are the assignee for the bug.
More information about the freebsd-bugs
mailing list