summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJeremy Allison <jra@samba.org>2000-02-16 22:48:19 +0000
committerJeremy Allison <jra@samba.org>2000-02-16 22:48:19 +0000
commit8b45838ffc389538142a8923ea3b690014e7bbce (patch)
treebd7e437f902b9cc4bd3f073994a425c880b1ce3d
parent4feb8540b322d32b72d1a40f7b32f7fb73cd939c (diff)
downloadsamba-8b45838ffc389538142a8923ea3b690014e7bbce.tar.gz
samba-8b45838ffc389538142a8923ea3b690014e7bbce.tar.bz2
samba-8b45838ffc389538142a8923ea3b690014e7bbce.zip
Added support for SO_REUSEPORT for systems that have it.
Jeremy. (This used to be commit 377515cf9624720362c0b76969b9381d9972a13f)
-rw-r--r--source3/lib/util_sock.c12
1 files changed, 11 insertions, 1 deletions
diff --git a/source3/lib/util_sock.c b/source3/lib/util_sock.c
index 3a09c52a7a..fd5ed71c9c 100644
--- a/source3/lib/util_sock.c
+++ b/source3/lib/util_sock.c
@@ -76,6 +76,9 @@ struct
#ifdef IPTOS_THROUGHPUT
{"IPTOS_THROUGHPUT", IPPROTO_IP, IP_TOS, IPTOS_THROUGHPUT, OPT_ON},
#endif
+#ifdef SO_REUSEPORT
+ {"SO_REUSEPORT", SOL_SOCKET, SO_REUSEPORT, 0, OPT_BOOL},
+#endif
#ifdef SO_SNDBUF
{"SO_SNDBUF", SOL_SOCKET, SO_SNDBUF, 0, OPT_INT},
#endif
@@ -841,7 +844,14 @@ int open_socket_in(int type, int port, int dlevel,uint32 socket_addr, BOOL rebin
val=1;
else
val=0;
- setsockopt(res,SOL_SOCKET,SO_REUSEADDR,(char *)&val,sizeof(val));
+ if(setsockopt(res,SOL_SOCKET,SO_REUSEADDR,(char *)&val,sizeof(val)) == -1)
+ DEBUG(dlevel,("setsockopt: SO_REUSEADDR=%d on port %d failed with error = %s\n",
+ val, port, strerror(errno) ));
+#ifdef SO_REUSEPORT
+ if(setsockopt(res,SOL_SOCKET,SO_REUSEPORT,(char *)&val,sizeof(val)) == -1)
+ DEBUG(dlevel,("setsockopt: SO_REUSEPORT=%d on port %d failed with error = %s\n",
+ val, port, strerror(errno) ));
+#endif /* SO_REUSEPORT */
}
/* now we've got a socket - we need to bind it */