Subject: Re: [PATCH v2] net: Check the argument for listen(2)

From: Rick Jones <[email-masked]>
Date: Fri, 28 Jun 2013 11:01:28 -0700

On 06/28/2013 09:33 AM, Eric Dumazet wrote:

>
> Well, there is still this possible regression for old applications.
>
> Just use u32 fields instead of u16 ?

FWIW, the manpage for listen() gives the backlog parameter as an "int"

SYNOPSIS
        #include <sys/types.h>          /* See NOTES */
        #include <sys/socket.h>

        int listen(int sockfd, int backlog);

and mentions no explicit limit beyond 2.4.35, only interaction with the 
likes of /proc/sys/net/core/somaxconn.

And sys/socket.h has:

/* Prepare to accept connections on socket FD.
    N connection requests will be queued before further requests are 
refused.
    Returns 0 on success, -1 for errors.  */
extern int listen (int __fd, int __n) __THROW;

Not sure if it is considered "sane" to try to set the backlog to a 
negative value of course...

rick jones