Import Upstream version 1.0.34

This commit is contained in:
Guus Sliepen 2019-08-26 13:44:48 +02:00
parent 5969674c46
commit b28bb7b29b
36 changed files with 878 additions and 1106 deletions

View file

@ -261,9 +261,6 @@ PACKAGE_TARNAME = @PACKAGE_TARNAME@
PACKAGE_URL = @PACKAGE_URL@
PACKAGE_VERSION = @PACKAGE_VERSION@
PATH_SEPARATOR = @PATH_SEPARATOR@
PKG_CONFIG = @PKG_CONFIG@
PKG_CONFIG_LIBDIR = @PKG_CONFIG_LIBDIR@
PKG_CONFIG_PATH = @PKG_CONFIG_PATH@
SET_MAKE = @SET_MAKE@
SHELL = @SHELL@
STRIP = @STRIP@
@ -315,7 +312,7 @@ sbindir = @sbindir@
sharedstatedir = @sharedstatedir@
srcdir = @srcdir@
sysconfdir = @sysconfdir@
systemdsystemunitdir = @systemdsystemunitdir@
systemd_path = @systemd_path@
target_alias = @target_alias@
top_build_prefix = @top_build_prefix@
top_builddir = @top_builddir@

View file

@ -56,7 +56,7 @@ void expire_events(void) {
time_t diff;
/*
* Make all events appear expired by substracting the difference between
* Make all events appear expired by subtracting the difference between
* the expiration time of the last event and the current time.
*/

View file

@ -34,7 +34,7 @@ with this program; if not, write to the Free Software Foundation, Inc.,
#include "../config.h"
#endif
#if !defined (STDC) || !STDC
#if !defined (__STDC__) || !__STDC__
/* This is a separate conditional since some stdc systems
reject `defined (const)'. */
#ifndef const
@ -57,7 +57,7 @@ with this program; if not, write to the Free Software Foundation, Inc.,
it is simpler to just do this in the source for each such file. */
#define GETOPT_INTERFACE_VERSION 2
#if !defined (_LIBC) && defined (GLIBC) && GLIBC >= 2
#if !defined (_LIBC) && defined (__GLIBC__) && __GLIBC__ >= 2
#include <gnu-versions.h>
#if _GNU_GETOPT_INTERFACE_VERSION == GETOPT_INTERFACE_VERSION
#define ELIDE_CODE
@ -68,8 +68,8 @@ with this program; if not, write to the Free Software Foundation, Inc.,
/* This needs to come after some library #include
to get GNU_LIBRARY defined. */
#ifdef GNU_LIBRARY
to get __GNU_LIBRARY__ defined. */
#ifdef __GNU_LIBRARY__
/* Don't include stdlib.h for non-GNU C libraries because some of them
contain conflicting prototypes for getopt. */
#include <stdlib.h>
@ -83,7 +83,7 @@ with this program; if not, write to the Free Software Foundation, Inc.,
#endif
#endif
#if defined (WIN32) && !defined (CYGWIN32)
#if defined (WIN32) && !defined (__CYGWIN32__32)
/* It's not Unix, really. See? Capital letters. */
#include <windows.h>
#define getpid() GetCurrentProcessId()
@ -190,7 +190,7 @@ static enum {
/* Value of POSIXLY_CORRECT environment variable. */
static char *posixly_correct;
#ifdef GNU_LIBRARY
#ifdef __GNU_LIBRARY__
/* We want to avoid inclusion of string.h with non-GNU libraries
because there are many ways it can cause trouble.
On some systems, it contains special magic macros that don't work
@ -222,17 +222,17 @@ int chr;
/* If using GCC, we can safely declare strlen this way.
If not using GCC, it is ok not to declare it. */
#ifdef GNUC
#ifdef __GNUC__
/* Note that Motorola Delta 68k R3V7 comes with GCC but not stddef.h.
That was relevant to code that was here before. */
#if !defined (STDC) || !STDC
#if !defined (__STDC__) || !__STDC__
/* gcc with -traditional declares the built-in strlen to return int,
and has done so at least since version 2.4.5. -- rms. */
extern int strlen(const char *);
#endif /* not STDC */
#endif /* GNUC */
#endif /* not __STDC__ */
#endif /* __GNUC__ */
#endif /* not GNU_LIBRARY */
#endif /* not __GNU_LIBRARY__ */
/* Handle permutation of arguments. */
@ -291,7 +291,7 @@ text_set_element(libc_subinit, store_args_and_env);
`first_nonopt' and `last_nonopt' are relocated so that they describe
the new indices of the non-options in ARGV after they are moved. */
#if defined (STDC) && STDC
#if defined (__STDC__) && __STDC__
static void exchange(char **);
#endif
@ -374,7 +374,7 @@ char **argv;
/* Initialize the internal data when the first call is made. */
#if defined (STDC) && STDC
#if defined (__STDC__) && __STDC__
static const char *_getopt_initialize(int, char *const *, const char *);
#endif
static const char *

View file

@ -79,7 +79,7 @@ extern "C" {
returns the contents of the `val' field. */
struct option {
#if defined (STDC) && STDC
#if defined (__STDC__) && __STDC__
const char *name;
#else
char *name;
@ -97,15 +97,15 @@ extern "C" {
#define required_argument 1
#define optional_argument 2
#if defined (STDC) && STDC
#ifdef GNU_LIBRARY
#if defined (__STDC__) && __STDC__
#ifdef __GNU_LIBRARY__
/* Many other libraries have conflicting prototypes for getopt, with
differences in the consts, in stdlib.h. To avoid compilation
errors, only prototype getopt for the GNU C library. */
extern int getopt(int argc, char *const *argv, const char *shortopts);
#else /* not GNU_LIBRARY */
#else /* not __GNU_LIBRARY__ */
extern int getopt();
#endif /* GNU_LIBRARY */
#endif /* __GNU_LIBRARY__ */
extern int getopt_long(int argc, char *const *argv, const char *shortopts,
const struct option *longopts, int *longind);
extern int getopt_long_only(int argc, char *const *argv,
@ -117,13 +117,13 @@ extern "C" {
const char *shortopts,
const struct option *longopts, int *longind,
int long_only);
#else /* not STDC */
#else /* not __STDC__ */
extern int getopt();
extern int getopt_long();
extern int getopt_long_only();
extern int _getopt_internal();
#endif /* STDC */
#endif /* __STDC__ */
#ifdef cplusplus
}

View file

@ -25,7 +25,7 @@ with this program; if not, write to the Free Software Foundation, Inc.,
#include "getopt.h"
#if !defined (STDC) || !STDC
#if !defined (__STDC__) || !__STDC__
/* This is a separate conditional since some stdc systems
reject `defined (const)'. */
#ifndef const
@ -44,7 +44,7 @@ with this program; if not, write to the Free Software Foundation, Inc.,
it is simpler to just do this in the source for each such file. */
#define GETOPT_INTERFACE_VERSION 2
#if !defined (_LIBC) && defined (GLIBC) && GLIBC >= 2
#if !defined (_LIBC) && defined (__GLIBC__) && __GLIBC__ >= 2
#include <gnu-versions.h>
#if _GNU_GETOPT_INTERFACE_VERSION == GETOPT_INTERFACE_VERSION
#define ELIDE_CODE
@ -55,8 +55,8 @@ with this program; if not, write to the Free Software Foundation, Inc.,
/* This needs to come after some library #include
to get GNU_LIBRARY defined. */
#ifdef GNU_LIBRARY
to get __GNU_LIBRARY__ defined. */
#ifdef __GNU_LIBRARY__
#include <stdlib.h>
#endif

View file

@ -63,7 +63,7 @@
#ifndef HAVE_STRUCT_IP
struct ip {
#if BYTE_ORDER == LITTLE_ENDIAN
#if __BYTE_ORDER == __LITTLE_ENDIAN
unsigned int ip_hl: 4;
unsigned int ip_v: 4;
#else

View file

@ -167,6 +167,5 @@ void closelogger(void) {
case LOGMODE_NULL:
case LOGMODE_STDERR:
break;
break;
}
}

View file

@ -218,6 +218,7 @@ void terminate_connection(connection_t *c, bool report) {
}
edge_del(c->edge);
c->edge = NULL;
/* Run MST and SSSP algorithms */

View file

@ -580,18 +580,18 @@ static void send_udppacket(node_t *n, vpn_packet_t *origpkt) {
listen_socket[n->sock].priority = origpriority;
switch(listen_socket[n->sock].sa.sa.sa_family) {
#if defined(SOL_IP) && defined(IP_TOS)
#if defined(IP_TOS)
case AF_INET:
ifdebug(TRAFFIC) logger(LOG_DEBUG, "Setting IPv4 outgoing packet priority to %d", origpriority);
if(setsockopt(listen_socket[n->sock].udp, SOL_IP, IP_TOS, (void *)&origpriority, sizeof(origpriority))) { /* SO_PRIORITY doesn't seem to work */
if(setsockopt(listen_socket[n->sock].udp, IPPROTO_IP, IP_TOS, (void *)&origpriority, sizeof(origpriority))) { /* SO_PRIORITY doesn't seem to work */
logger(LOG_ERR, "System call `%s' failed: %s", "setsockopt", strerror(errno));
}
break;
#endif
#if defined(IPPROTO_IPV6) && defined(IPV6_TCLASS)
#if defined(IPV6_TCLASS)
case AF_INET6:
ifdebug(TRAFFIC) logger(LOG_DEBUG, "Setting IPv6 outgoing packet priority to %d", origpriority);

View file

@ -239,7 +239,7 @@ static bool read_rsa_private_key(void) {
return false;
}
#if !defined(HAVE_MINGW) && !defined(HAVE_CYGWIN)
#if !defined(HAVE_MINGW) && !defined(HAVE___CYGWIN32__)
struct stat s;
if(!fstat(fileno(fp), &s)) {
@ -860,7 +860,7 @@ static bool setup_myself(void) {
#ifdef HAVE_MINGW
Sleep(1000);
#endif
#ifdef HAVE_CYGWIN
#ifdef HAVE___CYGWIN32__
sleep(1);
#endif
execute_script("tinc-up", envp);

View file

@ -77,12 +77,12 @@ static void configure_tcp(connection_t *c) {
setsockopt(c->socket, SOL_TCP, TCP_NODELAY, (void *)&option, sizeof(option));
#endif
#if defined(SOL_IP) && defined(IP_TOS) && defined(IPTOS_LOWDELAY)
#if defined(IP_TOS) && defined(IPTOS_LOWDELAY)
option = IPTOS_LOWDELAY;
setsockopt(c->socket, SOL_IP, IP_TOS, (void *)&option, sizeof(option));
setsockopt(c->socket, IPPROTO_IP, IP_TOS, (void *)&option, sizeof(option));
#endif
#if defined(IPPROTO_IPV6) && defined(IPV6_TCLASS) && defined(IPTOS_LOWDELAY)
#if defined(IPV6_TCLASS) && defined(IPTOS_LOWDELAY)
option = IPTOS_LOWDELAY;
setsockopt(c->socket, IPPROTO_IPV6, IPV6_TCLASS, (void *)&option, sizeof(option));
#endif
@ -142,12 +142,14 @@ int setup_listen_socket(const sockaddr_t *sa) {
option = 1;
setsockopt(nfd, SOL_SOCKET, SO_REUSEADDR, (void *)&option, sizeof(option));
#if defined(SOL_IPV6) && defined(IPV6_V6ONLY)
#if defined(IPV6_V6ONLY)
if(sa->sa.sa_family == AF_INET6) {
setsockopt(nfd, SOL_IPV6, IPV6_V6ONLY, (void *)&option, sizeof(option));
setsockopt(nfd, IPPROTO_IPV6, IPV6_V6ONLY, (void *)&option, sizeof(option));
}
#else
#warning IPV6_V6ONLY not defined
#endif
if(get_config_string(lookup_config(config_tree, "BindToInterface"), &iface)) {
@ -238,7 +240,7 @@ int setup_vpn_in_socket(const sockaddr_t *sa) {
logger(LOG_WARNING, "Can't set UDP SO_SNDBUF to %i: %s", udp_sndbuf, strerror(errno));
}
#if defined(IPPROTO_IPV6) && defined(IPV6_V6ONLY)
#if defined(IPV6_V6ONLY)
if(sa->sa.sa_family == AF_INET6) {
setsockopt(nfd, IPPROTO_IPV6, IPV6_V6ONLY, (void *)&option, sizeof(option));
@ -250,14 +252,14 @@ int setup_vpn_in_socket(const sockaddr_t *sa) {
#define IP_DONTFRAGMENT IP_DONTFRAG
#endif
#if defined(SOL_IP) && defined(IP_MTU_DISCOVER) && defined(IP_PMTUDISC_DO)
#if defined(IP_MTU_DISCOVER) && defined(IP_PMTUDISC_DO)
if(myself->options & OPTION_PMTU_DISCOVERY) {
option = IP_PMTUDISC_DO;
setsockopt(nfd, SOL_IP, IP_MTU_DISCOVER, (void *)&option, sizeof(option));
setsockopt(nfd, IPPROTO_IP, IP_MTU_DISCOVER, (void *)&option, sizeof(option));
}
#elif defined(IPPROTO_IP) && defined(IP_DONTFRAGMENT)
#elif defined(IP_DONTFRAGMENT)
if(myself->options & OPTION_PMTU_DISCOVERY) {
option = 1;
@ -266,14 +268,14 @@ int setup_vpn_in_socket(const sockaddr_t *sa) {
#endif
#if defined(SOL_IPV6) && defined(IPV6_MTU_DISCOVER) && defined(IPV6_PMTUDISC_DO)
#if defined(IPV6_MTU_DISCOVER) && defined(IPV6_PMTUDISC_DO)
if(myself->options & OPTION_PMTU_DISCOVERY) {
option = IPV6_PMTUDISC_DO;
setsockopt(nfd, SOL_IPV6, IPV6_MTU_DISCOVER, (void *)&option, sizeof(option));
setsockopt(nfd, IPPROTO_IPV6, IPV6_MTU_DISCOVER, (void *)&option, sizeof(option));
}
#elif defined(IPPROTO_IPV6) && defined(IPV6_DONTFRAG)
#elif defined(IPV6_DONTFRAG)
if(myself->options & OPTION_PMTU_DISCOVERY) {
option = 1;
@ -509,11 +511,11 @@ connect:
#endif
if(proxytype != PROXY_EXEC) {
#if defined(SOL_IPV6) && defined(IPV6_V6ONLY)
#if defined(IPV6_V6ONLY)
int option = 1;
if(c->address.sa.sa_family == AF_INET6) {
setsockopt(c->socket, SOL_IPV6, IPV6_V6ONLY, (void *)&option, sizeof(option));
setsockopt(c->socket, IPPROTO_IPV6, IPV6_V6ONLY, (void *)&option, sizeof(option));
}
#endif

View file

@ -49,7 +49,7 @@ bool send_pong(connection_t *c) {
bool pong_h(connection_t *c) {
c->status.pinged = false;
/* Succesful connection, reset timeout if this is an outgoing connection. */
/* Successful connection, reset timeout if this is an outgoing connection. */
if(c->outgoing) {
c->outgoing->timeout = 0;

View file

@ -1,7 +1,7 @@
/*
tincd.c -- the main file for tincd
Copyright (C) 1998-2005 Ivo Timmermans
2000-2017 Guus Sliepen <guus@tinc-vpn.org>
2000-2018 Guus Sliepen <guus@tinc-vpn.org>
2008 Max Rijevski <maksuf@gmail.com>
2009 Michael Tokarev <mjt@tls.msk.ru>
2010 Julien Muchembled <jm@jmuchemb.eu>
@ -662,7 +662,7 @@ int main(int argc, char **argv) {
if(show_version) {
printf("%s version %s\n", PACKAGE, VERSION);
printf("Copyright (C) 1998-2017 Ivo Timmermans, Guus Sliepen and others.\n"
printf("Copyright (C) 1998-2018 Ivo Timmermans, Guus Sliepen and others.\n"
"See the AUTHORS file for a complete list.\n\n"
"tinc comes with ABSOLUTELY NO WARRANTY. This is free software,\n"
"and you are welcome to redistribute it under certain conditions;\n"

View file

@ -54,8 +54,8 @@ void bin2hex(char *src, char *dst, int length) {
}
}
#if defined(HAVE_MINGW) || defined(HAVE_CYGWIN)
#ifdef HAVE_CYGWIN
#if defined(HAVE_MINGW) || defined(HAVE___CYGWIN32__)
#ifdef HAVE___CYGWIN32__
#include <w32api/windows.h>
#endif