]> git.ipfire.org Git - thirdparty/openvpn.git/commitdiff
SO_REUSEADDR should not be set on Windows TCP sockets because
authorjames <james@e7ae566f-a301-0410-adde-c780ea21d3b5>
Wed, 1 Nov 2006 21:21:01 +0000 (21:21 +0000)
committerjames <james@e7ae566f-a301-0410-adde-c780ea21d3b5>
Wed, 1 Nov 2006 21:21:01 +0000 (21:21 +0000)
it will cause bind to succeed on port conflicts.

git-svn-id: http://svn.openvpn.net/projects/openvpn/branches/BETA21/openvpn@1428 e7ae566f-a301-0410-adde-c780ea21d3b5

socket.c

index 96e05628e74091f654736676ee8aa5f254ec769b..a37229536db20c653be422c7446f81bb5cb6d426 100644 (file)
--- a/socket.c
+++ b/socket.c
@@ -482,6 +482,7 @@ create_socket_tcp (void)
   if ((sd = socket (PF_INET, SOCK_STREAM, IPPROTO_TCP)) < 0)
     msg (M_SOCKERR, "Cannot create TCP socket");
 
+#ifndef WIN32 /* using SO_REUSEADDR on Windows will cause bind to succeed on port conflicts! */
   /* set SO_REUSEADDR on socket */
   {
     int on = 1;
@@ -489,6 +490,7 @@ create_socket_tcp (void)
                    (void *) &on, sizeof (on)) < 0)
       msg (M_SOCKERR, "TCP: Cannot setsockopt SO_REUSEADDR on TCP socket");
   }
+#endif
 
 #if 0
   /* set socket linger options */