Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 23 Jan 2020 00:10:22 +0000
From:      bugzilla-noreply@freebsd.org
To:        bugs@FreeBSD.org
Subject:   [Bug 243532] kern.ipc.maxsockets wrong init value
Message-ID:  <bug-243532-227@https.bugs.freebsd.org/bugzilla/>

index | next in thread | raw e-mail

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@FreeBSD.org
          Reporter: rozhuk.im@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.

help

Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?bug-243532-227>