From: Tim Prepscius on
Greetings gods of the linux kernel,

Is SO_REUSEPORT available 2.6.ish - (or any version)?
I've been searching for a conclusive answer to this question and can't
find it.

(yes I know of SO_REUSEADDR, and I know the difference between this
and *PORT, and yes I know that I *definitely* need SO_REUSEPORT, no,
I'm unconcerned this may/may not be part of a "standard," yes I know
it is implemented differently on different systems, yes I know there
may be security problems, but no, I don't care about this.)


If it's not, are there any patches available which might enable it?

Could you point me in the right direction to find these patches?
Google/Bing seem to be failing me, and/or I'm picking the wrong/
unlucky search terms.


Thanks a lot!

-tim
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo(a)vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
From: Alexander Clouter on
Hi,

Tim Prepscius <timprepscius(a)gmail.com> wrote:
>
> Is SO_REUSEPORT available 2.6.ish - (or any version)?
> I've been searching for a conclusive answer to this question and can't
> find it.
>
That will be a no then:
----
alex(a)berk:~$ grep SO_REUSEPORT -r /usr/src/linux-2.6-stable/include/
/usr/src/linux-2.6-stable/include/asm-generic/socket.h:/* To add :#define SO_REUSEPORT 15 */
----

> (yes I know of SO_REUSEADDR, and I know the difference between this
> and *PORT, and yes I know that I *definitely* need SO_REUSEPORT, no,
> I'm unconcerned this may/may not be part of a "standard," yes I know
> it is implemented differently on different systems, yes I know there
> may be security problems, but no, I don't care about this.)
>
This really sounds like the sort of thing (for TCP/SCTP) where the
'master' process would maintain the listening socket and upon accept()
you would fork() or pass the file descriptor off to a thread. This
would make SO_REUSEPORT un-necessary and also your code would be
portable.

If you are doing things with UDP (or another datagram-esque stream) then
your master listener could pass off the incoming packets to
threads/processes trivially.

Of course this depends on what you are doing, but my opinion is that the
functionality has been unneeded so far by people in the kernel, so *I*
must be doing something wrong ;)

Cheers

--
Alexander Clouter
..sigmonster says: "Every man has his price. Mine is $3.95."

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo(a)vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
From: Brian Bloniarz on
On 06/23/2010 03:54 AM, Alexander Clouter wrote:
> Hi,
>
> Tim Prepscius <timprepscius(a)gmail.com> wrote:
>>
>> Is SO_REUSEPORT available 2.6.ish - (or any version)?
>> I've been searching for a conclusive answer to this question and can't
>> find it.
>>
> That will be a no then:
> ----
> alex(a)berk:~$ grep SO_REUSEPORT -r /usr/src/linux-2.6-stable/include/
> /usr/src/linux-2.6-stable/include/asm-generic/socket.h:/* To add :#define SO_REUSEPORT 15 */
> ----
>
>> (yes I know of SO_REUSEADDR, and I know the difference between this
>> and *PORT, and yes I know that I *definitely* need SO_REUSEPORT, no,
>> I'm unconcerned this may/may not be part of a "standard," yes I know
>> it is implemented differently on different systems, yes I know there
>> may be security problems, but no, I don't care about this.)
>>
> This really sounds like the sort of thing (for TCP/SCTP) where the
> 'master' process would maintain the listening socket and upon accept()
> you would fork() or pass the file descriptor off to a thread. This
> would make SO_REUSEPORT un-necessary and also your code would be
> portable.
>
> If you are doing things with UDP (or another datagram-esque stream) then
> your master listener could pass off the incoming packets to
> threads/processes trivially.
>
> Of course this depends on what you are doing, but my opinion is that the
> functionality has been unneeded so far by people in the kernel, so *I*
> must be doing something wrong ;)

Tom Herbert gave a pretty great description of why you
might want this functionality in his original patch submission:

http://kerneltrap.org/mailarchive/linux-netdev/2010/4/19/6274993

If you follow that thread though, there wasn't consensus about
the best architecture & API for it, and nothing has made it
yet.

I'm adding netdev to the cc, AFAIK it's the place for discussing
stuff like this.
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo(a)vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
From: Tom Herbert on
>> Of course this depends on what you are doing, but my opinion is that the
>> functionality has been unneeded so far by people in the kernel, so *I*
>> must be doing something wrong ;)
>
> Tom Herbert gave a pretty great description of why you
> might want this functionality in his original patch submission:
>
> http://kerneltrap.org/mailarchive/linux-netdev/2010/4/19/6274993
>
> If you follow that thread though, there wasn't consensus about
> the best architecture & API for it, and nothing has made it
> yet.
>
I am planning to get back to this as the patch still needs some work
and isn't quite robust or optimized yet. Some restructuring is needed
in the socket hash lists. The UDP implementation in the patch will
work okay, and the TCP works as long as the number of listeners isn't
changing.
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo(a)vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/