Guus Sliepen [Tue, 20 Mar 2012 22:49:16 +0000 (23:49 +0100)]
Always try next Address when an outgoing connection fails to authenticate.
When making outgoing connections, tinc goes through the list of Addresses and
tries all of them until one succeeds. However, before it would consider
establishing a TCP connection a success, even when the authentication failed.
This would be a problem if the first Address would point to a hostname and port
combination that belongs to the wrong tinc node, or perhaps even to a non-tinc
service, causing tinc to endlessly try this Address instead of moving to the
next one.
Problem found by Delf Eldkraft.
Guus Sliepen [Sat, 10 Mar 2012 12:31:36 +0000 (13:31 +0100)]
Releasing 1.0.17.
Guus Sliepen [Sat, 10 Mar 2012 12:23:08 +0000 (13:23 +0100)]
Update copyright notices.
Guus Sliepen [Thu, 8 Mar 2012 22:23:39 +0000 (23:23 +0100)]
Make sure disabling old RSA keys works on Windows.
Seeking in files and rewriting parts of them does not seem to work properly on
Windows. Instead, when old RSA keys are found when generating new ones, the
file containing the old keys is copied to a temporary file where the changes
are made, and that file is renamed back to the original filename. On Windows,
we cannot atomically replace files with a rename(), so we need to move the
original file out of the way first. If anything fails, the new code will warn
that the user has to solve the problem by hand.
Guus Sliepen [Thu, 8 Mar 2012 21:19:20 +0000 (22:19 +0100)]
Add missing ICMP6 message type definitions.
Guus Sliepen [Wed, 7 Mar 2012 09:40:06 +0000 (10:40 +0100)]
Accept Subnets passed with the -o option when StrictSubnets = yes.
Guus Sliepen [Fri, 2 Mar 2012 15:09:58 +0000 (16:09 +0100)]
Only log errors sending UDP packets when debug level >= 5.
Since tinc will fall back to TCP or route via another node, it is not necessary
to log such errors unconditionally.
Guus Sliepen [Sun, 26 Feb 2012 15:23:02 +0000 (16:23 +0100)]
Only use broadcast at the start of the PMTU discovery phase.
For local peer discovery, only a handful of packets are necessary for
peers to detect each other.
Guus Sliepen [Sat, 25 Feb 2012 21:11:30 +0000 (22:11 +0100)]
Stricter checks against routing loops.
If a packet that had to be sent via an intermediate hop, and that intermediate
hop was the one that sent the packet, we drop it.
Guus Sliepen [Sat, 25 Feb 2012 20:46:18 +0000 (21:46 +0100)]
Don't send ICMP Time Exceeded messages for other Time Exceeded messages.
That would be silly.
Guus Sliepen [Wed, 22 Feb 2012 22:17:43 +0000 (23:17 +0100)]
Add LocalDiscovery option which tries to detect peers on the local network.
Currently, this is implemented by sending IPv4 broadcast packets to the
LAN during path MTU discovery.
Guus Sliepen [Wed, 22 Feb 2012 13:37:56 +0000 (14:37 +0100)]
Pass index into listen_socket[] to handle_incoming_vpn_data().
Nick Hibma [Tue, 21 Feb 2012 14:26:58 +0000 (15:26 +0100)]
Add missing ICMP message type definitions.
Guus Sliepen [Tue, 21 Feb 2012 13:06:55 +0000 (14:06 +0100)]
Fix check for raw socket support.
Also, move some variables so there are no compiler warnings about unused
variables when there is no support for raw sockets.
Guus Sliepen [Tue, 21 Feb 2012 12:31:21 +0000 (13:31 +0100)]
Fix a bug that caused tinc to ignore all but the last listening socket.
Guus Sliepen [Tue, 21 Feb 2012 12:13:40 +0000 (13:13 +0100)]
Document the command line flag -o and provide --option as well.
Guus Sliepen [Tue, 21 Feb 2012 10:39:21 +0000 (11:39 +0100)]
Move initialization of char *priority up to prevent freeing an uninitialized pointer.
Guus Sliepen [Mon, 20 Feb 2012 16:19:00 +0000 (17:19 +0100)]
Allow disabling of broadcast packets.
The Broadcast option can be used to cause tinc to drop all broadcast and
multicast packets. This option might be expanded in the future to selectively
allow only some broadcast packet types.
Guus Sliepen [Mon, 20 Feb 2012 16:12:48 +0000 (17:12 +0100)]
Rename connection_t *broadcast to everyone.
Guus Sliepen [Mon, 20 Feb 2012 15:52:53 +0000 (16:52 +0100)]
Don't bind outgoing TCP sockets anymore.
The code introduced in commit
41a05f59ba2c3eb5caab555f096ed1b9fbe69ee3 is not
needed anymore, since tinc has been able to handle UDP packets from a different
source address than those of the TCP packets since 1.0.10. When using multiple
BindToAddress statements, this code does not make sense anymore, we do want the
kernel to choose the source address on its own.
Guus Sliepen [Mon, 20 Feb 2012 15:34:02 +0000 (16:34 +0100)]
Decrement TTL of incoming packets.
Tinc will now, by default, decrement the TTL field of incoming IPv4 and IPv6
packets, before forwarding them to the virtual network device or to another
node. Packets with a TTL value of zero will be dropped, and an ICMP Time
Exceeded message will be sent back.
This behaviour can be disabled using the DecrementTTL option.
Guus Sliepen [Mon, 20 Feb 2012 14:44:52 +0000 (15:44 +0100)]
Only compile raw socket code when it is supported on that platform.
Guus Sliepen [Sat, 18 Feb 2012 13:31:08 +0000 (14:31 +0100)]
Merge branch 'master' of black:tinc
Guus Sliepen [Sat, 18 Feb 2012 13:37:52 +0000 (14:37 +0100)]
Allow setting DeviceType to tun or tap on Linux.
Guus Sliepen [Sat, 18 Feb 2012 10:48:21 +0000 (11:48 +0100)]
Send packets back using the same socket as they were received on.
Guus Sliepen [Sat, 18 Feb 2012 10:43:00 +0000 (11:43 +0100)]
Merge branch 'master' of black:tinc
Guus Sliepen [Fri, 17 Feb 2012 15:25:00 +0000 (16:25 +0100)]
Allow multiple BindToAddress statements.
Guus Sliepen [Fri, 17 Feb 2012 15:13:38 +0000 (16:13 +0100)]
Set FD_CLOEXEC flag on all sockets.
Scripts called by tinc would inherit its open filedescriptors. This could
be a problem if other long-running daemons are started from those scripts,
if those daemons would not close all filedescriptors before going into the
background.
Problem found and solution suggested by Nick Hibma.
Guus Sliepen [Sun, 4 Dec 2011 00:20:59 +0000 (01:20 +0100)]
Allow linking with multiple device drivers.
Apart from the platform specific tun/tap driver, link with the dummy and
raw_socket devices, and optionally with support for UML and VDE devices.
At runtime, the DeviceType option can be used to select which driver to
use.
Guus Sliepen [Sat, 3 Dec 2011 20:59:47 +0000 (21:59 +0100)]
Fix a few small memory leaks.
Guus Sliepen [Sun, 27 Nov 2011 11:13:16 +0000 (12:13 +0100)]
Add vde/device.c to the tarball.
Guus Sliepen [Sun, 27 Nov 2011 11:12:34 +0000 (12:12 +0100)]
Fix compilation of VDE and UML interfaces.
Guus Sliepen [Tue, 30 Aug 2011 18:49:48 +0000 (20:49 +0200)]
Return false instead of void when there is an error.
Guus Sliepen [Tue, 30 Aug 2011 17:56:56 +0000 (19:56 +0200)]
Prevent read_rsa_public_key() from returning an uninitialized RSA structure.
In case the config file could not be opened a new but unitialized RSA structure
would be returned, causing a segmentation fault later on. This would only
happen in the case that the config file could be opened before, but not when
read_rsa_public_key() was called. This situation could occur when the --user
option was used, and the config files were not readable by the specified user.
Guus Sliepen [Sat, 23 Jul 2011 12:12:23 +0000 (14:12 +0200)]
Releasing 1.0.16.
Guus Sliepen [Sat, 23 Jul 2011 12:11:44 +0000 (14:11 +0200)]
Use usleep() instead of sleep(), MinGW complained.
Guus Sliepen [Sun, 17 Jul 2011 17:34:01 +0000 (19:34 +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.
Guus Sliepen [Sat, 16 Jul 2011 08:47:35 +0000 (10:47 +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.
Guus Sliepen [Fri, 24 Jun 2011 12:50:20 +0000 (14:50 +0200)]
Releasing 1.0.15.
Guus Sliepen [Fri, 24 Jun 2011 10:27:04 +0000 (12:27 +0200)]
Remove redundant @CFLAGS@ from AM_CFLAGS.
Guus Sliepen [Mon, 6 Jun 2011 14:26:11 +0000 (16:26 +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.
Guus Sliepen [Sat, 4 Jun 2011 09:27:54 +0000 (11:27 +0200)]
Attribution for Loïc Grenié.
Loïc Grenié [Sat, 4 Jun 2011 07:05:23 +0000 (09:05 +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.
Guus Sliepen [Sat, 28 May 2011 21:46:56 +0000 (23:46 +0200)]
Remove a few unnecessary #includes.
Some spotted by Michael Tokarev.
Guus Sliepen [Sat, 28 May 2011 21:42:18 +0000 (23:42 +0200)]
Remove newlines from log messages.
Guus Sliepen [Sat, 28 May 2011 21:36:52 +0000 (23:36 +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.
Guus Sliepen [Sun, 22 May 2011 13:56:04 +0000 (15:56 +0200)]
Make return value of SetPriorityClass() behave the same as setpriority().
Guus Sliepen [Fri, 13 May 2011 10:37:26 +0000 (12:37 +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.
Guus Sliepen [Sun, 8 May 2011 21:17:46 +0000 (23:17 +0200)]
Releasing 1.0.14.
Guus Sliepen [Sun, 8 May 2011 21:12:44 +0000 (23:12 +0200)]
Include <inttypes.h> when using intptr_t.
Guus Sliepen [Sun, 8 May 2011 21:12:06 +0000 (23:12 +0200)]
Ensure proper linking with OpenSSL with recent versions of MinGW.
Guus Sliepen [Sun, 8 May 2011 19:22:20 +0000 (21:22 +0200)]
Update THANKS and copyright information.
Guus Sliepen [Sun, 8 May 2011 19:06:06 +0000 (21:06 +0200)]
Check for EVP_EncryptInit_ex instead of SHA1_Version in OpenSSL.
The latter function disappeared, and wasn't actually used in tinc, so now we
check on a function that we do use.
Guus Sliepen [Sun, 8 May 2011 10:40:44 +0000 (12:40 +0200)]
Always use the default signal handler for ABRT signals.
This will allow coredumps to be generated when tinc is daemonized.
Also add the -kABRT option.
Guus Sliepen [Sun, 8 May 2011 10:16:26 +0000 (12:16 +0200)]
Increase threshold for detecting two nodes with the same Name.
In commit
4a21aabada23d1d2c8a10f54dd7248171c4ec82f, code was added to detect
contradicting ADD_EDGE and DEL_EDGE messages being sent, which is an indication
of two nodes with the same Name connected to the same VPN. However, these
contradictory messages can also happen when there is a network partitioning. In
the former case a loop happens which causes many contradictory message, while
in the latter case only a few of those messages will be sent. So, now we
increase the threshold to at least 10 of both ADD_EDGE and DEL_EDGE messages.
Julien Muchembled [Thu, 28 Apr 2011 11:21:55 +0000 (13:21 +0200)]
Fix command-line '-o' option for host configuration
This fixes a regression introduced by commit
667b1ba while refactoring option
parsing code.
Guus Sliepen [Wed, 9 Mar 2011 08:34:56 +0000 (09:34 +0100)]
Do not set indirect flag on edges from nodes with multiple addresses.
Since tinc now handles UDP packets with a different source address and port
than used for TCP connections, the heuristic to treat edges as indirect when
tinc could detect that multiple addresses were used does not make sense
anymore, and can actually reduce performance.
Guus Sliepen [Fri, 18 Feb 2011 22:11:43 +0000 (23:11 +0100)]
Prevent anything from updating our own UDP address.
Because we don't want to keep track of that, and this will cause the node
structure from being relinked into the node tree, which results in myself
pointing to an invalid address.
Guus Sliepen [Fri, 18 Feb 2011 22:02:11 +0000 (23:02 +0100)]
Fix spurious misidentification of incoming UDP packets.
When a UDP packet was received with an unknown source address/port, and if it
failed a HMAC check against known keys, it could still incorrectly assign that
UDP address to another node. This would temporarily cause outgoing UDP packets
to go to the wrong destination address, until packets from the correct address
were received again.
Rumko [Sat, 12 Feb 2011 17:22:14 +0000 (18:22 +0100)]
DragonFlyBSD support
* added DragonFly BSD support
* added a check for sys/resource.h (needed on DragonFly)
Guus Sliepen [Mon, 7 Feb 2011 17:34:55 +0000 (18:34 +0100)]
Add support for VDE through libvdeplug.
When compiled with vde/device.c, tinc will connect to a vde_switch instance
instead of using a tun/tap device.
Guus Sliepen [Sat, 29 Jan 2011 09:49:44 +0000 (10:49 +0100)]
Fix typo spotted by Andrew Scheller.
Guus Sliepen [Wed, 12 Jan 2011 19:57:14 +0000 (20:57 +0100)]
Proper check and dropin replacement for usleep().
Guus Sliepen [Sun, 2 Jan 2011 16:25:24 +0000 (17:25 +0100)]
Update the NEWS.
Guus Sliepen [Sun, 2 Jan 2011 16:25:03 +0000 (17:25 +0100)]
Update the manual.
Guus Sliepen [Sun, 2 Jan 2011 16:24:23 +0000 (17:24 +0100)]
Document the behavior of "-n."
Guus Sliepen [Sun, 2 Jan 2011 15:59:42 +0000 (16:59 +0100)]
Remove unused variables.
Guus Sliepen [Sun, 2 Jan 2011 15:55:42 +0000 (16:55 +0100)]
Replace bogus #else with #endif.
Found by cppcheck, which complained about lenin not being initialized, but the
real problem is that reading packets would fail when using code compiled with
--tunemu on a normal tun device.
Guus Sliepen [Sun, 2 Jan 2011 15:52:36 +0000 (16:52 +0100)]
Limit field width when scanning PID file.
Cppcheck warns that scanf() might otherwise crash when presented with a huge,
bogus PID file.
Guus Sliepen [Sun, 2 Jan 2011 15:50:24 +0000 (16:50 +0100)]
Close all filedescriptors in Solaris close_device().
Guus Sliepen [Sun, 2 Jan 2011 14:02:23 +0000 (15:02 +0100)]
Always send MTU probes at least once every PingInterval.
Before, if MTU probes failed, tinc would stop sending probes until the next
time keys were regenerated (by default, once every hour). Now it continues to
send them every PingInterval, so it recovers faster from temporary failures.
Guus Sliepen [Sat, 20 Nov 2010 14:31:11 +0000 (14:31 +0000)]
Use setpriority() instead of nice() on UNIX-like systems.
The return value of nice() can not reliably indicate errors. The return value
of the setpriority() call is well-defined.
Guus Sliepen [Tue, 16 Nov 2010 16:28:41 +0000 (17:28 +0100)]
Attribution for Brandon Black.
Guus Sliepen [Tue, 16 Nov 2010 15:45:36 +0000 (16:45 +0100)]
Fix variable length array declaration.
Guus Sliepen [Sat, 13 Nov 2010 20:36:51 +0000 (21:36 +0100)]
Free replay window when freeing a node_t.
Guus Sliepen [Sat, 13 Nov 2010 20:34:59 +0000 (21:34 +0100)]
Fix warning message when setting SO_RCVBUF or SO_SNDBUF fails.
Brandon L Black [Sat, 13 Nov 2010 18:05:51 +0000 (12:05 -0600)]
Improved handling of queue-jumping packets on receive
Brandon L Black [Sat, 13 Nov 2010 18:05:50 +0000 (12:05 -0600)]
Configurable ReplayWindow size, zero disables
Brandon L Black [Sat, 13 Nov 2010 18:05:49 +0000 (12:05 -0600)]
Configurable SO_RCVBUF/SO_SNDBUF for the UDP socket
Brandon L Black [Sat, 13 Nov 2010 18:05:48 +0000 (12:05 -0600)]
Experimental IFF_ONE_QUEUE support for Linux
Guus Sliepen [Sat, 13 Nov 2010 14:55:38 +0000 (15:55 +0100)]
Use variable length arrays instead of alloca().
Guus Sliepen [Sat, 13 Nov 2010 14:50:39 +0000 (15:50 +0100)]
Provide usleep() for Windows.
Guus Sliepen [Fri, 12 Nov 2010 10:38:05 +0000 (11:38 +0100)]
Don't use strlen() on a NULL pointer.
A bug introduced in commit
667b1bac77b134cf32c98d5dc25619e8c3303f52 caused tinc
to crash on startup.
Guus Sliepen [Fri, 12 Nov 2010 10:33:01 +0000 (11:33 +0100)]
Add short options -R and -U to the tincd(8) manpage.
Guus Sliepen [Tue, 2 Nov 2010 13:23:43 +0000 (14:23 +0100)]
Read error counter must be static.
Guus Sliepen [Tue, 2 Nov 2010 13:18:35 +0000 (14:18 +0100)]
Quit when there are too many consecutive errors on the tun/tap device.
Although transient errors sometimes happen on the tun/tap device (for example,
if the kernel is temporarily out of buffer space), there are situations where
the tun/tap device becomes permanently broken. Instead of endlessly spamming
the syslog, we now sleep an increasing amount of time between consecutive read
errors, and if reads still fail after 10 attempts (approximately 3 seconds),
tinc will quit.
Michael Tokarev [Sun, 24 Oct 2010 11:23:10 +0000 (15:23 +0400)]
Treat netname="." in a special way.
Treat netname "." in a special way as if there was no netname
specified. Before, f.e. tincd -n. -k didn't work as it tried
to open /var/run/tinc-.pid. Now -n. works as if there was no
-n option is specified.
Signed-Off-By: Michael Tokarev <mjt@tls.msk.ru>
Guus Sliepen [Fri, 22 Oct 2010 20:46:44 +0000 (22:46 +0200)]
Remove unused variables.
These were caused by commit
667b1bac77b134cf32c98d5dc25619e8c3303f52.
Guus Sliepen [Fri, 22 Oct 2010 20:43:50 +0000 (22:43 +0200)]
Abort disabling old PEM keys on I/O errors.
Guus Sliepen [Fri, 22 Oct 2010 20:42:21 +0000 (22:42 +0200)]
Ensure there is a newline character before a PEM key is written.
Guus Sliepen [Fri, 22 Oct 2010 11:40:04 +0000 (13:40 +0200)]
Attribution for Timothy Redaelli.
Guus Sliepen [Fri, 22 Oct 2010 11:17:42 +0000 (13:17 +0200)]
Attribution for Julien Muchembled.
Guus Sliepen [Fri, 22 Oct 2010 11:06:06 +0000 (13:06 +0200)]
Remove duplicate command-line option parsing.
Also fix parsing of command-line host configuration options for the local node.
Guus Sliepen [Fri, 22 Oct 2010 10:47:12 +0000 (12:47 +0200)]
Merge local host configuration with server configuration.
With some exceptions, tinc only accepted host configuration options for the
local node from the corresponding host configuration file. Although this is
documented, many people expect that they can also put those options in
tinc.conf. Tinc now internally merges the contents of both tinc.conf and the
local host configuration file.
Julien Muchembled [Fri, 3 Sep 2010 11:34:22 +0000 (13:34 +0200)]
New '-o' option to configure server or hosts from command line
Options given on the command line have precedence over configuration from files.
This can be useful, for example, for a roaming node, for which 'ConnectTo' and
<host>.Address depends on its location.
Guus Sliepen [Fri, 4 Jun 2010 14:03:19 +0000 (16:03 +0200)]
Do not append an address to ANS_KEY messages if we don't know any address.
This would let tinc raise an exception when an ANS_KEY request crossed a
DEL_EDGE request for the node sending the key.
Guus Sliepen [Fri, 4 Jun 2010 13:04:08 +0000 (15:04 +0200)]
Use 64 bit counters to keep track of bytes sent/received from the virtual network interface.
Guus Sliepen [Fri, 4 Jun 2010 12:53:52 +0000 (14:53 +0200)]
Detect and prevent two nodes with the same Name being on the VPN simultaneously.
In this situation, the two nodes will start fighting over the edges they announced.
When we have to contradict both ADD_EDGE and DEL_EDGE messages, we log a warning,
and with 25% chance per PingTimeout we quit.
Guus Sliepen [Fri, 7 May 2010 10:24:49 +0000 (12:24 +0200)]
Use strrchr() insteaad of rindex().
The latter function is deprecated, some build environments do not support.
Timothy Redaelli [Tue, 4 May 2010 13:43:48 +0000 (15:43 +0200)]
Fix warnings under BSD