I have some code that does a sysctlbyname to pull in "kern.ipc.maxsockbuf",
I then use that value to setsockopt the SNDBUF to that amount, but
I get ENOBUFS back from the kernel.  I think I'm failing here in
uipc_socket2.c" line 432 in the function sbreserve():

        if ((u_quad_t)cc > (u_quad_t)sb_max * MCLBYTES / (MSIZE + MCLBYTES))
                return (0);

I'm not sure why the sysctl seems to lie about it:

u_long  sb_max = SB_MAX;                /* XXX should be static */

shouldn't it be:

u_long  sb_max = SB_MAX > (u_quad_t)SB_MAX * MCLBYTES / (MSIZE + MCLBYTES) ?
        (u_quad_t)SB_MAX * MCLBYTES / (MSIZE + MCLBYTES) : SB_MAX;


?

Also, if sb_max is to remain a read/write sysctl we'll need to cap
it so that kern.ipc.maxsockbuf is always true and we don't allow
sysadmins to shoot thier feet by scaling it too high or low, the
only problem is that I can't for the life of me figure out the
magic to keep sb_max (kern.ipc.maxsockbuf) as a ulong (which it
should be, instead of an int) as well as provide a filtering
function.

-- 
-Alfred Perlstein - [[EMAIL PROTECTED]|[EMAIL PROTECTED]]
"I have the heart of a child; I keep it in a jar on my desk."


To Unsubscribe: send mail to [EMAIL PROTECTED]
with "unsubscribe freebsd-hackers" in the body of the message

Reply via email to