diff options
-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 |