svn commit: r252710 - in head/sys: netinet netinet6

Mikolaj Golub trociny at
Thu Jul 4 19:03:52 UTC 2013

On Thu, Jul 04, 2013 at 06:38:01PM +0000, Mikolaj Golub wrote:
> Author: trociny
> Date: Thu Jul  4 18:38:00 2013
> New Revision: 252710
> URL:
> Log:
>   In r227207, to fix the issue with possible NULL inp_socket pointer
>   dereferencing, when checking for SO_REUSEPORT option (and SO_REUSEADDR
>   for multicast), INP_REUSEPORT flag was introduced to cache the socket
>   option.  It was decided then that one flag would be enough to cache
>   both SO_REUSEPORT and SO_REUSEADDR: when processing SO_REUSEADDR
>   setsockopt(2), it was checked if it was called for a multicast address
>   and INP_REUSEPORT was set accordingly.
>   Unfortunately that approach does not work when setsockopt(2) is called
>   before binding to a multicast address: the multicast check fails and
>   INP_REUSEPORT is not set.
>   Fix this by adding INP_REUSEADDR flag to unconditionally cache
>   PR:		179901
>   Submitted by:	Michael Gmelin freebsd (initial version)
>   Reviewed by:	rwatson
>   MFC after:	1 week

Also, in this PR another issue is reported by Michael: if SO_REUSEADDR
is set for the first multicast bound socket and one tries to bind a
socket to the same address:port with SO_REUSEPORT, it fails, although
for multicast there should not be difference between SO_REUSEPORT and
SO_REUSEADDR. This is an old issue (observed on FreeBSD7 too), but I
would like to fix it. Below is a patch I am going to commit to HEAD.
Though I am not going to MFC it before 9.2 unless I have strong
support from people.

Mikolaj Golub
-------------- next part --------------
A non-text attachment was scrubbed...
Name: pr179901.2.1.patch
Type: text/x-diff
Size: 1884 bytes
Desc: not available
URL: <>

More information about the svn-src-head mailing list