diff options
author | mark mark@31f1291d-b8d6-0310-a050-a5561fc1590b <mark mark@31f1291d-b8d6-0310-a050-a5561fc1590b@5417fbe8-f217-4b02-8779-1006273d7864> | 2008-08-21 17:20:03 +0000 |
---|---|---|
committer | mark mark@31f1291d-b8d6-0310-a050-a5561fc1590b <mark mark@31f1291d-b8d6-0310-a050-a5561fc1590b@5417fbe8-f217-4b02-8779-1006273d7864> | 2008-08-21 17:20:03 +0000 |
commit | 0030f51a2deb9ec8549f76c2a20311ac4d4e1b23 (patch) | |
tree | 4b8a42a70d09ba616336b727c34b08354340961a | |
parent | 1f637024fcc5c0f67d6d01fdff7d6a95e7562f6a (diff) |
BUILD : 1.7.21 (1417) BUGS : NOTES : Set SO_REUSEADDR on sock to prevent potential issues with bind() failing after a restart
git-svn-id: svn://svn.anope.org/anope/trunk@1417 31f1291d-b8d6-0310-a050-a5561fc1590b
git-svn-id: http://anope.svn.sourceforge.net/svnroot/anope/trunk@1132 5417fbe8-f217-4b02-8779-1006273d7864
-rw-r--r-- | Changes | 1 | ||||
-rw-r--r-- | src/sockutil.c | 6 | ||||
-rw-r--r-- | version.log | 6 |
3 files changed, 12 insertions, 1 deletions
@@ -48,6 +48,7 @@ Anope Version S V N 08/15 F CS OP now correctly works if there is only 1 user in the channel. [#922] 08/17 F Various InspIRCd issues. [#832] 08/18 F CS GETKEY response. [#880] +08/21 F Potential issues caused by not setting SO_REUSEADDR on socket. [ #00] Provided by Robin Burchell <w00t@inspircd.org> - 2008 08/08 F Strict warnings in send.c from comparing address of non-ptr [ #00] diff --git a/src/sockutil.c b/src/sockutil.c index 9465e0877..b28989bdb 100644 --- a/src/sockutil.c +++ b/src/sockutil.c @@ -559,6 +559,7 @@ int conn(const char *host, int port, const char *lhost, int lport) #endif struct sockaddr_in sa, lsa; ano_socket_t sock; + int sockopt = 1; memset(&lsa, 0, sizeof(lsa)); if (lhost) { @@ -598,6 +599,11 @@ int conn(const char *host, int port, const char *lhost, int lport) if ((sock = socket(sa.sin_family, SOCK_STREAM, 0)) < 0) return -1; + if (setsockopt + (sock, SOL_SOCKET, SO_REUSEADDR, (char *) &sockopt, + sizeof(int)) < 0) + alog("debug: couldn't set SO_REUSEADDR on socket"); + if ((lhost || lport) && bind(sock, (struct sockaddr *) &lsa, sizeof(lsa)) < 0) { int errno_save = ano_sockgeterr(); diff --git a/version.log b/version.log index 3bba91fdd..ae2699fee 100644 --- a/version.log +++ b/version.log @@ -9,10 +9,14 @@ VERSION_MAJOR="1" VERSION_MINOR="7" VERSION_PATCH="21" VERSION_EXTRA="-svn" -VERSION_BUILD="1416" +VERSION_BUILD="1417" # $Log$ # +# BUILD : 1.7.21 (1417) +# BUGS : +# NOTES : Set SO_REUSEADDR on sock to prevent potential issues with bind() failing after a restart +# # BUILD : 1.7.21 (1416) # BUGS : 880 # NOTES : Changed CS GETKEY response to what the help for GS GETKEY says it should be |