Re: The kern.ipc.somaxconn limit revisited.

2015-10-09 Thread Adrian Chadd
I think it's worth upping to an int type, so we can eventually up it to > 64k.

Please do submit diffs for revie.w :)


-a


On 9 October 2015 at 00:23, White Knight  wrote:
> Hi,
>
> Back in 2012, raising the limit of kern.ipc.somaxcann was discussed (now
> properly called kern.ipc.acceptqueue) but nothing came of it.  The old
> discussion is here:
>
>
> https://lists.freebsd.org/pipermail/freebsd-current/2012-January/030970.html
>
> We are running into problems with the limit capped to 16 bits.  I am
> prepared to write the patch and do all the necessary testing.
>
> A few things concern me.  The original patch(*) only changed the data types
> in usr/src/sys/sys/socketvar.h but neglected to update struct xsctp_inpcb in
> usr/src/sys/netinet/sctp_uio.h.
>
> First, what are the consequences of changing struct xsctp_inpcb?  Is ok to
> change the type from u_short to u_int, or is it better to deprecate these
> fields and use the padding?  If I understand the code correctly, this is
> part of the userland ABI.
>
> Second, if there is no arbitrary limit, this line in
> usr/src/sys/kern/uipc_socket.c can overflow.
>
>   over = (head->so_qlen > 3 * head->so_qlimit / 2);
>
> Should there be some arbitrary limit?
>
> Third, the original patch changed the arbitrary limit from USHRT_MAX to
> UINT_MAX, but does that make any sense?  As written, it'll require the u_int
> to overflow for the test to ever be true.  Plus, the value is passed in as
> an int, so is it at all possible to give system call anything higher than
> INT_MAX?
>
> Fourth, the snprintf() fields in usr/src/usr.bin/netstat/inet.c and
> usr/src/usr.bin/netstat/unix.c were not changed to account for larger than
> 16 bit numbers.  Is there really a need for a fixed length buffer to be
> formatted with snprintf() and then passed to printf()?
>
> Fifth, is there any need to change the formatting string in
> usr/src/sys/kern/uipc_debug.c?
>
> Sixth, in usr/src/sys/kern/uipc_socket.c, we have code like this, where
> optval is signed.
>
>   optval = so->so_qlimit;
>
> Does that mean the fields in struct socket are better off as signed than
> unsigned integers?
>
>
> (*)
> https://lists.freebsd.org/pipermail/freebsd-current/2012-January/031003.html
>
>
> Thank you,
>
> --
> White Knight
>
> I'm not from 2ch.net, I just work there.
> ___
> freebsd-current@freebsd.org mailing list
> https://lists.freebsd.org/mailman/listinfo/freebsd-current
> To unsubscribe, send any mail to "freebsd-current-unsubscr...@freebsd.org"
___
freebsd-current@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/freebsd-current
To unsubscribe, send any mail to "freebsd-current-unsubscr...@freebsd.org"


Re: The kern.ipc.somaxconn limit revisited.

2015-10-12 Thread White Knight

On 2015-10-10 02:47, Adrian Chadd wrote:
I think it's worth upping to an int type, so we can eventually up it to 
> 64k.


Please do submit diffs for revie.w :)


I'll work on the patch this week, thank you.


--
White Knight

I'm not from 2ch.net, I just work there.
___
freebsd-current@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/freebsd-current
To unsubscribe, send any mail to "freebsd-current-unsubscr...@freebsd.org"


Re: The kern.ipc.somaxconn limit revisited.

2015-10-21 Thread White Knight

On 2015-10-13 01:32, White Knight wrote:

On 2015-10-10 02:47, Adrian Chadd wrote:
I think it's worth upping to an int type, so we can eventually up it 
to > 64k.


Please do submit diffs for revie.w :)


I'll work on the patch this week, thank you.


I have submitted a bug report, with a patch for review, at

  https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=203922

I chose the arbitrary limit of 1431655765 in order to prevent an 
overflow (on systems where u_int is 32bit).


I'm somewhat unsure if my changes to struct xsctp_inpcb are ok.  Is it 
better to use the reserved fields?  And if I don't, like in my patch, is 
it better to shorten the reserved fields accordingly?


I decided not to touch other parts of the netstat formatted output, 
mostly to keep the patch short and to the point.


Please comment and let me know what else needs to be changed.

Are there other userland programs that touch the xsocket and xsctp_inpcb 
interfaces than netstat?


--
White Knight

I'm not from 2ch.net, I just work there.
___
freebsd-current@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/freebsd-current
To unsubscribe, send any mail to "freebsd-current-unsubscr...@freebsd.org"