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: b...@freebsd.org
          Reporter: rozhuk...@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.
_______________________________________________
freebsd-bugs@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/freebsd-bugs
To unsubscribe, send any mail to "freebsd-bugs-unsubscr...@freebsd.org"

Reply via email to