> Le mercredi 21 avril 2010 à 22:27 +0400, Evgeniy Polyakov a écrit :
> > On Wed, Apr 21, 2010 at 01:27:33PM +0200, Eric Dumazet (
eric.dumazet@gmail.com) wrote:
> > > Here is the patch I use now and my test application is now able to open
> > > and connect 1000000 sockets (ulimit -n 1000000)
> > >
> > > Trick is bind_conflict() must refuse a socket to bind to a port on a non
> > > null IP if another socket already uses same port on same IP.
> > >
> > > Plus the previous patch sent (check a conflict before exiting the search
> > > loop)
> > >
> > > What do you think ?
> >
> > Looks good, but do we want to check only reused socket's address there?
> > What if one of the sockets does not have reuse option turned on, will it
> > break?
> >
>
> Well, if one socket doesnt have reuse option turned on, the previous
> test already works ?
>
> if (!reuse || !sk2->sk_reuse || sk2->sk_state == TCP_LISTEN) {
> if (!sk2_rcv_saddr || !sk_rcv_saddr ||
> sk2_rcv_saddr == sk_rcv_saddr)
> break;
> } else if (reuse && sk2->sk_reuse &&
> sk2_rcv_saddr &&
> sk2_rcv_saddr == sk_rcv_saddr)
> break;
>
> I failed to factorize this complex test :(