Re: BIO_get_accept_socket weirdness

2014-07-05 Thread Ben Laurie
On 5 July 2014 12:37, Kurt Roeckx wrote: > But then I found some MSDN documentation that says that Windows > allows others to hijack your socket when you've set SO_REUSEADDR > and the results are non-deterministic. They also created an > SO_EXCLUSIVEADDRUSE and I'm getting confused what it really

Re: BIO_get_accept_socket weirdness

2014-07-05 Thread Kurt Roeckx
On Sat, Jul 05, 2014 at 02:55:36PM -0400, Tim Hudson wrote: > > Some google engineering (search) will show the the variety of > confusion that this causes in cross-platform code. > > Start here for some interesting reading - > http://stackoverflow.com/questions/14388706/socket-options-so-reuseaddr

Re: BIO_get_accept_socket weirdness

2014-07-05 Thread Jeff Trawick
On Sat, Jul 5, 2014 at 2:37 PM, Tim Hudson wrote: > On 5/07/2014 2:14 PM, Kurt Roeckx wrote: > > On Sat, Jul 05, 2014 at 12:45:37PM -0400, Tim Hudson wrote: > >> If you have SO_REUSEADDR set and a listener already in place you will > >> start a new listener > > No you won't. You will get a bind(

Re: BIO_get_accept_socket weirdness

2014-07-05 Thread Tim Hudson
> Some google engineering (search) will show the the variety of confusion that this causes in cross-platform code. Start here for some interesting reading - http://stackoverflow.com/questions/14388706/socket-options-so-reuseaddr-and-so-reuseport-how-do-they-differ-do-they-mean-t You will find *man

Re: BIO_get_accept_socket weirdness

2014-07-05 Thread Kurt Roeckx
On Sat, Jul 05, 2014 at 02:37:49PM -0400, Tim Hudson wrote: > On 5/07/2014 2:14 PM, Kurt Roeckx wrote: > > On Sat, Jul 05, 2014 at 12:45:37PM -0400, Tim Hudson wrote: > >> If you have SO_REUSEADDR set and a listener already in place you will > >> start a new listener > > No you won't. You will ge

RE: BIO_get_accept_socket weirdness

2014-07-05 Thread Salz, Rich
Those who forget history are doomed to re-implement it, wrongly. SO_REUSEADDR was implemented in 4.2BSD so that a server could restart without waiting for the various FIN_WAIT timeouts to happen. :) /r$ -- Principal Security Engineer Akamai Technologies, Cambridge, MA IM: rs...@jabbe

Re: BIO_get_accept_socket weirdness

2014-07-05 Thread Tim Hudson
On 5/07/2014 2:14 PM, Kurt Roeckx wrote: > On Sat, Jul 05, 2014 at 12:45:37PM -0400, Tim Hudson wrote: >> If you have SO_REUSEADDR set and a listener already in place you will >> start a new listener > No you won't. You will get a bind() error: > socket(PF_INET, SOCK_STREAM, IPPROTO_TCP) = 3 > se

Re: BIO_get_accept_socket weirdness

2014-07-05 Thread Kurt Roeckx
On Sat, Jul 05, 2014 at 12:45:37PM -0400, Tim Hudson wrote: > On 5/07/2014 9:12 AM, Kurt Roeckx wrote: > > On Sat, Jul 05, 2014 at 08:13:04AM -0400, Eric Covener wrote: > >> On Sat, Jul 5, 2014 at 7:37 AM, Kurt Roeckx wrote: > >>> Does anybody have an idea why it's trying to do that, and why we >

Re: BIO_get_accept_socket weirdness

2014-07-05 Thread Tim Hudson
On 5/07/2014 9:12 AM, Kurt Roeckx wrote: > On Sat, Jul 05, 2014 at 08:13:04AM -0400, Eric Covener wrote: >> On Sat, Jul 5, 2014 at 7:37 AM, Kurt Roeckx wrote: >>> Does anybody have an idea why it's trying to do that, and why we >>> shouldn't just do SO_REUSEADDR the first time? Was there some >>>

Re: BIO_get_accept_socket weirdness

2014-07-05 Thread Kurt Roeckx
On Sat, Jul 05, 2014 at 08:13:04AM -0400, Eric Covener wrote: > On Sat, Jul 5, 2014 at 7:37 AM, Kurt Roeckx wrote: > > Does anybody have an idea why it's trying to do that, and why we > > shouldn't just do SO_REUSEADDR the first time? Was there some > > OS that maybe did strange things when tryin

Re: BIO_get_accept_socket weirdness

2014-07-05 Thread Eric Covener
On Sat, Jul 5, 2014 at 7:37 AM, Kurt Roeckx wrote: > Does anybody have an idea why it's trying to do that, and why we > shouldn't just do SO_REUSEADDR the first time? Was there some > OS that maybe did strange things when trying to use SO_REUSEADDR > and it was already in use? FWLIW: I've seen t