Linux does not implement SO_REUSEPORT, but allows reuse of a

host:port pair through SO_REUSEADDR even if the address is not a
multicast-address.  Effectively, this means that we should use
SO_REUSEPORT when SO_REUSEADDR is set (from the linux process)
to allow Linux applications to not exit with EADDRINUSE.

(Previously erraneously applied to 1.5 branch; approved for
proper location by thorpej)
This commit is contained in:
jschauma 2002-05-12 18:30:32 +00:00
parent 403b0fdb73
commit 839f90b6f7
1 changed files with 10 additions and 3 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: linux_socket.c,v 1.38 2002/04/08 14:00:31 christos Exp $ */
/* $NetBSD: linux_socket.c,v 1.39 2002/05/12 18:30:32 jschauma Exp $ */
/*-
* Copyright (c) 1995, 1998 The NetBSD Foundation, Inc.
@ -47,7 +47,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: linux_socket.c,v 1.38 2002/04/08 14:00:31 christos Exp $");
__KERNEL_RCSID(0, "$NetBSD: linux_socket.c,v 1.39 2002/05/12 18:30:32 jschauma Exp $");
#if defined(_KERNEL_OPT)
#include "opt_inet.h"
@ -440,7 +440,14 @@ linux_to_bsd_so_sockopt(lopt)
case LINUX_SO_DEBUG:
return SO_DEBUG;
case LINUX_SO_REUSEADDR:
return SO_REUSEADDR;
/*
* Linux does not implement SO_REUSEPORT, but allows reuse of a
* host:port pair through SO_REUSEADDR even if the address is not a
* multicast-address. Effectively, this means that we should use
* SO_REUSEPORT to allow Linux applications to not exit with
* EADDRINUSE
*/
return SO_REUSEPORT;
case LINUX_SO_TYPE:
return SO_TYPE;
case LINUX_SO_ERROR: