Import Upstream version 1.0.15

This commit is contained in:
Guus Sliepen 2019-08-26 13:44:41 +02:00
parent d906f6f9b0
commit d09cb3d82a
60 changed files with 765 additions and 495 deletions

View file

@ -11,6 +11,7 @@ Significant contributions from:
- Julien Muchembled <jm@jmuchemb.eu>
- Timothy Redaelli <timothy@redaelli.eu>
- Brandon Black <blblack@gmail.com>
- Loïc Grenié <loic.grenie@gmail.com>
These files are from other sources:
* lib/pidfile.h and lib/pidfile.c are by Martin Schulze, taken from

View file

@ -1,6 +1,86 @@
commit f3f7ccfb2890576cb8992ec5e432310cec27627a
commit 05260f941c2a24eb3f09070a2550cf15e431266a
Author: Guus Sliepen <guus@tinc-vpn.org>
Date: Sun May 8 23:15:25 2011 +0200
Date: Fri Jun 24 14:50:20 2011 +0200
Releasing 1.0.15.
commit 3c0511984f0041f79e64bcc55d58680f86e8e408
Author: Guus Sliepen <guus@tinc-vpn.org>
Date: Fri Jun 24 12:27:04 2011 +0200
Remove redundant @CFLAGS@ from AM_CFLAGS.
commit 4b3fd94b1cc79c24c4092b6b10ed4627a2648d26
Author: Guus Sliepen <guus@tinc-vpn.org>
Date: Mon Jun 6 16:26:11 2011 +0200
Improved --logfile option.
Instead of UNIX time, the log messages now start with the time in RFC3339
format, which human-readable and still easy for the computer to parse and sort.
The HUP signal will also cause the log file to be closed and reopened, which is
useful when log rotation is used. If there is an error while opening the log
file, this is logged to stderr.
commit b3bbeab6e669795f6f5a6b98590da359178bfdce
Author: Guus Sliepen <guus@tinc-vpn.org>
Date: Sat Jun 4 11:27:54 2011 +0200
Attribution for Loïc Grenié.
commit 50af33d01f425983dd2b1d7b61092a6325be3f41
Author: Loïc Grenié <loic.grenie@gmail.com>
Date: Sat Jun 4 09:05:23 2011 +0200
Nearly tickless tinc.
Use pselect instead of select in main_loop (if available). This lets
tincd sleeps as long as there is nothing to do.
commit 64771f73ebbff04262defcde59263e98f89f0fa1
Author: Guus Sliepen <guus@tinc-vpn.org>
Date: Sat May 28 23:46:56 2011 +0200
Remove a few unnecessary #includes.
Some spotted by Michael Tokarev.
commit 5cff8c47c1781a88123c128a4cec6cdd39925aa5
Author: Guus Sliepen <guus@tinc-vpn.org>
Date: Sat May 28 23:42:18 2011 +0200
Remove newlines from log messages.
commit 6d08eb1614b59d5f86a43edda9db06fca72b76cd
Author: Guus Sliepen <guus@tinc-vpn.org>
Date: Sat May 28 23:36:52 2011 +0200
Fix sparse warnings and add an extra sprinkling of const.
This is more or less the equivalent of Sven-Haegar Koch's fixes in the 1.1
branch.
commit 07ffb1a19859791d419b83a876ba552dadedbf46
Author: Guus Sliepen <guus@tinc-vpn.org>
Date: Sun May 22 15:56:04 2011 +0200
Make return value of SetPriorityClass() behave the same as setpriority().
commit 03b7118139f57033659730afb740bf5cef7c961c
Author: Guus Sliepen <guus@tinc-vpn.org>
Date: Fri May 13 12:37:26 2011 +0200
Reorder checks for libraries to allow ./configure LDFLAGS=-static.
OpenSSL depends on libdl and libz. When linking dynamically, libcrypto will
automatically link with the other two libraries. However, when linking
statically, these libraries need to be specified explicitly while linking. By
moving the autoconf checks for libdl and libz before those for libcrypto, we
ensure the latter test will be done with the proper libraries.
commit 5686ad80b545afa3de9ed2f4176a5346e289aaa8
Author: Guus Sliepen <guus@tinc-vpn.org>
Date: Sun May 8 23:17:46 2011 +0200
Releasing 1.0.14.

View file

@ -37,7 +37,7 @@ subdir = .
DIST_COMMON = README $(am__configure_deps) $(srcdir)/Makefile.am \
$(srcdir)/Makefile.in $(srcdir)/config.h.in \
$(top_srcdir)/configure AUTHORS COPYING ChangeLog INSTALL NEWS \
THANKS TODO config.guess config.sub depcomp install-sh missing
THANKS config.guess config.sub depcomp install-sh missing
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
am__aclocal_m4_deps = $(top_srcdir)/m4/attribute.m4 \
$(top_srcdir)/m4/lzo.m4 $(top_srcdir)/m4/openssl.m4 \

8
NEWS
View file

@ -1,3 +1,11 @@
Version 1.0.15 June 24 2011
* Improved logging to file.
* Reduced amount of process wakeups on platforms which support pselect().
* Fixed ProcessPriority option under Windows.
Version 1.0.14 May 8 2011
* Fixed reading configuration files that do not end with a newline. Again.

4
README
View file

@ -1,4 +1,4 @@
This is the README file for tinc version 1.0.14. Installation
This is the README file for tinc version 1.0.15. 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.14 is compatible with 1.0pre8, 1.0 and later, but not with older
Version 1.0.15 is compatible with 1.0pre8, 1.0 and later, but not with older
versions of tinc.

1
THANKS
View file

@ -19,6 +19,7 @@ We would like to thank the following people for their contributions to tinc:
* Jeroen Ubbink
* Jerome Etienne
* Julien Muchembled
* Loïc Grenié
* Lubomír Bulej
* Mads Kiilerich
* Marc A. Lehmann

7
TODO
View file

@ -1,7 +0,0 @@
* end-to-end encryption
* perfect forward secrecy, ECDH
* AES in counter mode
* Replay + Delay protection
* MPLS-like label
* Conflicting Subnets or key-name pairs: disable both, inform admin

27
config.guess vendored
View file

@ -1,10 +1,10 @@
#! /bin/sh
# Attempt to guess a canonical system name.
# Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999,
# 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010
# Free Software Foundation, Inc.
# 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010,
# 2011 Free Software Foundation, Inc.
timestamp='2009-12-30'
timestamp='2011-05-11'
# This file is free software; you can redistribute it and/or modify it
# under the terms of the GNU General Public License as published by
@ -57,7 +57,7 @@ GNU config.guess ($timestamp)
Originally written by Per Bothner.
Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000,
2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010 Free
2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Free
Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
@ -270,7 +270,10 @@ case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in
# A Xn.n version is an unreleased experimental baselevel.
# 1.2 uses "1.2" for uname -r.
echo ${UNAME_MACHINE}-dec-osf`echo ${UNAME_RELEASE} | sed -e 's/^[PVTX]//' | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'`
exit ;;
# Reset EXIT trap before exiting to avoid spurious non-zero exit code.
exitcode=$?
trap '' 0
exit $exitcode ;;
Alpha\ *:Windows_NT*:*)
# How do we know it's Interix rather than the generic POSIX subsystem?
# Should we change UNAME_MACHINE based on the output of uname instead
@ -552,7 +555,7 @@ EOF
echo rs6000-ibm-aix3.2
fi
exit ;;
*:AIX:*:[456])
*:AIX:*:[4567])
IBM_CPU_ID=`/usr/sbin/lsdev -C -c processor -S available | sed 1q | awk '{ print $1 }'`
if /usr/sbin/lsattr -El ${IBM_CPU_ID} | grep ' POWER' >/dev/null 2>&1; then
IBM_ARCH=rs6000
@ -879,7 +882,13 @@ EOF
then
echo ${UNAME_MACHINE}-unknown-linux-gnu
else
if echo __ARM_PCS_VFP | $CC_FOR_BUILD -E - 2>/dev/null \
| grep -q __ARM_PCS_VFP
then
echo ${UNAME_MACHINE}-unknown-linux-gnueabi
else
echo ${UNAME_MACHINE}-unknown-linux-gnueabihf
fi
fi
exit ;;
avr32*:Linux:*:*)
@ -968,6 +977,9 @@ EOF
sparc:Linux:*:* | sparc64:Linux:*:*)
echo ${UNAME_MACHINE}-unknown-linux-gnu
exit ;;
tile*:Linux:*:*)
echo ${UNAME_MACHINE}-tilera-linux-gnu
exit ;;
vax:Linux:*:*)
echo ${UNAME_MACHINE}-dec-linux-gnu
exit ;;
@ -1231,6 +1243,9 @@ EOF
*:QNX:*:4*)
echo i386-pc-qnx
exit ;;
NEO-?:NONSTOP_KERNEL:*:*)
echo neo-tandem-nsk${UNAME_RELEASE}
exit ;;
NSE-?:NONSTOP_KERNEL:*:*)
echo nse-tandem-nsk${UNAME_RELEASE}
exit ;;

View file

@ -206,6 +206,9 @@
/* Define to 1 if you have the <openssl/sha.h> header file. */
#undef HAVE_OPENSSL_SHA_H
/* Define to 1 if you have the `pselect' function. */
#undef HAVE_PSELECT
/* Define to 1 if you have the `putenv' function. */
#undef HAVE_PUTENV
@ -333,6 +336,9 @@
/* Define to 1 if you have the <sys/wait.h> header file. */
#undef HAVE_SYS_WAIT_H
/* Define to 1 if you have the <time.h> header file. */
#undef HAVE_TIME_H
/* Define to 1 if you have the <unistd.h> header file. */
#undef HAVE_UNISTD_H

108
config.sub vendored
View file

@ -1,10 +1,10 @@
#! /bin/sh
# Configuration validation subroutine script.
# Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999,
# 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010
# Free Software Foundation, Inc.
# 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010,
# 2011 Free Software Foundation, Inc.
timestamp='2010-01-22'
timestamp='2011-03-23'
# This file is (in principle) common to ALL GNU software.
# The presence of a machine in this file suggests that SOME GNU software
@ -76,7 +76,7 @@ version="\
GNU config.sub ($timestamp)
Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000,
2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010 Free
2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Free
Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
@ -124,8 +124,9 @@ esac
# Here we must recognize all the valid KERNEL-OS combinations.
maybe_os=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\2/'`
case $maybe_os in
nto-qnx* | linux-gnu* | linux-dietlibc | linux-newlib* | linux-uclibc* | \
uclinux-uclibc* | uclinux-gnu* | kfreebsd*-gnu* | knetbsd*-gnu* | netbsd*-gnu* | \
nto-qnx* | linux-gnu* | linux-android* | linux-dietlibc | linux-newlib* | \
linux-uclibc* | uclinux-uclibc* | uclinux-gnu* | kfreebsd*-gnu* | \
knetbsd*-gnu* | netbsd*-gnu* | \
kopensolaris*-gnu* | \
storm-chaos* | os2-emx* | rtmk-nova*)
os=-$maybe_os
@ -282,11 +283,13 @@ case $basic_machine in
| moxie \
| mt \
| msp430 \
| nds32 | nds32le | nds32be \
| nios | nios2 \
| ns16k | ns32k \
| open8 \
| or32 \
| pdp10 | pdp11 | pj | pjl \
| powerpc | powerpc64 | powerpc64le | powerpcle | ppcbe \
| powerpc | powerpc64 | powerpc64le | powerpcle \
| pyramid \
| rx \
| score \
@ -294,15 +297,24 @@ case $basic_machine in
| sh64 | sh64le \
| sparc | sparc64 | sparc64b | sparc64v | sparc86x | sparclet | sparclite \
| sparcv8 | sparcv9 | sparcv9b | sparcv9v \
| spu | strongarm \
| tahoe | thumb | tic4x | tic80 | tron \
| spu \
| tahoe | tic4x | tic54x | tic55x | tic6x | tic80 | tron \
| ubicom32 \
| v850 | v850e \
| we32k \
| x86 | xc16x | xscale | xscalee[bl] | xstormy16 | xtensa \
| x86 | xc16x | xstormy16 | xtensa \
| z8k | z80)
basic_machine=$basic_machine-unknown
;;
c54x)
basic_machine=tic54x-unknown
;;
c55x)
basic_machine=tic55x-unknown
;;
c6x)
basic_machine=tic6x-unknown
;;
m6811 | m68hc11 | m6812 | m68hc12 | picochip)
# Motorola 68HC11/12.
basic_machine=$basic_machine-unknown
@ -314,6 +326,18 @@ case $basic_machine in
basic_machine=mt-unknown
;;
strongarm | thumb | xscale)
basic_machine=arm-unknown
;;
xscaleeb)
basic_machine=armeb-unknown
;;
xscaleel)
basic_machine=armel-unknown
;;
# We use `pc' rather than `unknown'
# because (1) that's what they normally are, and
# (2) the word "unknown" tends to confuse beginning users.
@ -334,7 +358,7 @@ case $basic_machine in
| arm-* | armbe-* | armle-* | armeb-* | armv*-* \
| avr-* | avr32-* \
| bfin-* | bs2000-* \
| c[123]* | c30-* | [cjt]90-* | c4x-* | c54x-* | c55x-* | c6x-* \
| c[123]* | c30-* | [cjt]90-* | c4x-* \
| clipper-* | craynv-* | cydra-* \
| d10v-* | d30v-* | dlx-* \
| elxsi-* \
@ -368,26 +392,28 @@ case $basic_machine in
| mmix-* \
| mt-* \
| msp430-* \
| nds32-* | nds32le-* | nds32be-* \
| nios-* | nios2-* \
| none-* | np1-* | ns16k-* | ns32k-* \
| open8-* \
| orion-* \
| pdp10-* | pdp11-* | pj-* | pjl-* | pn-* | power-* \
| powerpc-* | powerpc64-* | powerpc64le-* | powerpcle-* | ppcbe-* \
| powerpc-* | powerpc64-* | powerpc64le-* | powerpcle-* \
| pyramid-* \
| romp-* | rs6000-* | rx-* \
| sh-* | sh[1234]-* | sh[24]a-* | sh[24]aeb-* | sh[23]e-* | sh[34]eb-* | sheb-* | shbe-* \
| shle-* | sh[1234]le-* | sh3ele-* | sh64-* | sh64le-* \
| sparc-* | sparc64-* | sparc64b-* | sparc64v-* | sparc86x-* | sparclet-* \
| sparclite-* \
| sparcv8-* | sparcv9-* | sparcv9b-* | sparcv9v-* | strongarm-* | sv1-* | sx?-* \
| tahoe-* | thumb-* \
| sparcv8-* | sparcv9-* | sparcv9b-* | sparcv9v-* | sv1-* | sx?-* \
| tahoe-* \
| tic30-* | tic4x-* | tic54x-* | tic55x-* | tic6x-* | tic80-* \
| tile-* | tilegx-* \
| tron-* \
| ubicom32-* \
| v850-* | v850e-* | vax-* \
| we32k-* \
| x86-* | x86_64-* | xc16x-* | xps100-* | xscale-* | xscalee[bl]-* \
| x86-* | x86_64-* | xc16x-* | xps100-* \
| xstormy16-* | xtensa*-* \
| ymp-* \
| z8k-* | z80-*)
@ -482,6 +508,15 @@ case $basic_machine in
basic_machine=powerpc-ibm
os=-cnk
;;
c54x-*)
basic_machine=tic54x-`echo $basic_machine | sed 's/^[^-]*-//'`
;;
c55x-*)
basic_machine=tic55x-`echo $basic_machine | sed 's/^[^-]*-//'`
;;
c6x-*)
basic_machine=tic6x-`echo $basic_machine | sed 's/^[^-]*-//'`
;;
c90)
basic_machine=c90-cray
os=-unicos
@ -518,7 +553,7 @@ case $basic_machine in
basic_machine=craynv-cray
os=-unicosmp
;;
cr16)
cr16 | cr16-*)
basic_machine=cr16-unknown
os=-elf
;;
@ -841,6 +876,12 @@ case $basic_machine in
np1)
basic_machine=np1-gould
;;
neo-tandem)
basic_machine=neo-tandem
;;
nse-tandem)
basic_machine=nse-tandem
;;
nsr-tandem)
basic_machine=nsr-tandem
;;
@ -923,9 +964,10 @@ case $basic_machine in
;;
power) basic_machine=power-ibm
;;
ppc) basic_machine=powerpc-unknown
ppc | ppcbe) basic_machine=powerpc-unknown
;;
ppc-*) basic_machine=powerpc-`echo $basic_machine | sed 's/^[^-]*-//'`
ppc-* | ppcbe-*)
basic_machine=powerpc-`echo $basic_machine | sed 's/^[^-]*-//'`
;;
ppcle | powerpclittle | ppc-le | powerpc-little)
basic_machine=powerpcle-unknown
@ -1019,6 +1061,9 @@ case $basic_machine in
basic_machine=i860-stratus
os=-sysv4
;;
strongarm-* | thumb-*)
basic_machine=arm-`echo $basic_machine | sed 's/^[^-]*-//'`
;;
sun2)
basic_machine=m68000-sun
;;
@ -1075,18 +1120,6 @@ case $basic_machine in
basic_machine=t90-cray
os=-unicos
;;
tic54x | c54x*)
basic_machine=tic54x-unknown
os=-coff
;;
tic55x | c55x*)
basic_machine=tic55x-unknown
os=-coff
;;
tic6x | c6x*)
basic_machine=tic6x-unknown
os=-coff
;;
# This must be matched before tile*.
tilegx*)
basic_machine=tilegx-unknown
@ -1163,6 +1196,9 @@ case $basic_machine in
xps | xps100)
basic_machine=xps100-honeywell
;;
xscale-* | xscalee[bl]-*)
basic_machine=`echo $basic_machine | sed 's/^xscale/arm/'`
;;
ymp)
basic_machine=ymp-cray
os=-unicos
@ -1301,7 +1337,8 @@ case $os in
| -udi* | -eabi* | -lites* | -ieee* | -go32* | -aux* \
| -chorusos* | -chorusrdb* | -cegcc* \
| -cygwin* | -pe* | -psos* | -moss* | -proelf* | -rtems* \
| -mingw32* | -linux-gnu* | -linux-newlib* | -linux-uclibc* \
| -mingw32* | -linux-gnu* | -linux-android* \
| -linux-newlib* | -linux-uclibc* \
| -uxpv* | -beos* | -mpeix* | -udk* \
| -interix* | -uwin* | -mks* | -rhapsody* | -darwin* | -opened* \
| -openstep* | -oskit* | -conix* | -pw32* | -nonstopux* \
@ -1484,6 +1521,15 @@ case $basic_machine in
c4x-* | tic4x-*)
os=-coff
;;
tic54x-*)
os=-coff
;;
tic55x-*)
os=-coff
;;
tic6x-*)
os=-coff
;;
# This must come before the *-dec entry.
pdp10-*)
os=-tops20

366
configure vendored
View file

@ -707,9 +707,6 @@ enable_maintainer_mode
enable_dependency_tracking
enable_tunemu
with_windows2000
with_openssl
with_openssl_include
with_openssl_lib
enable_zlib
with_zlib
with_zlib_include
@ -718,6 +715,9 @@ enable_lzo
with_lzo
with_lzo_include
with_lzo_lib
with_openssl
with_openssl_include
with_openssl_lib
enable_jumbograms
'
ac_precious_vars='build_alias
@ -1362,17 +1362,17 @@ Optional Packages:
--without-PACKAGE do not use PACKAGE (same as --with-PACKAGE=no)
--with-windows2000 compile with support for Windows 2000. This disables
support for tunneling over existing IPv6 networks.
--with-openssl=DIR OpenSSL base directory, or:
--with-openssl-include=DIR
OpenSSL headers directory (without trailing
/openssl)
--with-openssl-lib=DIR OpenSSL library directory
--with-zlib=DIR zlib base directory, or:
--with-zlib-include=DIR zlib headers directory
--with-zlib-lib=DIR zlib library directory
--with-lzo=DIR lzo base directory, or:
--with-lzo-include=DIR lzo headers directory
--with-lzo-lib=DIR lzo library directory
--with-openssl=DIR OpenSSL base directory, or:
--with-openssl-include=DIR
OpenSSL headers directory (without trailing
/openssl)
--with-openssl-lib=DIR OpenSSL library directory
Some influential environment variables:
CC C compiler command
@ -2731,7 +2731,7 @@ fi
# Define the identity of the package.
PACKAGE=tinc
VERSION=1.0.14
VERSION=1.0.15
cat >>confdefs.h <<_ACEOF
@ -5041,7 +5041,7 @@ $as_echo "#define STDC_HEADERS 1" >>confdefs.h
fi
for ac_header in stdbool.h syslog.h sys/file.h sys/ioctl.h sys/mman.h sys/param.h sys/resource.h sys/socket.h sys/time.h sys/uio.h sys/wait.h netdb.h arpa/inet.h dirent.h
for ac_header in stdbool.h syslog.h sys/file.h sys/ioctl.h sys/mman.h sys/param.h sys/resource.h sys/socket.h sys/time.h time.h sys/uio.h sys/wait.h netdb.h arpa/inet.h dirent.h
do :
as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh`
ac_fn_c_check_header_mongrel "$LINENO" "$ac_header" "$as_ac_Header" "$ac_includes_default"
@ -5782,7 +5782,7 @@ cat >>confdefs.h <<_ACEOF
_ACEOF
for ac_func in asprintf daemon fchmod flock ftime fork get_current_dir_name gettimeofday mlockall putenv random select strdup strerror strsignal strtol system unsetenv usleep vsyslog writev
for ac_func in asprintf daemon fchmod flock ftime fork get_current_dir_name gettimeofday mlockall pselect putenv random select strdup strerror strsignal strtol system unsetenv usleep vsyslog writev
do :
as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh`
ac_fn_c_check_func "$LINENO" "$ac_func" "$as_ac_var"
@ -6175,178 +6175,6 @@ rm -f confcache
# Check whether --with-openssl was given.
if test "${with_openssl+set}" = set; then :
withval=$with_openssl; openssl="$withval"
CPPFLAGS="$CPPFLAGS -I$withval/include"
LDFLAGS="$LDFLAGS -L$withval/lib"
fi
# Check whether --with-openssl-include was given.
if test "${with_openssl_include+set}" = set; then :
withval=$with_openssl_include; openssl_include="$withval"
CPPFLAGS="$CPPFLAGS -I$withval"
fi
# Check whether --with-openssl-lib was given.
if test "${with_openssl_lib+set}" = set; then :
withval=$with_openssl_lib; openssl_lib="$withval"
LDFLAGS="$LDFLAGS -L$withval"
fi
for ac_header in openssl/evp.h openssl/rsa.h openssl/rand.h openssl/err.h openssl/sha.h openssl/pem.h openssl/engine.h
do :
as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh`
ac_fn_c_check_header_mongrel "$LINENO" "$ac_header" "$as_ac_Header" "$ac_includes_default"
if eval test \"x\$"$as_ac_Header"\" = x"yes"; then :
cat >>confdefs.h <<_ACEOF
#define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1
_ACEOF
else
as_fn_error $? "OpenSSL header files not found." "$LINENO" 5; break
fi
done
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for EVP_EncryptInit_ex in -lcrypto" >&5
$as_echo_n "checking for EVP_EncryptInit_ex in -lcrypto... " >&6; }
if ${ac_cv_lib_crypto_EVP_EncryptInit_ex+:} false; then :
$as_echo_n "(cached) " >&6
else
ac_check_lib_save_LIBS=$LIBS
LIBS="-lcrypto $LIBS"
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
/* Override any GCC internal prototype to avoid an error.
Use char because int might match the return type of a GCC
builtin and then its argument prototype would still apply. */
#ifdef __cplusplus
extern "C"
#endif
char EVP_EncryptInit_ex ();
int
main ()
{
return EVP_EncryptInit_ex ();
;
return 0;
}
_ACEOF
if ac_fn_c_try_link "$LINENO"; then :
ac_cv_lib_crypto_EVP_EncryptInit_ex=yes
else
ac_cv_lib_crypto_EVP_EncryptInit_ex=no
fi
rm -f core conftest.err conftest.$ac_objext \
conftest$ac_exeext conftest.$ac_ext
LIBS=$ac_check_lib_save_LIBS
fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_crypto_EVP_EncryptInit_ex" >&5
$as_echo "$ac_cv_lib_crypto_EVP_EncryptInit_ex" >&6; }
if test "x$ac_cv_lib_crypto_EVP_EncryptInit_ex" = xyes; then :
LIBS="-lcrypto $LIBS"
else
as_fn_error $? "OpenSSL libraries not found." "$LINENO" 5
fi
case $host_os in
*mingw*)
;;
*)
ac_fn_c_check_func "$LINENO" "dlopen" "ac_cv_func_dlopen"
if test "x$ac_cv_func_dlopen" = xyes; then :
else
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for dlopen in -ldl" >&5
$as_echo_n "checking for dlopen in -ldl... " >&6; }
if ${ac_cv_lib_dl_dlopen+:} false; then :
$as_echo_n "(cached) " >&6
else
ac_check_lib_save_LIBS=$LIBS
LIBS="-ldl $LIBS"
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
/* Override any GCC internal prototype to avoid an error.
Use char because int might match the return type of a GCC
builtin and then its argument prototype would still apply. */
#ifdef __cplusplus
extern "C"
#endif
char dlopen ();
int
main ()
{
return dlopen ();
;
return 0;
}
_ACEOF
if ac_fn_c_try_link "$LINENO"; then :
ac_cv_lib_dl_dlopen=yes
else
ac_cv_lib_dl_dlopen=no
fi
rm -f core conftest.err conftest.$ac_objext \
conftest$ac_exeext conftest.$ac_ext
LIBS=$ac_check_lib_save_LIBS
fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_dl_dlopen" >&5
$as_echo "$ac_cv_lib_dl_dlopen" >&6; }
if test "x$ac_cv_lib_dl_dlopen" = xyes; then :
LIBS="$LIBS -ldl"
else
as_fn_error $? "OpenSSL depends on libdl." "$LINENO" 5; break
fi
fi
;;
esac
for ac_func in RAND_pseudo_bytes EVP_EncryptInit_ex
do :
as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh`
ac_fn_c_check_func "$LINENO" "$ac_func" "$as_ac_var"
if eval test \"x\$"$as_ac_var"\" = x"yes"; then :
cat >>confdefs.h <<_ACEOF
#define `$as_echo "HAVE_$ac_func" | $as_tr_cpp` 1
_ACEOF
else
as_fn_error $? "Missing OpenSSL functionality, make sure you have installed the latest version." "$LINENO" 5; break
fi
done
ac_fn_c_check_decl "$LINENO" "OpenSSL_add_all_algorithms" "ac_cv_have_decl_OpenSSL_add_all_algorithms" "#include <openssl/evp.h>
"
if test "x$ac_cv_have_decl_OpenSSL_add_all_algorithms" = xyes; then :
else
as_fn_error $? "Missing OpenSSL functionality, make sure you have installed the latest version." "$LINENO" 5; break
fi
# Check whether --enable-zlib was given.
if test "${enable_zlib+set}" = set; then :
enableval=$enable_zlib;
@ -6625,6 +6453,178 @@ done
fi
case $host_os in
*mingw*)
;;
*)
ac_fn_c_check_func "$LINENO" "dlopen" "ac_cv_func_dlopen"
if test "x$ac_cv_func_dlopen" = xyes; then :
else
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for dlopen in -ldl" >&5
$as_echo_n "checking for dlopen in -ldl... " >&6; }
if ${ac_cv_lib_dl_dlopen+:} false; then :
$as_echo_n "(cached) " >&6
else
ac_check_lib_save_LIBS=$LIBS
LIBS="-ldl $LIBS"
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
/* Override any GCC internal prototype to avoid an error.
Use char because int might match the return type of a GCC
builtin and then its argument prototype would still apply. */
#ifdef __cplusplus
extern "C"
#endif
char dlopen ();
int
main ()
{
return dlopen ();
;
return 0;
}
_ACEOF
if ac_fn_c_try_link "$LINENO"; then :
ac_cv_lib_dl_dlopen=yes
else
ac_cv_lib_dl_dlopen=no
fi
rm -f core conftest.err conftest.$ac_objext \
conftest$ac_exeext conftest.$ac_ext
LIBS=$ac_check_lib_save_LIBS
fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_dl_dlopen" >&5
$as_echo "$ac_cv_lib_dl_dlopen" >&6; }
if test "x$ac_cv_lib_dl_dlopen" = xyes; then :
LIBS="$LIBS -ldl"
else
as_fn_error $? "OpenSSL depends on libdl." "$LINENO" 5; break
fi
fi
;;
esac
# Check whether --with-openssl was given.
if test "${with_openssl+set}" = set; then :
withval=$with_openssl; openssl="$withval"
CPPFLAGS="$CPPFLAGS -I$withval/include"
LDFLAGS="$LDFLAGS -L$withval/lib"
fi
# Check whether --with-openssl-include was given.
if test "${with_openssl_include+set}" = set; then :
withval=$with_openssl_include; openssl_include="$withval"
CPPFLAGS="$CPPFLAGS -I$withval"
fi
# Check whether --with-openssl-lib was given.
if test "${with_openssl_lib+set}" = set; then :
withval=$with_openssl_lib; openssl_lib="$withval"
LDFLAGS="$LDFLAGS -L$withval"
fi
for ac_header in openssl/evp.h openssl/rsa.h openssl/rand.h openssl/err.h openssl/sha.h openssl/pem.h openssl/engine.h
do :
as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh`
ac_fn_c_check_header_mongrel "$LINENO" "$ac_header" "$as_ac_Header" "$ac_includes_default"
if eval test \"x\$"$as_ac_Header"\" = x"yes"; then :
cat >>confdefs.h <<_ACEOF
#define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1
_ACEOF
else
as_fn_error $? "OpenSSL header files not found." "$LINENO" 5; break
fi
done
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for EVP_EncryptInit_ex in -lcrypto" >&5
$as_echo_n "checking for EVP_EncryptInit_ex in -lcrypto... " >&6; }
if ${ac_cv_lib_crypto_EVP_EncryptInit_ex+:} false; then :
$as_echo_n "(cached) " >&6
else
ac_check_lib_save_LIBS=$LIBS
LIBS="-lcrypto $LIBS"
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
/* Override any GCC internal prototype to avoid an error.
Use char because int might match the return type of a GCC
builtin and then its argument prototype would still apply. */
#ifdef __cplusplus
extern "C"
#endif
char EVP_EncryptInit_ex ();
int
main ()
{
return EVP_EncryptInit_ex ();
;
return 0;
}
_ACEOF
if ac_fn_c_try_link "$LINENO"; then :
ac_cv_lib_crypto_EVP_EncryptInit_ex=yes
else
ac_cv_lib_crypto_EVP_EncryptInit_ex=no
fi
rm -f core conftest.err conftest.$ac_objext \
conftest$ac_exeext conftest.$ac_ext
LIBS=$ac_check_lib_save_LIBS
fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_crypto_EVP_EncryptInit_ex" >&5
$as_echo "$ac_cv_lib_crypto_EVP_EncryptInit_ex" >&6; }
if test "x$ac_cv_lib_crypto_EVP_EncryptInit_ex" = xyes; then :
LIBS="-lcrypto $LIBS"
else
as_fn_error $? "OpenSSL libraries not found." "$LINENO" 5
fi
for ac_func in RAND_pseudo_bytes EVP_EncryptInit_ex
do :
as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh`
ac_fn_c_check_func "$LINENO" "$ac_func" "$as_ac_var"
if eval test \"x\$"$as_ac_var"\" = x"yes"; then :
cat >>confdefs.h <<_ACEOF
#define `$as_echo "HAVE_$ac_func" | $as_tr_cpp` 1
_ACEOF
else
as_fn_error $? "Missing OpenSSL functionality, make sure you have installed the latest version." "$LINENO" 5; break
fi
done
ac_fn_c_check_decl "$LINENO" "OpenSSL_add_all_algorithms" "ac_cv_have_decl_OpenSSL_add_all_algorithms" "#include <openssl/evp.h>
"
if test "x$ac_cv_have_decl_OpenSSL_add_all_algorithms" = xyes; then :
else
as_fn_error $? "Missing OpenSSL functionality, make sure you have installed the latest version." "$LINENO" 5; break
fi
# Check whether --enable-jumbograms was given.
if test "${enable_jumbograms+set}" = set; then :
enableval=$enable_jumbograms;

View file

@ -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.14)
AM_INIT_AUTOMAKE(tinc, 1.0.15)
AC_CONFIG_HEADERS([config.h])
AM_MAINTAINER_MODE
@ -101,7 +101,7 @@ dnl Checks for header files.
dnl We do this in multiple stages, because unlike Linux all the other operating systems really suck and don't include their own dependencies.
AC_HEADER_STDC
AC_CHECK_HEADERS([stdbool.h syslog.h sys/file.h sys/ioctl.h sys/mman.h sys/param.h sys/resource.h sys/socket.h sys/time.h sys/uio.h sys/wait.h netdb.h arpa/inet.h dirent.h])
AC_CHECK_HEADERS([stdbool.h syslog.h sys/file.h sys/ioctl.h sys/mman.h sys/param.h sys/resource.h sys/socket.h sys/time.h time.h sys/uio.h sys/wait.h netdb.h arpa/inet.h dirent.h])
AC_CHECK_HEADERS([net/if.h net/if_types.h linux/if_tun.h net/if_tun.h net/tun/if_tun.h net/if_tap.h net/tap/if_tap.h net/ethernet.h net/if_arp.h netinet/in_systm.h netinet/in.h netinet/in6.h],
[], [], [#include "have.h"]
)
@ -130,7 +130,7 @@ dnl Checks for library functions.
AC_FUNC_MEMCMP
AC_FUNC_ALLOCA
AC_TYPE_SIGNAL
AC_CHECK_FUNCS([asprintf daemon fchmod flock ftime fork get_current_dir_name gettimeofday mlockall putenv random select strdup strerror strsignal strtol system unsetenv usleep vsyslog writev],
AC_CHECK_FUNCS([asprintf daemon fchmod flock ftime fork get_current_dir_name gettimeofday mlockall pselect putenv random select strdup strerror strsignal strtol system unsetenv usleep vsyslog writev],
[], [], [#include "have.h"]
)
AC_FUNC_MALLOC
@ -153,9 +153,9 @@ AC_CACHE_SAVE
dnl These are defined in files in m4/
tinc_OPENSSL
tinc_ZLIB
tinc_LZO
tinc_OPENSSL
dnl Check if support for jumbograms is requested
AC_ARG_ENABLE(jumbograms,

Binary file not shown.

View file

@ -5,7 +5,7 @@ START-INFO-DIR-ENTRY
* tinc: (tinc). The tinc Manual.
END-INFO-DIR-ENTRY
This is the info manual for tinc version 1.0.14, a Virtual Private
This is the info manual for tinc version 1.0.15, a Virtual Private
Network daemon.
Copyright (C) 1998-2011 Ivo Timmermans, Guus Sliepen
@ -1503,7 +1503,9 @@ You can also send the following signals to a running tincd process:
`HUP'
Partially rereads configuration files. Connections to hosts whose
host config file are removed are closed. New outgoing connections
specified in `tinc.conf' will be made.
specified in `tinc.conf' will be made. If the -logfile option is
used, this will also close and reopen the log file, useful when
log rotation is used.
`INT'
Temporarily increases debug level to 5. Send this signal again to
@ -2509,25 +2511,25 @@ Node: Example configuration47500
Node: Running tinc52823
Node: Runtime options53413
Node: Signals56369
Node: Debug levels57438
Node: Solving problems58374
Node: Error messages59926
Node: Sending bug reports63939
Node: Technical information64891
Node: The connection65122
Node: The UDP tunnel65434
Node: The meta-connection68495
Node: The meta-protocol69964
Node: Security74973
Node: Authentication protocol76103
Node: Encryption of network packets81107
Node: Security issues82480
Node: Platform specific information84097
Node: Interface configuration84325
Node: Routes86224
Node: About us88140
Node: Contact information88315
Node: Authors88719
Node: Concept Index89124
Node: Debug levels57561
Node: Solving problems58497
Node: Error messages60049
Node: Sending bug reports64062
Node: Technical information65014
Node: The connection65245
Node: The UDP tunnel65557
Node: The meta-connection68618
Node: The meta-protocol70087
Node: Security75096
Node: Authentication protocol76226
Node: Encryption of network packets81230
Node: Security issues82603
Node: Platform specific information84220
Node: Interface configuration84448
Node: Routes86347
Node: About us88263
Node: Contact information88438
Node: Authors88842
Node: Concept Index89247

End Tag Table

View file

@ -1638,6 +1638,8 @@ it defaults to the maximum time of 15 minutes.
Partially rereads configuration files.
Connections to hosts whose host config file are removed are closed.
New outgoing connections specified in @file{tinc.conf} will be made.
If the --logfile option is used, this will also close and reopen the log file,
useful when log rotation is used.
@item INT
Temporarily increases debug level to 5.

View file

@ -130,6 +130,10 @@ Connections to hosts whose host config file are removed are closed.
New outgoing connections specified in
.Pa tinc.conf
will be made.
If the
.Fl -logfile
option is used, this will also close and reopen the log file,
useful when log rotation is used.
.It INT
Temporarily increases debug level to 5.
Send this signal again to revert to the original level.

4
have.h
View file

@ -71,6 +71,10 @@
#include <sys/time.h>
#endif
#ifdef HAVE_TIME_H
#include <time.h>
#endif
#ifdef HAVE_SYS_TYPES_H
#include <sys/types.h>
#endif

View file

@ -27,6 +27,8 @@
#include "system.h"
#include "pidfile.h"
#ifndef HAVE_MINGW
/* read_pid
*
@ -34,7 +36,7 @@
* 0 is returned if either there's no pidfile, it's empty
* or no pid can be read.
*/
pid_t read_pid (char *pidfile)
pid_t read_pid (const char *pidfile)
{
FILE *f;
long pid;
@ -53,7 +55,7 @@ pid_t read_pid (char *pidfile)
* table (using /proc) to determine if the process already exists. If
* so the pid is returned, otherwise 0.
*/
pid_t check_pid (char *pidfile)
pid_t check_pid (const char *pidfile)
{
pid_t pid = read_pid(pidfile);
@ -79,7 +81,7 @@ pid_t check_pid (char *pidfile)
* Writes the pid to the specified file. If that fails 0 is
* returned, otherwise the pid.
*/
pid_t write_pid (char *pidfile)
pid_t write_pid (const char *pidfile)
{
FILE *f;
int fd;
@ -124,7 +126,7 @@ pid_t write_pid (char *pidfile)
* Remove the the specified file. The result from unlink(2)
* is returned
*/
int remove_pid (char *pidfile)
int remove_pid (const char *pidfile)
{
return unlink (pidfile);
}

View file

@ -26,7 +26,7 @@
* 0 is returned if either there's no pidfile, it's empty
* or no pid can be read.
*/
pid_t read_pid (char *pidfile);
extern pid_t read_pid (const char *pidfile);
/* check_pid
*
@ -34,19 +34,19 @@ pid_t read_pid (char *pidfile);
* table (using /proc) to determine if the process already exists. If
* so 1 is returned, otherwise 0.
*/
pid_t check_pid (char *pidfile);
extern pid_t check_pid (const char *pidfile);
/* write_pid
*
* Writes the pid to the specified file. If that fails 0 is
* returned, otherwise the pid.
*/
pid_t write_pid (char *pidfile);
extern pid_t write_pid (const char *pidfile);
/* remove_pid
*
* Remove the the specified file. The result from unlink(2)
* is returned
*/
int remove_pid (char *pidfile);
extern int remove_pid (const char *pidfile);
#endif

View file

@ -23,9 +23,9 @@
#include "../src/logger.h"
#include "utils.h"
const char hexadecimals[] = "0123456789ABCDEF";
static const char hexadecimals[] = "0123456789ABCDEF";
int charhex2bin(char c) {
static int charhex2bin(char c) {
if(isdigit(c))
return c - '0';
else
@ -67,7 +67,7 @@ const char *winerror(int err) {
}
#endif
unsigned int bitfield_to_int(void *bitfield, size_t size) {
unsigned int bitfield_to_int(const void *bitfield, size_t size) {
unsigned int value = 0;
if(size > sizeof value)
size = sizeof value;

View file

@ -40,6 +40,6 @@ extern const char *winerror(int);
#define sockinprogress(x) ((x) == EINPROGRESS)
#endif
extern unsigned int bitfield_to_int(void *bitfield, size_t size);
extern unsigned int bitfield_to_int(const void *bitfield, size_t size);
#endif /* __TINC_UTILS_H__ */

View file

@ -16,7 +16,7 @@ extern int xalloc_exit_failure;
extern char *const xalloc_msg_memory_exhausted;
/* FIXME: describe */
extern void (*xalloc_fail_func) ();
extern void (*xalloc_fail_func) (int);
void *xmalloc PARAMS ((size_t n)) __attribute__ ((__malloc__));
void *xmalloc_and_zero PARAMS ((size_t n)) __attribute__ ((__malloc__));

View file

@ -56,7 +56,7 @@ int xalloc_exit_failure = EXIT_FAILURE;
char *const xalloc_msg_memory_exhausted = "Memory exhausted";
/* FIXME: describe */
void (*xalloc_fail_func) (int) = 0;
void (*xalloc_fail_func) (int) = NULL;
static void
xalloc_fail (int size)
@ -70,13 +70,12 @@ xalloc_fail (int size)
/* Allocate N bytes of memory dynamically, with error checking. */
void *
xmalloc (n)
size_t n;
xmalloc (size_t n)
{
void *p;
p = malloc (n);
if (p == 0)
if (p == NULL)
xalloc_fail ((int)n);
return p;
}
@ -84,13 +83,12 @@ xmalloc (n)
/* Allocate N bytes of memory dynamically, and set it all to zero. */
void *
xmalloc_and_zero (n)
size_t n;
xmalloc_and_zero (size_t n)
{
void *p;
p = malloc (n);
if (p == 0)
if (p == NULL)
xalloc_fail ((int)n);
memset (p, '\0', n);
return p;
@ -101,12 +99,10 @@ xmalloc_and_zero (n)
If P is NULL, run xmalloc. */
void *
xrealloc (p, n)
void *p;
size_t n;
xrealloc (void *p, size_t n)
{
p = realloc (p, n);
if (p == 0)
if (p == NULL)
xalloc_fail (n);
return p;
}
@ -134,7 +130,7 @@ xcalloc (n, s)
void *p;
p = calloc (n, s);
if (p == 0)
if (p == NULL)
xalloc_fail ();
return p;
}

33
m4/ev.m4 Normal file
View file

@ -0,0 +1,33 @@
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

@ -2,6 +2,20 @@ dnl Check to find the OpenSSL headers/libraries
AC_DEFUN([tinc_OPENSSL],
[
case $host_os in
*mingw*)
;;
*)
AC_CHECK_FUNC(dlopen,
[],
[AC_CHECK_LIB(dl, dlopen,
[LIBS="$LIBS -ldl"],
[AC_MSG_ERROR([OpenSSL depends on libdl.]); break]
)]
)
;;
esac
AC_ARG_WITH(openssl,
AS_HELP_STRING([--with-openssl=DIR], [OpenSSL base directory, or:]),
[openssl="$withval"
@ -31,20 +45,6 @@ AC_DEFUN([tinc_OPENSSL],
[AC_MSG_ERROR([OpenSSL libraries not found.])]
)
case $host_os in
*mingw*)
;;
*)
AC_CHECK_FUNC(dlopen,
[],
[AC_CHECK_LIB(dl, dlopen,
[LIBS="$LIBS -ldl"],
[AC_MSG_ERROR([OpenSSL depends on libdl.]); break]
)]
)
;;
esac
AC_CHECK_FUNCS([RAND_pseudo_bytes EVP_EncryptInit_ex], ,
[AC_MSG_ERROR([Missing OpenSSL functionality, make sure you have installed the latest version.]); break],
)

View file

@ -30,7 +30,7 @@ endif
tincd_LDADD = \
$(top_builddir)/lib/libvpn.a
AM_CFLAGS = @CFLAGS@ -DCONFDIR=\"$(sysconfdir)\" -DLOCALSTATEDIR=\"$(localstatedir)\"
AM_CFLAGS = -DCONFDIR=\"$(sysconfdir)\" -DLOCALSTATEDIR=\"$(localstatedir)\"
dist-hook:
rm -f `find . -type l`

View file

@ -197,7 +197,7 @@ noinst_HEADERS = conf.h connection.h device.h edge.h event.h graph.h logger.h me
tincd_LDADD = \
$(top_builddir)/lib/libvpn.a
AM_CFLAGS = @CFLAGS@ -DCONFDIR=\"$(sysconfdir)\" -DLOCALSTATEDIR=\"$(localstatedir)\"
AM_CFLAGS = -DCONFDIR=\"$(sysconfdir)\" -DLOCALSTATEDIR=\"$(localstatedir)\"
all: all-am
.SUFFIXES:

View file

@ -22,6 +22,7 @@
#include "system.h"
#include "conf.h"
#include "device.h"
#include "logger.h"
#include "net.h"
#include "route.h"

View file

@ -26,6 +26,7 @@
#include "avl_tree.h"
#include "connection.h"
#include "conf.h"
#include "list.h"
#include "logger.h"
#include "netutl.h" /* for str2address */
#include "protocol.h"
@ -92,7 +93,7 @@ void config_add(avl_tree_t *config_tree, config_t *cfg) {
avl_insert(config_tree, cfg);
}
config_t *lookup_config(avl_tree_t *config_tree, char *variable) {
config_t *lookup_config(const avl_tree_t *config_tree, char *variable) {
config_t cfg, *found;
cfg.variable = variable;
@ -110,7 +111,7 @@ config_t *lookup_config(avl_tree_t *config_tree, char *variable) {
return found;
}
config_t *lookup_config_next(avl_tree_t *config_tree, const config_t *cfg) {
config_t *lookup_config_next(const avl_tree_t *config_tree, const config_t *cfg) {
avl_node_t *node;
config_t *found;
@ -188,7 +189,7 @@ bool get_config_address(const config_t *cfg, struct addrinfo **result) {
}
bool get_config_subnet(const config_t *cfg, subnet_t ** result) {
subnet_t subnet = {0};
subnet_t subnet = {NULL};
if(!cfg)
return false;
@ -368,7 +369,7 @@ void read_config_options(avl_tree_t *config_tree, const char *prefix) {
}
}
bool read_server_config() {
bool read_server_config(void) {
char *fname;
bool x;

View file

@ -48,8 +48,8 @@ extern void exit_configuration(avl_tree_t **);
extern config_t *new_config(void) __attribute__ ((__malloc__));
extern void free_config(config_t *);
extern void config_add(avl_tree_t *, config_t *);
extern config_t *lookup_config(avl_tree_t *, char *);
extern config_t *lookup_config_next(avl_tree_t *, const config_t *);
extern config_t *lookup_config(const avl_tree_t *, char *);
extern config_t *lookup_config_next(const avl_tree_t *, const config_t *);
extern bool get_config_bool(const config_t *, bool *);
extern bool get_config_int(const config_t *, int *);
extern bool get_config_string(const config_t *, char **);

View file

@ -23,10 +23,7 @@
#include "avl_tree.h"
#include "conf.h"
#include "list.h"
#include "logger.h"
#include "net.h" /* Don't ask. */
#include "netutl.h"
#include "subnet.h"
#include "utils.h"
#include "xalloc.h"

View file

@ -32,20 +32,19 @@
#define OPTION_CLAMP_MSS 0x0008
typedef struct connection_status_t {
int pinged:1; /* sent ping */
int active:1; /* 1 if active.. */
int connecting:1; /* 1 if we are waiting for a non-blocking connect() to finish */
int termreq:1; /* the termination of this connection was requested */
int remove:1; /* Set to 1 if you want this connection removed */
int timeout:1; /* 1 if gotten timeout */
int encryptout:1; /* 1 if we can encrypt outgoing traffic */
int decryptin:1; /* 1 if we have to decrypt incoming traffic */
int mst:1; /* 1 if this connection is part of a minimum spanning tree */
int unused:23;
unsigned int pinged:1; /* sent ping */
unsigned int active:1; /* 1 if active.. */
unsigned int connecting:1; /* 1 if we are waiting for a non-blocking connect() to finish */
unsigned int termreq:1; /* the termination of this connection was requested */
unsigned int remove:1; /* Set to 1 if you want this connection removed */
unsigned int timeout:1; /* 1 if gotten timeout */
unsigned int encryptout:1; /* 1 if we can encrypt outgoing traffic */
unsigned int decryptin:1; /* 1 if we have to decrypt incoming traffic */
unsigned int mst:1; /* 1 if this connection is part of a minimum spanning tree */
unsigned int unused:23;
} connection_status_t;
#include "edge.h"
#include "list.h"
#include "net.h"
#include "node.h"

View file

@ -24,6 +24,7 @@
#include <w32api/winioctl.h>
#include "conf.h"
#include "device.h"
#include "logger.h"
#include "net.h"
#include "route.h"

View file

@ -28,7 +28,7 @@
avl_tree_t *event_tree;
extern time_t now;
int id;
static int id;
static int event_compare(const event_t *a, const event_t *b) {
if(a->time > b->time)
@ -62,10 +62,10 @@ void expire_events(void) {
return;
event = event_tree->tail->data;
if(event->time < now)
if(event->time <= now)
return;
diff = 1 + event->time - now;
diff = event->time - now;
for(node = event_tree->head; node; node = node->next) {
event = node->data;
@ -96,7 +96,7 @@ event_t *get_expired_event(void) {
if(event_tree->head) {
event = event_tree->head->data;
if(event->time < now) {
if(event->time <= now) {
avl_node_t *node = event_tree->head;
avl_unlink_node(event_tree, node);
free(node);
@ -106,3 +106,9 @@ event_t *get_expired_event(void) {
return NULL;
}
event_t *peek_next_event(void) {
if (event_tree->head)
return event_tree->head->data;
return NULL;
}

View file

@ -42,5 +42,6 @@ extern void free_event(event_t *);
extern void event_add(event_t *);
extern void event_del(event_t *);
extern event_t *get_expired_event(void);
extern event_t *peek_next_event(void);
#endif /* __TINC_EVENT_H__ */

View file

@ -49,6 +49,7 @@
#include "connection.h"
#include "device.h"
#include "edge.h"
#include "graph.h"
#include "logger.h"
#include "netutl.h"
#include "node.h"
@ -65,7 +66,7 @@ static bool graph_changed = true;
Please note that sorting on weight is already done by add_edge().
*/
void mst_kruskal(void) {
static void mst_kruskal(void) {
avl_node_t *node, *next;
edge_t *e;
node_t *n;
@ -146,7 +147,7 @@ void mst_kruskal(void) {
Running time: O(E)
*/
void sssp_bfs(void) {
static void sssp_bfs(void) {
avl_node_t *node, *next, *to;
edge_t *e;
node_t *n;

View file

@ -22,8 +22,6 @@
#define __TINC_GRAPH_H__
extern void graph(void);
extern void mst_kruskal(void);
extern void sssp_bfs(void);
extern void dump_graph(void);
#endif /* __TINC_GRAPH_H__ */

View file

@ -28,6 +28,7 @@
#endif
#include "conf.h"
#include "device.h"
#include "logger.h"
#include "net.h"
#include "route.h"

View file

@ -44,14 +44,18 @@ void openlogger(const char *ident, logmode_t mode) {
case LOGMODE_FILE:
logpid = getpid();
logfile = fopen(logfilename, "a");
if(!logfile)
if(!logfile) {
fprintf(stderr, "Could not open log file %s: %s\n", logfilename, strerror(errno));
logmode = LOGMODE_NULL;
}
break;
case LOGMODE_SYSLOG:
#ifdef HAVE_MINGW
loghandle = RegisterEventSource(NULL, logident);
if(!loghandle)
if(!loghandle) {
fprintf(stderr, "Could not open log handle!");
logmode = LOGMODE_NULL;
}
break;
#else
#ifdef HAVE_SYSLOG_H
@ -64,8 +68,24 @@ void openlogger(const char *ident, logmode_t mode) {
}
}
void reopenlogger() {
if(logmode != LOGMODE_FILE)
return;
fflush(logfile);
FILE *newfile = fopen(logfilename, "a");
if(!newfile) {
logger(LOG_ERR, "Unable to reopen log file %s: %s\n", logfilename, strerror(errno));
return;
}
fclose(logfile);
logfile = newfile;
}
void logger(int priority, const char *format, ...) {
va_list ap;
char timestr[32] = "";
time_t now;
va_start(ap, format);
@ -76,7 +96,9 @@ void logger(int priority, const char *format, ...) {
fflush(stderr);
break;
case LOGMODE_FILE:
fprintf(logfile, "%ld %s[%ld]: ", time(NULL), logident, (long)logpid);
now = time(NULL);
strftime(timestr, sizeof timestr, "%Y-%m-%d %H:%M:%S", localtime(&now));
fprintf(logfile, "%s %s[%ld]: ", timestr, logident, (long)logpid);
vfprintf(logfile, format, ap);
fprintf(logfile, "\n");
fflush(logfile);

View file

@ -47,6 +47,7 @@ enum {
extern debug_t debug_level;
extern void openlogger(const char *, logmode_t);
extern void reopenlogger(void);
extern void logger(int, const char *, ...) __attribute__ ((__format__(printf, 2, 3)));
extern void closelogger(void);

View file

@ -24,6 +24,7 @@
#include <winioctl.h>
#include "conf.h"
#include "device.h"
#include "logger.h"
#include "net.h"
#include "route.h"

View file

@ -3,6 +3,7 @@
Copyright (C) 1998-2005 Ivo Timmermans,
2000-2011 Guus Sliepen <guus@tinc-vpn.org>
2006 Scott Lamb <slamb@slamb.org>
2011 Loïc Grenié <loic.grenie@gmail.com>
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@ -42,6 +43,9 @@
bool do_purge = false;
volatile bool running = false;
#ifdef HAVE_PSELECT
bool graph_dump = false;
#endif
time_t now = 0;
int contradicting_add_edge = 0;
@ -229,14 +233,14 @@ static void check_dead_connections(void) {
next = node->next;
c = node->data;
if(c->last_ping_time + pingtimeout < now) {
if(c->last_ping_time + pingtimeout <= now) {
if(c->status.active) {
if(c->status.pinged) {
ifdebug(CONNECTIONS) logger(LOG_INFO, "%s (%s) didn't respond to PING in %ld seconds",
c->name, c->hostname, now - c->last_ping_time);
c->status.timeout = true;
terminate_connection(c, true);
} else if(c->last_ping_time + pinginterval < now) {
} else if(c->last_ping_time + pinginterval <= now) {
send_ping(c);
}
} else {
@ -258,7 +262,7 @@ static void check_dead_connections(void) {
}
}
if(c->outbuflen > 0 && c->last_flushed_time + pingtimeout < now) {
if(c->outbuflen > 0 && c->last_flushed_time + pingtimeout <= now) {
if(c->status.active) {
ifdebug(CONNECTIONS) logger(LOG_INFO,
"%s (%s) could not flush for %ld seconds (%d bytes remaining)",
@ -350,7 +354,13 @@ static void check_network_activity(fd_set * readset, fd_set * writeset) {
*/
int main_loop(void) {
fd_set readset, writeset;
#ifdef HAVE_PSELECT
struct timespec tv;
sigset_t omask, block_mask;
time_t next_event;
#else
struct timeval tv;
#endif
int r, maxfd;
time_t last_ping_check, last_config_check, last_graph_dump;
event_t *event;
@ -361,21 +371,48 @@ int main_loop(void) {
srand(now);
#ifdef HAVE_PSELECT
if(lookup_config(config_tree, "GraphDumpFile"))
graph_dump = true;
/* Block SIGHUP & SIGALRM */
sigemptyset(&block_mask);
sigaddset(&block_mask, SIGHUP);
sigaddset(&block_mask, SIGALRM);
sigprocmask(SIG_BLOCK, &block_mask, &omask);
#endif
running = true;
while(running) {
now = time(NULL);
#ifdef HAVE_PSELECT
next_event = last_ping_check + pingtimeout;
if(graph_dump && next_event > last_graph_dump + 60)
next_event = last_graph_dump + 60;
// tv.tv_sec = 1 + (rand() & 7); /* Approx. 5 seconds, randomized to prevent global synchronisation effects */
if((event = peek_next_event()) && next_event > event->time)
next_event = event->time;
if(next_event <= now)
tv.tv_sec = 0;
else
tv.tv_sec = next_event - now;
tv.tv_nsec = 0;
#else
tv.tv_sec = 1;
tv.tv_usec = 0;
#endif
maxfd = build_fdset(&readset, &writeset);
#ifdef HAVE_MINGW
LeaveCriticalSection(&mutex);
#endif
#ifdef HAVE_PSELECT
r = pselect(maxfd + 1, &readset, &writeset, NULL, &tv, &omask);
#else
r = select(maxfd + 1, &readset, &writeset, NULL, &tv);
#endif
now = time(NULL);
#ifdef HAVE_MINGW
EnterCriticalSection(&mutex);
#endif
@ -398,7 +435,7 @@ int main_loop(void) {
/* Let's check if everybody is still alive */
if(last_ping_check + pingtimeout < now) {
if(last_ping_check + pingtimeout <= now) {
check_dead_connections();
last_ping_check = now;
@ -409,7 +446,7 @@ int main_loop(void) {
/* Should we regenerate our key? */
if(keyexpires < now) {
if(keyexpires <= now) {
avl_node_t *node;
node_t *n;
@ -423,7 +460,7 @@ int main_loop(void) {
}
}
send_key_changed(broadcast, myself);
send_key_changed();
keyexpires = now + keylifetime;
}
@ -465,6 +502,8 @@ int main_loop(void) {
sighup = false;
reopenlogger();
/* Reread our own configuration file */
exit_configuration(&config_tree);
@ -550,11 +589,16 @@ int main_loop(void) {
/* Dump graph if wanted every 60 seconds*/
if(last_graph_dump + 60 < now) {
if(last_graph_dump + 60 <= now) {
dump_graph();
last_graph_dump = now;
}
}
#ifdef HAVE_PSELECT
/* Restore SIGHUP & SIGALARM mask */
sigprocmask(SIG_SETMASK, &omask, NULL);
#endif
return 0;
}

View file

@ -121,6 +121,8 @@ extern time_t now;
extern int contradicting_add_edge;
extern int contradicting_del_edge;
extern volatile bool running;
/* Yes, very strange placement indeed, but otherwise the typedefs get all tangled up */
#include "connection.h"
#include "node.h"
@ -133,7 +135,7 @@ extern bool handle_new_meta_connection(int);
extern int setup_listen_socket(const sockaddr_t *);
extern int setup_vpn_in_socket(const sockaddr_t *);
extern void send_packet(const struct node_t *, vpn_packet_t *);
extern void receive_tcppacket(struct connection_t *, char *, int);
extern void receive_tcppacket(struct connection_t *, const char *, int);
extern void broadcast_packet(const struct node_t *, vpn_packet_t *);
extern bool setup_network(void);
extern void setup_outgoing_connection(struct outgoing_t *);
@ -144,7 +146,7 @@ extern void terminate_connection(struct connection_t *, bool);
extern void flush_queue(struct node_t *);
extern bool read_rsa_public_key(struct connection_t *);
extern void send_mtu_probe(struct node_t *);
extern void load_all_subnets();
extern void load_all_subnets(void);
#ifndef HAVE_MINGW
#define closesocket(s) close(s)

View file

@ -43,7 +43,6 @@
#include "ethernet.h"
#include "event.h"
#include "graph.h"
#include "list.h"
#include "logger.h"
#include "net.h"
#include "netutl.h"
@ -365,7 +364,7 @@ static void receive_udppacket(node_t *n, vpn_packet_t *inpkt) {
receive_packet(n, inpkt);
}
void receive_tcppacket(connection_t *c, char *buffer, int len) {
void receive_tcppacket(connection_t *c, const char *buffer, int len) {
vpn_packet_t outpkt;
outpkt.len = len;
@ -404,7 +403,7 @@ static void send_udppacket(node_t *n, vpn_packet_t *origpkt) {
"No valid key known yet for %s (%s), forwarding via TCP",
n->name, n->hostname);
if(n->last_req_key + 10 < now) {
if(n->last_req_key + 10 <= now) {
send_req_key(n);
n->last_req_key = now;
}

View file

@ -144,7 +144,7 @@ bool read_rsa_public_key(connection_t *c) {
return false;
}
bool read_rsa_private_key(void) {
static bool read_rsa_private_key(void) {
FILE *fp;
char *fname, *key, *pubkey;
struct stat s;
@ -267,7 +267,7 @@ void load_all_subnets(void) {
/*
Configure node_t myself and set up the local sockets (listen only)
*/
bool setup_myself(void) {
static bool setup_myself(void) {
config_t *cfg;
subnet_t *subnet;
char *name, *hostname, *mode, *afname, *cipher, *digest;

View file

@ -535,7 +535,7 @@ bool handle_new_meta_connection(int sock) {
return true;
}
void free_outgoing(outgoing_t *outgoing) {
static void free_outgoing(outgoing_t *outgoing) {
if(outgoing->ai)
freeaddrinfo(outgoing->ai);

View file

@ -124,7 +124,7 @@ void node_del(node_t *n) {
}
node_t *lookup_node(char *name) {
node_t n = {0};
node_t n = {NULL};
n.name = name;
@ -132,7 +132,7 @@ node_t *lookup_node(char *name) {
}
node_t *lookup_node_udp(const sockaddr_t *sa) {
node_t n = {0};
node_t n = {NULL};
n.address = *sa;
n.name = NULL;
@ -142,7 +142,7 @@ node_t *lookup_node_udp(const sockaddr_t *sa) {
void update_node_udp(node_t *n, const sockaddr_t *sa) {
if(n == myself) {
logger(LOG_WARNING, "Trying to update UDP address of myself!\n");
logger(LOG_WARNING, "Trying to update UDP address of myself!");
return;
}
@ -158,7 +158,7 @@ void update_node_udp(node_t *n, const sockaddr_t *sa) {
ifdebug(PROTOCOL) logger(LOG_DEBUG, "UDP address of %s set to %s", n->name, n->hostname);
} else {
memset(&n->address, 0, sizeof n->address);
n->hostname = 0;
n->hostname = NULL;
ifdebug(PROTOCOL) logger(LOG_DEBUG, "UDP address of %s cleared", n->name);
}
}

View file

@ -24,17 +24,16 @@
#include "avl_tree.h"
#include "connection.h"
#include "event.h"
#include "list.h"
#include "subnet.h"
typedef struct node_status_t {
int unused_active:1; /* 1 if active (not used for nodes) */
int validkey:1; /* 1 if we currently have a valid key for him */
int unused_waitingforkey:1; /* 1 if we already sent out a request */
int visited:1; /* 1 if this node has been visited by one of the graph algorithms */
int reachable:1; /* 1 if this node is reachable in the graph */
int indirect:1; /* 1 if this node is not directly reachable by us */
int unused:26;
unsigned int unused_active:1; /* 1 if active (not used for nodes) */
unsigned int validkey:1; /* 1 if we currently have a valid key for him */
unsigned int unused_waitingforkey:1; /* 1 if we already sent out a request */
unsigned int visited:1; /* 1 if this node has been visited by one of the graph algorithms */
unsigned int reachable:1; /* 1 if this node is reachable in the graph */
unsigned int indirect:1; /* 1 if this node is not directly reachable by us */
unsigned int unused:26;
} node_status_t;
typedef struct node_t {

View file

@ -25,6 +25,7 @@
#include "device.h"
#include "edge.h"
#include "logger.h"
#include "net.h"
#include "node.h"
#include "pidfile.h"
#include "process.h"
@ -41,10 +42,9 @@ extern char *identname;
extern char *pidfilename;
extern char **g_argv;
extern bool use_logfile;
extern volatile bool running;
#ifndef HAVE_MINGW
sigset_t emptysigset;
static sigset_t emptysigset;
#endif
static int saved_debug_level = -1;

View file

@ -189,7 +189,7 @@ void exit_requests(void) {
}
bool seen_request(char *request) {
past_request_t *new, p = {0};
past_request_t *new, p = {NULL};
p.request = request;
@ -214,7 +214,7 @@ void age_past_requests(void) {
next = node->next;
p = node->data;
if(p->firstseen + pinginterval < now)
if(p->firstseen + pinginterval <= now)
avl_delete_node(past_request_tree, node), deleted++;
else
left++;

View file

@ -96,10 +96,10 @@ extern bool send_add_subnet(struct connection_t *, const struct subnet_t *);
extern bool send_del_subnet(struct connection_t *, const struct subnet_t *);
extern bool send_add_edge(struct connection_t *, const struct edge_t *);
extern bool send_del_edge(struct connection_t *, const struct edge_t *);
extern void send_key_changed();
extern void send_key_changed(void);
extern bool send_req_key(struct node_t *);
extern bool send_ans_key(struct node_t *);
extern bool send_tcppacket(struct connection_t *, struct vpn_packet_t *);
extern bool send_tcppacket(struct connection_t *, const struct vpn_packet_t *);
/* Request handlers */

View file

@ -34,9 +34,9 @@
#include "utils.h"
#include "xalloc.h"
bool mykeyused = false;
static bool mykeyused = false;
void send_key_changed() {
void send_key_changed(void) {
avl_node_t *node;
connection_t *c;

View file

@ -119,7 +119,7 @@ bool pong_h(connection_t *c) {
/* Sending and receiving packets via TCP */
bool send_tcppacket(connection_t *c, vpn_packet_t *packet) {
bool send_tcppacket(connection_t *c, const vpn_packet_t *packet) {
/* If there already is a lot of data in the outbuf buffer, discard this packet.
We use a very simple Random Early Drop algorithm. */

View file

@ -45,7 +45,7 @@ bool add_subnet_h(connection_t *c) {
char subnetstr[MAX_STRING_SIZE];
char name[MAX_STRING_SIZE];
node_t *owner;
subnet_t s = {0}, *new, *old;
subnet_t s = {NULL}, *new, *old;
if(sscanf(c->buffer, "%*d %*x " MAX_STRING " " MAX_STRING, name, subnetstr) != 2) {
logger(LOG_ERR, "Got bad %s from %s (%s)", "ADD_SUBNET", c->name,
@ -154,7 +154,7 @@ bool del_subnet_h(connection_t *c) {
char subnetstr[MAX_STRING_SIZE];
char name[MAX_STRING_SIZE];
node_t *owner;
subnet_t s = {0}, *find;
subnet_t s = {NULL}, *find;
if(sscanf(c->buffer, "%*d %*x " MAX_STRING " " MAX_STRING, name, subnetstr) != 2) {
logger(LOG_ERR, "Got bad %s from %s (%s)", "DEL_SUBNET", c->name,

View file

@ -23,6 +23,7 @@
#include <netpacket/packet.h>
#include "conf.h"
#include "device.h"
#include "net.h"
#include "logger.h"
#include "utils.h"

View file

@ -220,7 +220,7 @@ void age_subnets(void) {
for(node = myself->subnet_tree->head; node; node = next) {
next = node->next;
s = node->data;
if(s->expires && s->expires < now) {
if(s->expires && s->expires <= now) {
ifdebug(TRAFFIC) {
char netstr[MAXNETSTR];
if(net2str(netstr, sizeof netstr, s))

View file

@ -26,6 +26,7 @@
#include <net/if_tun.h>
#include "conf.h"
#include "device.h"
#include "logger.h"
#include "net.h"
#include "utils.h"

View file

@ -52,7 +52,7 @@ static subnet_t *cache_mac_subnet[2];
static bool cache_mac_valid[2];
static int cache_mac_slot;
void subnet_cache_flush() {
void subnet_cache_flush(void) {
cache_ipv4_valid[0] = cache_ipv4_valid[1] = false;
cache_ipv6_valid[0] = cache_ipv6_valid[1] = false;
cache_mac_valid[0] = cache_mac_valid[1] = false;
@ -273,7 +273,7 @@ bool str2net(subnet_t *subnet, const char *subnetstr) {
bool net2str(char *netstr, int len, const subnet_t *subnet) {
if(!netstr || !subnet) {
logger(LOG_ERR, "net2str() was called with netstr=%p, subnet=%p!\n", netstr, subnet);
logger(LOG_ERR, "net2str() was called with netstr=%p, subnet=%p!", netstr, subnet);
return false;
}
@ -451,7 +451,7 @@ subnet_t *lookup_subnet_ipv6(const ipv6_t *address) {
void subnet_update(node_t *owner, subnet_t *subnet, bool up) {
avl_node_t *node;
int i;
char *envp[9] = {0};
char *envp[9] = {NULL};
char netstr[MAXNETSTR];
char *name, *address, *port;
char empty[] = "";

View file

@ -504,7 +504,7 @@ static bool drop_privs() {
}
#ifdef HAVE_MINGW
# define setpriority(level) SetPriorityClass(GetCurrentProcess(), (level))
# define setpriority(level) !SetPriorityClass(GetCurrentProcess(), (level))
#else
# define NORMAL_PRIORITY_CLASS 0
# define BELOW_NORMAL_PRIORITY_CLASS 10

View file

@ -23,6 +23,7 @@
#include <sys/un.h>
#include "conf.h"
#include "device.h"
#include "net.h"
#include "logger.h"
#include "utils.h"