Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 20 Dec 2016 17:49:40 +0100
From:      Willem Jan Withagen <wjw@digiware.nl>
To:        Jan Knepper <jan@digitaldaemon.com>, "freebsd-hackers@freebsd.org" <freebsd-hackers@freebsd.org>
Subject:   Re: binding by different process on the same port
Message-ID:  <65e3c99d-1267-c719-5da4-49ae88336086@digiware.nl>
In-Reply-To: <357e648a-d136-c251-bcdd-35eae31527d5@digiware.nl>
References:  <896832c9-7d63-cd9a-b0e9-7ad32e90568a@digiware.nl> <4CD224CB-1114-4361-B46D-5A3E7455DA0B@digitaldaemon.com> <357e648a-d136-c251-bcdd-35eae31527d5@digiware.nl>

next in thread | previous in thread | raw e-mail | index | archive | help
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




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?65e3c99d-1267-c719-5da4-49ae88336086>