[prev in list] [next in list] [prev in thread] [next in thread] 

List:       freebsd-hackers
Subject:    Re: binding by different process on the same port
From:       Willem Jan Withagen <wjw () digiware ! nl>
Date:       2016-12-20 16:49:40
Message-ID: 65e3c99d-1267-c719-5da4-49ae88336086 () digiware ! nl
[Download RAW message or body]

On 18-12-2016 20:21, Willem Jan Withagen wrote:
> On 18-12-2016 16:50, Jan Knepper wrote:
>> I would guess 
>>
>>> wjw      ceph-osd-0   93336 43 tcp4   127.0.0.1:6804        *:*
>>
>> was started first. Claiming a specific port on a specific IP address...
> 
> Well I've been trying to recreate the situation with a fake server
> programs, one binds on localhost:port and the other on 0.0.0.0:port. And
> the order does not matter, but I have not (yet) been able to actually
> register on a port for the second time.
> 
> So it needs a bit more than just:
>     socket, bind, listen, accept

'mmmm,

There is SO_REUSEPORT, which explains the exact behaviour of what is
going on:
 SO_REUSEPORT allows completely duplicate bindings by multiple processes
 if they all set SO_REUSEPORT before binding the port.  This option
 permits multiple instances of a program to each receive UDP/IP  i
 multicast or broadcast datagrams destined for the bound port.

But the flag is not explicitly set in the code.

But there is a LOT of info on the net about Linux <> FreeBSD on
SO_REUSE{ADRR,PORT}.
So i guess that I have enough things to read over X-mas.

--WjW

_______________________________________________
freebsd-hackers@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/freebsd-hackers
To unsubscribe, send any mail to "freebsd-hackers-unsubscribe@freebsd.org"
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic