diff --git a/ChangeLog b/ChangeLog index bf7ec06..e7e70d3 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,41 @@ +commit 0f2aa4bd8b698608876bec141c5aef1aa619730b +Author: Guus Sliepen +Date: Sat Jul 23 14:12:23 2011 +0200 + + Releasing 1.0.16. + +commit e16ead8dd9d4600664058069f0695832dfe068b2 +Author: Guus Sliepen +Date: Sat Jul 23 14:11:44 2011 +0200 + + Use usleep() instead of sleep(), MinGW complained. + +commit 50fcfea127c9d2fdf8894498a9fdcc6fb3bbb2ce +Author: Guus Sliepen +Date: Sun Jul 17 19:34:01 2011 +0200 + + Flush output buffer in send_tcppacket(). + + This is mainly important for Windows, where the select() call in the + main thread is not being woken up when the tapreader thread calls + route(), causing a delay of up to 1 second before the output buffer is + flushed. This would cause bad performance when UDP communication is not + possible. + +commit be2fc8b0458b1e2ced3b5de410356d8d8639acff +Author: Guus Sliepen +Date: Sat Jul 16 10:47:35 2011 +0200 + + Make code to detect two nodes with the same Name less triggerhappy. + + First of all, if there really are two nodes with the same name, much + more than 10 contradicting ADD_EDGE and DEL_EDGE messages will be sent. + Also, we forgot to reset the counters when nothing happened. + + In case there is a ADD_EDGE/DEL_EDGE storm, we do not shut down, but + sleep an increasing amount of time, allowing tinc to recover gracefully + from temporary failures. + commit 05260f941c2a24eb3f09070a2550cf15e431266a Author: Guus Sliepen Date: Fri Jun 24 14:50:20 2011 +0200 diff --git a/NEWS b/NEWS index 20a98d8..ab36c23 100644 --- a/NEWS +++ b/NEWS @@ -1,3 +1,10 @@ +Version 1.0.16 July 23 2011 + + * Fixed a performance issue with TCP communication under Windows. + + * Fixed code that, during network outages, would cause tinc to exit when it + thought two nodes with identical Names were on the VPN. + Version 1.0.15 June 24 2011 * Improved logging to file. diff --git a/README b/README index 52b3356..338f23c 100644 --- a/README +++ b/README @@ -1,4 +1,4 @@ -This is the README file for tinc version 1.0.15. Installation +This is the README file for tinc version 1.0.16. Installation instructions may be found in the INSTALL file. tinc is Copyright (C) 1998-2011 by: @@ -55,7 +55,7 @@ should be changed into "Device", and "Device" should be changed into Compatibility ------------- -Version 1.0.15 is compatible with 1.0pre8, 1.0 and later, but not with older +Version 1.0.16 is compatible with 1.0pre8, 1.0 and later, but not with older versions of tinc. diff --git a/configure b/configure index 22cdcfd..c9ce6d8 100755 --- a/configure +++ b/configure @@ -2731,7 +2731,7 @@ fi # Define the identity of the package. PACKAGE=tinc - VERSION=1.0.15 + VERSION=1.0.16 cat >>confdefs.h <<_ACEOF diff --git a/configure.in b/configure.in index 12938da..65b5c4c 100644 --- a/configure.in +++ b/configure.in @@ -3,7 +3,7 @@ dnl Process this file with autoconf to produce a configure script. AC_PREREQ(2.61) AC_INIT AC_CONFIG_SRCDIR([src/tincd.c]) -AM_INIT_AUTOMAKE(tinc, 1.0.15) +AM_INIT_AUTOMAKE(tinc, 1.0.16) AC_CONFIG_HEADERS([config.h]) AM_MAINTAINER_MODE diff --git a/debian/changelog b/debian/changelog index 27d7b8c..5d95c76 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,3 +1,17 @@ +tinc (1.0.16-1~bpo60+1) squeeze-backports; urgency=low + + * Rebuild for squeeze-backports, no changes. + + -- Michael Tokarev Mon, 12 Dec 2011 13:27:23 +0400 + +tinc (1.0.16-1) unstable; urgency=low + + * New upstream release. + * Mention alarm option in /etc/init.d/tinc's usage information. + Closes: #631761 + + -- Guus Sliepen Sat, 23 Jul 2011 14:37:56 +0200 + tinc (1.0.15-1) unstable; urgency=low * New upstream release. diff --git a/debian/tinc.init b/debian/tinc.init index 888ec73..51adc56 100644 --- a/debian/tinc.init +++ b/debian/tinc.init @@ -99,7 +99,7 @@ case "$1" in signal_running ALRM ;; *) - echo "Usage: /etc/init.d/$NAME {start|stop|reload|restart|force-reload}" + echo "Usage: /etc/init.d/$NAME {start|stop|reload|restart|force-reload|alarm}" exit 1 ;; esac diff --git a/doc/sample-config.tar.gz b/doc/sample-config.tar.gz index 17d7c43..581c238 100644 Binary files a/doc/sample-config.tar.gz and b/doc/sample-config.tar.gz differ diff --git a/lib/dropin.c b/lib/dropin.c index 4aed74e..eb17aca 100644 --- a/lib/dropin.c +++ b/lib/dropin.c @@ -165,7 +165,7 @@ int gettimeofday(struct timeval *tv, void *tz) { #endif #ifndef HAVE_USLEEP -int usleep(long usec) { +int usleep(long long usec) { struct timeval tv = {usec / 1000000, (usec / 1000) % 1000}; select(0, NULL, NULL, NULL, &tv); return 0; diff --git a/lib/dropin.h b/lib/dropin.h index 22fe36d..dc7dbee 100644 --- a/lib/dropin.h +++ b/lib/dropin.h @@ -42,7 +42,7 @@ extern int gettimeofday(struct timeval *, void *); #endif #ifndef HAVE_USLEEP -extern int usleep(long); +extern int usleep(long long); #endif #endif /* __DROPIN_H__ */ diff --git a/m4/ev.m4 b/m4/ev.m4 deleted file mode 100644 index 59d767b..0000000 --- a/m4/ev.m4 +++ /dev/null @@ -1,33 +0,0 @@ -dnl Check to find the libev headers/libraries - -AC_DEFUN([tinc_LIBEV], -[ - AC_ARG_WITH(libev, - AS_HELP_STRING([--with-libev=DIR], [libev base directory, or:]), - [libev="$withval" - CPPFLAGS="$CPPFLAGS -I$withval/include" - LDFLAGS="$LDFLAGS -L$withval/lib"] - ) - - AC_ARG_WITH(libev-include, - AS_HELP_STRING([--with-libev-include=DIR], [libev headers directory]), - [libev_include="$withval" - CPPFLAGS="$CPPFLAGS -I$withval"] - ) - - AC_ARG_WITH(libev-lib, - AS_HELP_STRING([--with-libev-lib=DIR], [libev library directory]), - [libev_lib="$withval" - LDFLAGS="$LDFLAGS -L$withval"] - ) - - AC_CHECK_HEADERS(ev.h, - [], - [AC_MSG_ERROR("ev header files not found."); break] - ) - - AC_CHECK_LIB(ev, ev_loop, - [LIBS="$LIBS -lev"], - [AC_MSG_ERROR("libev libraries not found.")] - ) -]) diff --git a/src/net.c b/src/net.c index c5193c5..8762db3 100644 --- a/src/net.c +++ b/src/net.c @@ -50,6 +50,7 @@ bool graph_dump = false; time_t now = 0; int contradicting_add_edge = 0; int contradicting_del_edge = 0; +static int sleeptime = 10; /* Purge edges and subnets of unreachable nodes. Use carefully. */ @@ -464,18 +465,25 @@ int main_loop(void) { keyexpires = now + keylifetime; } - if(contradicting_del_edge > 10 && contradicting_add_edge > 10) { - logger(LOG_WARNING, "Possible node with same Name as us!"); + /* Detect ADD_EDGE/DEL_EDGE storms that are caused when + * two tinc daemons with the same name are on the VPN. + * If so, sleep a while. If this happens multiple times + * in a row, sleep longer. */ - if(rand() % 3 == 0) { - logger(LOG_ERR, "Shutting down, check configuration of all nodes for duplicate Names!"); - running = false; - break; - } - - contradicting_add_edge = 0; - contradicting_del_edge = 0; + if(contradicting_del_edge > 100 && contradicting_add_edge > 100) { + logger(LOG_WARNING, "Possible node with same Name as us! Sleeping %d seconds.", sleeptime); + usleep(sleeptime * 1000000LL); + sleeptime *= 2; + if(sleeptime < 0) + sleeptime = 3600; + } else { + sleeptime /= 2; + if(sleeptime < 10) + sleeptime = 10; } + + contradicting_add_edge = 0; + contradicting_del_edge = 0; } if(sigalrm) { diff --git a/src/protocol_misc.c b/src/protocol_misc.c index 6f7ab03..3d405bc 100644 --- a/src/protocol_misc.c +++ b/src/protocol_misc.c @@ -129,7 +129,7 @@ bool send_tcppacket(connection_t *c, const vpn_packet_t *packet) { if(!send_request(c, "%d %hd", PACKET, packet->len)) return false; - return send_meta(c, (char *)packet->data, packet->len); + return send_meta(c, (char *)packet->data, packet->len) && flush_meta(c); } bool tcppacket_h(connection_t *c) {