Guus Sliepen [Fri, 1 Mar 2013 16:15:26 +0000 (17:15 +0100)]
Flush output buffers in the tap reader thread on Windows.
This is basically a port of commit
50fcfea1 to 1.1.
Guus Sliepen [Fri, 22 Feb 2013 14:37:48 +0000 (15:37 +0100)]
Use UDP when using sptps_test in datagram mode.
Guus Sliepen [Wed, 20 Feb 2013 14:35:19 +0000 (15:35 +0100)]
Releasing 1.1pre6.
Guus Sliepen [Wed, 20 Feb 2013 14:35:08 +0000 (15:35 +0100)]
Fix compiler warnings on some BSD variants.
Guus Sliepen [Wed, 20 Feb 2013 13:39:24 +0000 (14:39 +0100)]
Fix compiler warnings on Windows.
Guus Sliepen [Wed, 20 Feb 2013 12:59:50 +0000 (13:59 +0100)]
Fix a tiny memory leak.
Found by cppcheck.
Guus Sliepen [Fri, 8 Feb 2013 15:44:50 +0000 (16:44 +0100)]
Don't expect a response from tincd after sending REQ_STOP.
Guus Sliepen [Thu, 7 Feb 2013 14:27:16 +0000 (15:27 +0100)]
Let the GUI use UNIX sockets if available.
Guus Sliepen [Thu, 7 Feb 2013 14:26:56 +0000 (15:26 +0100)]
Derive UNIX socket filename from PID filename.
Guus Sliepen [Thu, 7 Feb 2013 13:22:28 +0000 (14:22 +0100)]
Don't send proxy requests for incoming connections.
Guus Sliepen [Wed, 6 Feb 2013 14:24:02 +0000 (15:24 +0100)]
Fix segmentation fault when trying to connect via a SOCKS5 proxy.
Guus Sliepen [Wed, 6 Feb 2013 14:12:53 +0000 (15:12 +0100)]
Check for writability when waiting for a socket to finish connecting.
We were checking only for readability, which is not a problem for normal
connections, since the server side of a connection will always send an ID
request. But when using a proxy, the proxy server doesn't send anything before
the client, so tinc would not see that its connection to the proxy had already
been established.
Guus Sliepen [Wed, 6 Feb 2013 10:30:35 +0000 (11:30 +0100)]
Fix tincd terminating immediately on Windows.
Guus Sliepen [Thu, 31 Jan 2013 15:12:56 +0000 (16:12 +0100)]
Remove direct inclusion of OpenSSL headers in net_packet.c and tincd.c.
Guus Sliepen [Thu, 31 Jan 2013 14:58:33 +0000 (15:58 +0100)]
Detect increases in PMTU.
Tinc never restarts PMTU discovery unless a node becomes unreachable. However,
it can be that the PMTU was very low during the initial discovery, but has
increased later. To detect this, tinc now tries to send an extra packet every
PingInterval, with a size slightly higher than the currently known PMTU. If
this packet is succesfully received back, we partially restart PMTU discovery
to find out the new maximum.
Conflicts:
src/net_packet.c
Guus Sliepen [Mon, 21 Jan 2013 15:12:18 +0000 (16:12 +0100)]
Get microsecond time resolution on Windows.
Guus Sliepen [Mon, 21 Jan 2013 12:59:52 +0000 (13:59 +0100)]
Fix a typo.
Guus Sliepen [Mon, 21 Jan 2013 12:47:46 +0000 (13:47 +0100)]
Fix datagram SPTPS.
Commit
dd07c9fc1f37bed8d1f67ffe7b203f61e7914edf broke the reception of datagram
SPTPS packets, by undoing the conversion of the sequence number to host byte
order before comparison. This caused error messages like "Packet is
16777215
seqs in the future, dropped (1)".
Guus Sliepen [Sun, 20 Jan 2013 20:03:22 +0000 (21:03 +0100)]
Releasing 1.1pre5.
Guus Sliepen [Sun, 20 Jan 2013 20:02:58 +0000 (21:02 +0100)]
Fix tincctl init when /etc/tinc does not yet exist.
Guus Sliepen [Sun, 20 Jan 2013 19:19:08 +0000 (20:19 +0100)]
Remove possible definition of timersub(), which is also in dropin.h.
Guus Sliepen [Sun, 20 Jan 2013 14:16:13 +0000 (15:16 +0100)]
Make sure PriorityInheritance also works in switch mode.
Conflicts:
src/route.c
Guus Sliepen [Thu, 17 Jan 2013 17:12:55 +0000 (18:12 +0100)]
Allow connections via UNIX sockets.
This is mainly useful for control connections. The client must still present
the control cookie from the PID file.
Guus Sliepen [Thu, 17 Jan 2013 15:39:41 +0000 (16:39 +0100)]
Fix compilation of UML and VDE device support.
Guus Sliepen [Thu, 17 Jan 2013 15:39:02 +0000 (16:39 +0100)]
Move make_names() and related variables to its own source file.
Guus Sliepen [Thu, 17 Jan 2013 13:14:17 +0000 (14:14 +0100)]
Handle SIGINT gracefully.
Guus Sliepen [Thu, 17 Jan 2013 10:21:18 +0000 (11:21 +0100)]
Fix the minimum spanning tree algorithm.
Tinc uses Kruskal's algorithm to calculate a MST. However, this was broken in
commit
6e80da3370249caa1082c23c3ef55f338d1e9e74. Revert back to the working
algorithm from tinc 1.0.
Thanks to Cheng LI for spotting the problem.
Guus Sliepen [Wed, 16 Jan 2013 15:31:56 +0000 (16:31 +0100)]
Estimate RTT, bandwidth and packet loss between nodes.
Without adding any extra traffic, we can measure round trip times, estimate the
bandwidth and packet loss between nodes. The RTT and bandwidth can be measured
by timing the MTU probe packets. The RTT is the difference between the time a
burst of MTU probes was sent and when the first reply is received. The
bandwidth can be estimated by multiplying the size of the probe packets by the
time between succesive received probe replies of the same burst. The packet
loss can be estimated for incoming traffic by comparing how many packets have
actually been received to the increase in the sequence numbers.
The estimates are not perfect. Especially bandwidth is difficult to measure,
the only accurate way is to continuously send as much data as possible, but
that is obviously not desirable. The packet loss rate is also almost always
a few percent when sending a lot of data over the VPN via TCP, since TCP
*needs* packet loss to work properly.
Guus Sliepen [Tue, 15 Jan 2013 12:33:16 +0000 (13:33 +0100)]
Count the number of correctly received UDP packets.
Keep track of the number of correct, non-replayed UDP packets that have been
received, regardless of their content. This can be compared to the sequence
number to determine the real packet loss.
Guus Sliepen [Tue, 15 Jan 2013 12:31:51 +0000 (13:31 +0100)]
Add the tincctl exchange and exchange-all commands.
These are identical to an export/export-all followed by an import, and make
it simpler to exchange host config files with other nodes.
Guus Sliepen [Mon, 14 Jan 2013 12:08:35 +0000 (13:08 +0100)]
Check HMAC before sequence number.
Guus Sliepen [Mon, 14 Jan 2013 12:02:39 +0000 (13:02 +0100)]
Always complain if too many arguments are given for tincctl commands.
Guus Sliepen [Mon, 14 Jan 2013 12:01:47 +0000 (13:01 +0100)]
Better error messages when using -L, -R or -U on platforms that do not support it.
Guus Sliepen [Mon, 14 Jan 2013 11:59:17 +0000 (12:59 +0100)]
Don't complain about garbage if we skipped importing a host file.
Guus Sliepen [Mon, 14 Jan 2013 11:58:24 +0000 (12:58 +0100)]
Mention that the -L, -R and -U options are not supported on all platforms.
Guus Sliepen [Mon, 14 Jan 2013 11:57:33 +0000 (12:57 +0100)]
Note that tincctl import is only meant to work with data from tincctl export.
Guus Sliepen [Mon, 14 Jan 2013 11:56:54 +0000 (12:56 +0100)]
Note that node Names are case sensitive.
Guus Sliepen [Mon, 14 Jan 2013 11:56:14 +0000 (12:56 +0100)]
Fix a typo.
Guus Sliepen [Sun, 16 Dec 2012 14:36:06 +0000 (15:36 +0100)]
Fix support for tunemu on iOS devices.
The actual code was fine but the #ifdefs tested for the wrong preprocessor
variable.
Conflicts:
src/bsd/device.c
src/process.c
Guus Sliepen [Fri, 7 Dec 2012 14:49:21 +0000 (15:49 +0100)]
Fix infinite loop in timeout handling on Windows.
Guus Sliepen [Thu, 6 Dec 2012 15:57:57 +0000 (16:57 +0100)]
Fix display of cumulative packet counters.
Guus Sliepen [Thu, 6 Dec 2012 15:55:28 +0000 (16:55 +0100)]
Clarify the description of IndirectData and Mode = router.
Guus Sliepen [Wed, 5 Dec 2012 21:32:10 +0000 (22:32 +0100)]
Releasing 1.1pre4.
Guus Sliepen [Wed, 5 Dec 2012 20:42:43 +0000 (21:42 +0100)]
Fix whitespace.
Guus Sliepen [Wed, 5 Dec 2012 20:40:49 +0000 (21:40 +0100)]
Scale packet counters similar to byte counters.
Guus Sliepen [Wed, 5 Dec 2012 20:33:01 +0000 (21:33 +0100)]
Don't use nested functions.
This allows tinc to be compiled with Clang.
Guus Sliepen [Wed, 5 Dec 2012 13:42:21 +0000 (14:42 +0100)]
Fix compiler warnings on OpenBSD.
Guus Sliepen [Mon, 3 Dec 2012 12:09:40 +0000 (13:09 +0100)]
Remove GraphDumpFile from the manual and manpages.
This option is not supported in tinc 1.1, "tincctl dump graph" can be used
instead.
Guus Sliepen [Mon, 3 Dec 2012 12:08:03 +0000 (13:08 +0100)]
Add option to dump only a list of reachable nodes.
Guus Sliepen [Mon, 3 Dec 2012 09:41:28 +0000 (10:41 +0100)]
More fixes for Windows.
In particular, Windows does support many of the timer* macros, except timeradd
and timersub.
Guus Sliepen [Mon, 3 Dec 2012 08:08:21 +0000 (09:08 +0100)]
Fix compiler error on Windows.
Guus Sliepen [Mon, 3 Dec 2012 08:07:23 +0000 (09:07 +0100)]
Fix crash in timeout handling.
Guus Sliepen [Mon, 3 Dec 2012 08:02:08 +0000 (09:02 +0100)]
Set a node's pointers to zero before trying to insert it into a tree.
Guus Sliepen [Thu, 29 Nov 2012 13:35:08 +0000 (14:35 +0100)]
Fix use of unitialised values in hash tables.
Not only was Valgrind unhappy about it, it could also result in cache misses.
Guus Sliepen [Thu, 29 Nov 2012 13:32:12 +0000 (14:32 +0100)]
Fix check for expired events.
This would trigger a infinite loop if a timeout expired and the next timeout
was not expired yet, but less than 1 second from being expired.
Guus Sliepen [Thu, 29 Nov 2012 11:37:04 +0000 (12:37 +0100)]
Allow multiple timeouts to expire at the exact same time.
Guus Sliepen [Thu, 29 Nov 2012 11:28:23 +0000 (12:28 +0100)]
Drop libevent and use our own event handling again.
There are several reasons for this:
- MacOS/X doesn't support polling the tap device using kqueue, requiring a
workaround to fall back to select().
- On Windows only sockets are properly handled, therefore tinc uses a second
thread that does a blocking ReadFile() on the TAP-Win32/64 device. However,
this does not mix well with libevent.
- Libevent, event just the core, is quite large, and although it is easy to get
and install on many platforms, it can be a burden.
- Libev is more lightweight and seems technically superior, but it doesn't
abstract away all the platform differences (for example, async events are not
supported on Windows).
Guus Sliepen [Mon, 19 Nov 2012 13:20:50 +0000 (14:20 +0100)]
Ensure MTU probe replies are sent back the same way they came in.
Also sprinkle some comments over mtu_probe_h().
Guus Sliepen [Mon, 19 Nov 2012 12:50:17 +0000 (13:50 +0100)]
Improve UDP address selection.
We don't need to search the whole edge tree, we can use the node's own edge
tree since each edge has a pointer to its reverse. Also, we do need to make
sure we try the reflexive address often.
Guus Sliepen [Sat, 17 Nov 2012 21:48:06 +0000 (22:48 +0100)]
Try all known addresses of node during PMTU discovery, now also for SPTPS.
Guus Sliepen [Sat, 17 Nov 2012 21:14:52 +0000 (22:14 +0100)]
Choose a suitable socket when updating a node's UDP address.
Guus Sliepen [Thu, 15 Nov 2012 10:24:18 +0000 (11:24 +0100)]
Also don't use poll() on MacOS/X.
Guus Sliepen [Thu, 15 Nov 2012 10:13:40 +0000 (11:13 +0100)]
Disable support for kqueue on MacOS/X.
Apparently MacOS/X doesn't support kqueue events on character devices.
Guus Sliepen [Wed, 14 Nov 2012 09:44:35 +0000 (10:44 +0100)]
Remove text saying you must have one of PrivateKey or PrivateKeyFile in tinc.conf.
Guus Sliepen [Tue, 13 Nov 2012 14:05:41 +0000 (15:05 +0100)]
Send broadcast packets using a random socket, and properly support IPv6.
Before it would always use the first socket, and always send an IPv4 broadcast packet. That
works fine in a lot of situations, but it is better to try all sockets, and to send IPv6 packets
on IPv6 sockets. This is especially important for users that are on IPv6-only networks or that
have multiple physical network interfaces, although in the latter case it probably requires
them to use the ListenAddress variable to create a separate socket for each interface.
Guus Sliepen [Tue, 13 Nov 2012 14:01:43 +0000 (15:01 +0100)]
Don't take the address of a variable whose scope is about to disappear.
Guus Sliepen [Sun, 11 Nov 2012 18:01:28 +0000 (19:01 +0100)]
Fix configure script help text for --enable options.
Guus Sliepen [Sun, 11 Nov 2012 18:01:02 +0000 (19:01 +0100)]
Fix index entry for section about readline library.
Guus Sliepen [Sun, 11 Nov 2012 17:53:23 +0000 (18:53 +0100)]
Mention in the manual that support for LZO and zlib can be disabled.
Guus Sliepen [Sun, 11 Nov 2012 17:45:40 +0000 (18:45 +0100)]
Mention libcurses and libreadline in the manual.
Guus Sliepen [Sat, 10 Nov 2012 22:45:22 +0000 (23:45 +0100)]
Make sure PMTU discovery works in switch mode with VLAN tags.
Before, when tinc saw a packet larger than the PMTU with a VLAN tag, it would
not know what to do with it, and would just forward it via TCP. Now, tinc
handles 802.1q packets correctly, as long as there is only one tag.
Guus Sliepen [Sat, 10 Nov 2012 22:13:05 +0000 (23:13 +0100)]
Using alloca() for a constant sized buffer is very silly.
Cppcheck said using alloca() in the 21st century is silly anyway.
Guus Sliepen [Sat, 10 Nov 2012 22:09:31 +0000 (23:09 +0100)]
Fix potential buffer overflow reading the PID file.
Found by cppcheck.
Guus Sliepen [Sun, 21 Oct 2012 15:45:16 +0000 (17:45 +0200)]
Slightly randomize all timeouts.
Guus Sliepen [Sun, 21 Oct 2012 15:35:13 +0000 (17:35 +0200)]
Add the AutoConnect option.
When set to a non-zero value, tinc will try to maintain exactly that number of
meta connections to other nodes. If there are not enough connections, it will
periodically try to set up an outgoing connection to a random node. If there
are too many connections, it will periodically try to remove an outgoing
connection.
Guus Sliepen [Sun, 21 Oct 2012 15:34:53 +0000 (17:34 +0200)]
Keep track of the number of nodes in a tree.
Guus Sliepen [Wed, 17 Oct 2012 11:51:02 +0000 (13:51 +0200)]
Fix warnings from groff.
Guus Sliepen [Sun, 14 Oct 2012 17:22:30 +0000 (19:22 +0200)]
Releasing 1.1pre3.
Guus Sliepen [Sun, 14 Oct 2012 17:21:13 +0000 (19:21 +0200)]
Fix a few compiler errors/warnings.
Guus Sliepen [Sun, 14 Oct 2012 15:42:49 +0000 (17:42 +0200)]
Update copyright notices.
Guus Sliepen [Sun, 14 Oct 2012 14:39:16 +0000 (16:39 +0200)]
Fix compile error on Windows.
Guus Sliepen [Sun, 14 Oct 2012 14:07:35 +0000 (16:07 +0200)]
tincctl: add node colors and edge weight to graph dump.
Guus Sliepen [Sun, 14 Oct 2012 13:37:24 +0000 (15:37 +0200)]
Log more messages using logger().
Guus Sliepen [Sun, 14 Oct 2012 12:48:35 +0000 (14:48 +0200)]
Make sure the ReplayWindow option works for SPTPS as well.
Guus Sliepen [Sun, 14 Oct 2012 12:45:27 +0000 (14:45 +0200)]
Only log success of initial datagram SPTPS handshake.
Guus Sliepen [Sun, 14 Oct 2012 12:33:54 +0000 (14:33 +0200)]
Fix handling of initial datagram SPTPS packet.
Only the very first packet of an SPTPS session should be send with REQ_KEY,
this signals the peer to abort any previous session and start a new one as
well.
Sven-Haegar Koch [Fri, 12 Oct 2012 15:08:01 +0000 (17:08 +0200)]
sptps.c: Add missing newline to log message.
Guus Sliepen [Thu, 11 Oct 2012 20:47:13 +0000 (22:47 +0200)]
Strip newline from incoming SPTPS requests.
Most of the code doesn't care whether requests are terminated with a newline or
not, except that when requests are forwarded, it is assumed they do not have
one and a newline is added. When a node using SPTPS receives a request from
another SPTPS-using node, and forwards it to a non-SPTPS-using node, this will
result in two consecutive newlines, which the latter node will see as an empty,
and thus invalid, request.
Guus Sliepen [Thu, 11 Oct 2012 20:21:30 +0000 (22:21 +0200)]
Clear status and options fields of unreachable nodes.
Guus Sliepen [Wed, 10 Oct 2012 15:17:49 +0000 (17:17 +0200)]
Fix whitespace.
Guus Sliepen [Wed, 10 Oct 2012 12:46:22 +0000 (14:46 +0200)]
Try all known addresses of node during the PMTU discovery phase.
This helps in situations where some nodes have IPv6 and others have not.
Guus Sliepen [Tue, 9 Oct 2012 15:49:09 +0000 (17:49 +0200)]
Fix hash functions for keys whose size is not divisible by 4.
Guus Sliepen [Tue, 9 Oct 2012 14:27:28 +0000 (16:27 +0200)]
Fix memory leaks found by valgrind.
Guus Sliepen [Tue, 9 Oct 2012 13:52:58 +0000 (15:52 +0200)]
Clear Ethernet header when reading packets from a tun device.
This fixes a warning from valgrind about uninitialized bytes, which were being
sent to other nodes.
Guus Sliepen [Tue, 9 Oct 2012 11:28:09 +0000 (13:28 +0200)]
Remove unused variables, fix some #includes.
Guus Sliepen [Tue, 9 Oct 2012 11:23:12 +0000 (13:23 +0200)]
Fix deleting connections from the connection list.
Guus Sliepen [Sun, 7 Oct 2012 22:35:38 +0000 (00:35 +0200)]
C99 extravaganza.
Guus Sliepen [Sun, 7 Oct 2012 19:59:53 +0000 (21:59 +0200)]
Replace the connection_tree with a connection_list.
The tree functions were never used on the connection_tree, a list is more appropriate.
Also be more paranoid about connections disappearing while traversing the list.
Guus Sliepen [Sun, 7 Oct 2012 19:02:40 +0000 (21:02 +0200)]
Refactor outgoing connection handling.
Struct outgoing_ts and connection_ts were depending too much on each other,
causing lots of problems, especially the reuse of a connection_t. Now, whenever
a connection is closed it is immediately removed from the list of connections
and destroyed.
Guus Sliepen [Sun, 7 Oct 2012 15:53:23 +0000 (17:53 +0200)]
Fix warnings from cppcheck.