Import Upstream version 1.0.16

This commit is contained in:
Guus Sliepen 2019-08-26 13:44:41 +02:00
parent d09cb3d82a
commit bb1aebd963
11 changed files with 70 additions and 50 deletions

View file

@ -1,3 +1,41 @@
commit 0f2aa4bd8b698608876bec141c5aef1aa619730b
Author: Guus Sliepen <guus@tinc-vpn.org>
Date: Sat Jul 23 14:12:23 2011 +0200
Releasing 1.0.16.
commit e16ead8dd9d4600664058069f0695832dfe068b2
Author: Guus Sliepen <guus@tinc-vpn.org>
Date: Sat Jul 23 14:11:44 2011 +0200
Use usleep() instead of sleep(), MinGW complained.
commit 50fcfea127c9d2fdf8894498a9fdcc6fb3bbb2ce
Author: Guus Sliepen <guus@tinc-vpn.org>
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 <guus@tinc-vpn.org>
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 commit 05260f941c2a24eb3f09070a2550cf15e431266a
Author: Guus Sliepen <guus@tinc-vpn.org> Author: Guus Sliepen <guus@tinc-vpn.org>
Date: Fri Jun 24 14:50:20 2011 +0200 Date: Fri Jun 24 14:50:20 2011 +0200

7
NEWS
View file

@ -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 Version 1.0.15 June 24 2011
* Improved logging to file. * Improved logging to file.

4
README
View file

@ -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. instructions may be found in the INSTALL file.
tinc is Copyright (C) 1998-2011 by: tinc is Copyright (C) 1998-2011 by:
@ -55,7 +55,7 @@ should be changed into "Device", and "Device" should be changed into
Compatibility 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. versions of tinc.

2
configure vendored
View file

@ -2731,7 +2731,7 @@ fi
# Define the identity of the package. # Define the identity of the package.
PACKAGE=tinc PACKAGE=tinc
VERSION=1.0.15 VERSION=1.0.16
cat >>confdefs.h <<_ACEOF cat >>confdefs.h <<_ACEOF

View file

@ -3,7 +3,7 @@ dnl Process this file with autoconf to produce a configure script.
AC_PREREQ(2.61) AC_PREREQ(2.61)
AC_INIT AC_INIT
AC_CONFIG_SRCDIR([src/tincd.c]) 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]) AC_CONFIG_HEADERS([config.h])
AM_MAINTAINER_MODE AM_MAINTAINER_MODE

Binary file not shown.

View file

@ -165,7 +165,7 @@ int gettimeofday(struct timeval *tv, void *tz) {
#endif #endif
#ifndef HAVE_USLEEP #ifndef HAVE_USLEEP
int usleep(long usec) { int usleep(long long usec) {
struct timeval tv = {usec / 1000000, (usec / 1000) % 1000}; struct timeval tv = {usec / 1000000, (usec / 1000) % 1000};
select(0, NULL, NULL, NULL, &tv); select(0, NULL, NULL, NULL, &tv);
return 0; return 0;

View file

@ -42,7 +42,7 @@ extern int gettimeofday(struct timeval *, void *);
#endif #endif
#ifndef HAVE_USLEEP #ifndef HAVE_USLEEP
extern int usleep(long); extern int usleep(long long);
#endif #endif
#endif /* __DROPIN_H__ */ #endif /* __DROPIN_H__ */

View file

@ -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.")]
)
])

View file

@ -50,6 +50,7 @@ bool graph_dump = false;
time_t now = 0; time_t now = 0;
int contradicting_add_edge = 0; int contradicting_add_edge = 0;
int contradicting_del_edge = 0; int contradicting_del_edge = 0;
static int sleeptime = 10;
/* Purge edges and subnets of unreachable nodes. Use carefully. */ /* Purge edges and subnets of unreachable nodes. Use carefully. */
@ -464,19 +465,26 @@ int main_loop(void) {
keyexpires = now + keylifetime; keyexpires = now + keylifetime;
} }
if(contradicting_del_edge > 10 && contradicting_add_edge > 10) { /* Detect ADD_EDGE/DEL_EDGE storms that are caused when
logger(LOG_WARNING, "Possible node with same Name as us!"); * 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) { if(contradicting_del_edge > 100 && contradicting_add_edge > 100) {
logger(LOG_ERR, "Shutting down, check configuration of all nodes for duplicate Names!"); logger(LOG_WARNING, "Possible node with same Name as us! Sleeping %d seconds.", sleeptime);
running = false; usleep(sleeptime * 1000000LL);
break; sleeptime *= 2;
if(sleeptime < 0)
sleeptime = 3600;
} else {
sleeptime /= 2;
if(sleeptime < 10)
sleeptime = 10;
} }
contradicting_add_edge = 0; contradicting_add_edge = 0;
contradicting_del_edge = 0; contradicting_del_edge = 0;
} }
}
if(sigalrm) { if(sigalrm) {
avl_node_t *node; avl_node_t *node;

View file

@ -129,7 +129,7 @@ bool send_tcppacket(connection_t *c, const vpn_packet_t *packet) {
if(!send_request(c, "%d %hd", PACKET, packet->len)) if(!send_request(c, "%d %hd", PACKET, packet->len))
return false; 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) { bool tcppacket_h(connection_t *c) {