summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFederico G. Schwindt <fgsch@cvs.openbsd.org>2002-12-10 08:00:17 +0000
committerFederico G. Schwindt <fgsch@cvs.openbsd.org>2002-12-10 08:00:17 +0000
commit7d33e82414f4ac478d0c183cf3fd92ac128af7d5 (patch)
treea1907d6e17d1b1ff308e43d3b2dd4a9a4f3252c3
parent1787f4b5e0eb62f1ee6d289ad50de82eca3bb331 (diff)
fix setsockopt SO_REUSEADDR under linux emul; from NetBSD.
thanks to jpmp@fibertel.com.ar for the testbed. ish@ ok
-rw-r--r--sys/compat/linux/linux_socket.c11
1 files changed, 9 insertions, 2 deletions
diff --git a/sys/compat/linux/linux_socket.c b/sys/compat/linux/linux_socket.c
index cf876040e04..b51b61056ff 100644
--- a/sys/compat/linux/linux_socket.c
+++ b/sys/compat/linux/linux_socket.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: linux_socket.c,v 1.26 2002/11/27 07:30:36 ish Exp $ */
+/* $OpenBSD: linux_socket.c,v 1.27 2002/12/10 08:00:16 fgsch Exp $ */
/* $NetBSD: linux_socket.c,v 1.14 1996/04/05 00:01:50 christos Exp $ */
/*
@@ -793,7 +793,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: