]> git.meshlink.io Git - meshlink/log
meshlink
15 years agoHandle truncated message authentication codes with gcrypt.
Guus Sliepen [Wed, 4 Nov 2009 23:01:25 +0000 (00:01 +0100)]
Handle truncated message authentication codes with gcrypt.

Commit 4124b9682f8f890acb25d0c92f2583eef670274a did not update the gcrypt
backend.

15 years agoUse %x instead of %lx where appropriate.
Guus Sliepen [Wed, 4 Nov 2009 15:19:08 +0000 (16:19 +0100)]
Use %x instead of %lx where appropriate.

Some conversions were not properly merged from the master branch.

15 years agoDon't enable device events when there is no valid filedescriptor.
Guus Sliepen [Wed, 4 Nov 2009 15:18:08 +0000 (16:18 +0100)]
Don't enable device events when there is no valid filedescriptor.

15 years agoMerge branch 'master' into 1.1
Guus Sliepen [Mon, 2 Nov 2009 13:24:27 +0000 (14:24 +0100)]
Merge branch 'master' into 1.1

Conflicts:
NEWS
README
configure.in
doc/tinc.texi
doc/tincd.8.in
src/Makefile.am
src/connection.c
src/edge.c
src/meta.c
src/net.c
src/net.h
src/net_packet.c
src/net_setup.c
src/net_socket.c
src/node.c
src/openssl/rsagen.h
src/protocol_auth.c
src/protocol_edge.c
src/subnet.c

15 years agoReleasing 1.0.11.
Guus Sliepen [Sun, 1 Nov 2009 15:24:39 +0000 (16:24 +0100)]
Releasing 1.0.11.

15 years agoStart a tinc service if it already exists.
Guus Sliepen [Sun, 1 Nov 2009 14:57:28 +0000 (15:57 +0100)]
Start a tinc service if it already exists.

15 years agoFast handoff of roaming MAC addresses.
Guus Sliepen [Tue, 27 Oct 2009 22:53:49 +0000 (23:53 +0100)]
Fast handoff of roaming MAC addresses.

In switch mode, if a known MAC address is claimed by a second node before it
expired at the first node, it is likely that this is because a computer has
roamed from the LAN of the first node to that of the second node. To ensure
packets for that computer are routed to the second node, the first node should
delete its corresponding Subnet as soon as possible, without waiting for the
normal expiry timeout.

15 years agoMove socket error interpretation to utils.h.
Guus Sliepen [Sat, 24 Oct 2009 23:40:07 +0000 (01:40 +0200)]
Move socket error interpretation to utils.h.

15 years agoUse WSAGetLastError() to determine cause of network errors on Windows.
Guus Sliepen [Sat, 24 Oct 2009 22:50:09 +0000 (00:50 +0200)]
Use WSAGetLastError() to determine cause of network errors on Windows.

This reduces log spam and lets path MTU discovery work faster.

15 years agoRemove localedir leftovers.
Michael Tokarev [Sun, 18 Oct 2009 17:27:24 +0000 (21:27 +0400)]
Remove localedir leftovers.

15 years agoUse IP_DONTFRAGMENT instead of IP_MTU_DISCOVER on Windows.
Guus Sliepen [Sat, 24 Oct 2009 20:32:35 +0000 (22:32 +0200)]
Use IP_DONTFRAGMENT instead of IP_MTU_DISCOVER on Windows.

This ensures the DF bit on outgoing UDP packets gets set on Windows when path
MTU discovery is enabled, reducing fragmentation.

15 years agoForward packets to not directly reachable hosts via UDP if possible.
Guus Sliepen [Sat, 24 Oct 2009 19:53:01 +0000 (21:53 +0200)]
Forward packets to not directly reachable hosts via UDP if possible.

If MTU probing discovered a node was not reachable via UDP, packets for it were
forwarded to the next hop, but always via TCP, even if the next hop was
reachable via UDP. This is now fixed by retrying to send the packet using
send_packet() if the destination is not the same as the nexthop.

15 years agoMake maxmtu equal to minmtu when fixing the path MTU to a node.
Guus Sliepen [Sat, 24 Oct 2009 19:35:40 +0000 (21:35 +0200)]
Make maxmtu equal to minmtu when fixing the path MTU to a node.

This ensures MTU probes used to ping nodes are not too large, and prevents
restarting MTU probing unnecessarily.

15 years agoAlways reply to MTU probes via UDP.
Guus Sliepen [Sat, 24 Oct 2009 19:32:06 +0000 (21:32 +0200)]
Always reply to MTU probes via UDP.

It could sometime happen that a node would return MTU probes via TCP, which
does not make a lot of sense.

15 years agoAllow UDP packets with an address different from the corresponding TCP connection.
Guus Sliepen [Sat, 24 Oct 2009 18:54:44 +0000 (20:54 +0200)]
Allow UDP packets with an address different from the corresponding TCP connection.

15 years agoUse uint32_t instead of long int for connection options.
Guus Sliepen [Sat, 24 Oct 2009 14:15:24 +0000 (16:15 +0200)]
Use uint32_t instead of long int for connection options.

Options should have a fixed width anyway, but this also fixes a possible MinGW
compiler bug where %lx tries to print a 64 bit value, even though a long int is
only 32 bits.

15 years agoAdd dummy device.
Guus Sliepen [Sat, 24 Oct 2009 14:05:12 +0000 (16:05 +0200)]
Add dummy device.

15 years agoClarify and increase level of log message about MTU probes to unreachable nodes.
Guus Sliepen [Tue, 20 Oct 2009 20:39:07 +0000 (22:39 +0200)]
Clarify and increase level of log message about MTU probes to unreachable nodes.

15 years agoHandle weighted Subnets in switch and hub modes.
Guus Sliepen [Tue, 20 Oct 2009 20:33:16 +0000 (22:33 +0200)]
Handle weighted Subnets in switch and hub modes.

We now handle MAC Subnets in exactly the same way as IPv4 and IPv6 Subnets.
This also fixes a problem that causes unncessary broadcasting of unicast
packets in VPNs where some daemons run 1.0.10 and some run other versions.

15 years agoStarting to work towards 1.0.11.
Guus Sliepen [Tue, 20 Oct 2009 20:22:59 +0000 (22:22 +0200)]
Starting to work towards 1.0.11.

15 years agoFix a possible crash when sending the HUP signal.
Guus Sliepen [Tue, 20 Oct 2009 20:14:47 +0000 (22:14 +0200)]
Fix a possible crash when sending the HUP signal.

When the HUP signal is sent while some outgoing connections have not been made
yet, or are being retried, a NULL pointer could be dereferenced resulting in
tinc crashing. We fix this by more careful handling of outgoing_ts, and by
deleting all connections that have not been fully activated yet at the HUP
signal is received.

15 years agoReleasing 1.0.10.
Guus Sliepen [Sun, 18 Oct 2009 14:45:13 +0000 (16:45 +0200)]
Releasing 1.0.10.

15 years agoFix description of the WEIGHT environment variable.
Guus Sliepen [Sun, 18 Oct 2009 14:44:32 +0000 (16:44 +0200)]
Fix description of the WEIGHT environment variable.

15 years agoInclude missing header.
Guus Sliepen [Sun, 18 Oct 2009 12:22:20 +0000 (14:22 +0200)]
Include missing header.

15 years agoRemove debugging message when reading packets from a BSD device.
Guus Sliepen [Mon, 12 Oct 2009 21:51:57 +0000 (23:51 +0200)]
Remove debugging message when reading packets from a BSD device.

This was inadvertently introduced by commit
4a5d42178cc0954efba8b24058da9c70cc77c35a.

15 years agoAllow the cloning /dev/tap interface to be used on FreeBSD and NetBSD.
Guus Sliepen [Mon, 12 Oct 2009 20:14:47 +0000 (22:14 +0200)]
Allow the cloning /dev/tap interface to be used on FreeBSD and NetBSD.

This device works like /dev/tun on Linux, automatically creating a new tap
interface when a program opens it. We now pass the actual name of the newly
created interface in $INTERFACE.

15 years agoUse MTU probes to regularly ping other nodes over UDP.
Guus Sliepen [Sun, 11 Oct 2009 16:57:58 +0000 (18:57 +0200)]
Use MTU probes to regularly ping other nodes over UDP.

This keeps NAT mappings for UDP alive, and will also detect when a node is not
reachable via UDP anymore or if the path MTU is decreasing. Tinc will fall back
to TCP if the node has become unreachable.

If UDP communication is impossible, we stop sending probes, but we retry if it
changes its keys.

We also decouple the UDP and TCP ping mechanisms completely, to ensure tinc
properly detects failure of either method.

15 years agoSmall updates to the documentation.
Guus Sliepen [Sun, 11 Oct 2009 13:46:52 +0000 (15:46 +0200)]
Small updates to the documentation.

Mention that TCPOnly is not necessary anymore since tinc will autodetect
whether it can send via UDP or not. Also mention the WEIGHT environment
variable and the new default value (2048 bits) of RSA keys.

15 years agoEnsure that the texinfo manual can be converted to HTML.
Guus Sliepen [Sun, 11 Oct 2009 12:20:14 +0000 (14:20 +0200)]
Ensure that the texinfo manual can be converted to HTML.

The top node was made conditional with the @iftex command, since it should not
appear in PostScript and PDF output. However, it is still necessary for
texi2html, so we have to use @ifnottex instead.

Texi2html also complains about the use of @cindex in the copyright statement,
so we remove that.

15 years agoRevert "Raise default crypto algorithms to AES256 and SHA256."
Guus Sliepen [Sun, 11 Oct 2009 11:56:04 +0000 (13:56 +0200)]
Revert "Raise default crypto algorithms to AES256 and SHA256."

Although it would be better to have the new defaults, only the most recent
releases of most of the platforms supported by tinc come with a version of
OpenSSL that supports SHA256. To ensure people can compile tinc and that nodes
can interact with each other, we revert the default back to Blowfish and SHA1.

This reverts commit 4bb3793e38b7c7f24dd308801e7f6dbb02cf02d2.

15 years agoRemove code duplication when checking ADD_EDGE/DEL_EDGE messages.
Guus Sliepen [Sun, 11 Oct 2009 11:54:05 +0000 (13:54 +0200)]
Remove code duplication when checking ADD_EDGE/DEL_EDGE messages.

15 years agoDon't disconnect clients in TunnelServer mode who send unauthorised ADD_SUBNETs.
Guus Sliepen [Sun, 11 Oct 2009 11:51:10 +0000 (13:51 +0200)]
Don't disconnect clients in TunnelServer mode who send unauthorised ADD_SUBNETs.

So that we are liberal in what we accept.

15 years agoRemoved last gettext function.
Borg [Sat, 3 Oct 2009 11:06:00 +0000 (13:06 +0200)]
Removed last gettext function.

15 years agoRemove autogenerated files from EXTRA_DIST.
Guus Sliepen [Tue, 29 Sep 2009 14:25:20 +0000 (16:25 +0200)]
Remove autogenerated files from EXTRA_DIST.

Apparently they were once necessary, but autoconf now includes them
automatically.  Some of them are not used anymore, and this caused make dist to
fail.

15 years agoUpdate FSF address in files not covered by the merge.
Guus Sliepen [Tue, 29 Sep 2009 13:33:58 +0000 (15:33 +0200)]
Update FSF address in files not covered by the merge.

15 years agoDrop localisation and checkpoint tracing in files not covered by the merge.
Guus Sliepen [Tue, 29 Sep 2009 13:19:55 +0000 (15:19 +0200)]
Drop localisation and checkpoint tracing in files not covered by the merge.

15 years agoMerge branch 'master' into 1.1
Guus Sliepen [Tue, 29 Sep 2009 12:55:29 +0000 (14:55 +0200)]
Merge branch 'master' into 1.1

Conflicts:
NEWS
configure.in
lib/Makefile.am
lib/pidfile.c
lib/pidfile.h
lib/utils.c
po/POTFILES.in
po/nl.po
src/Makefile.am
src/bsd/device.c
src/conf.c
src/connection.c
src/cygwin/device.c
src/edge.c
src/event.c
src/graph.c
src/linux/device.c
src/meta.c
src/mingw/device.c
src/net.c
src/net_packet.c
src/net_setup.c
src/net_socket.c
src/netutl.c
src/node.c
src/process.c
src/protocol.c
src/protocol_auth.c
src/protocol_edge.c
src/protocol_key.c
src/protocol_misc.c
src/protocol_subnet.c
src/raw_socket/device.c
src/route.c
src/solaris/device.c
src/subnet.c
src/tincd.c
src/uml_socket/device.c

15 years agoUpdate the NEWS.
Guus Sliepen [Sat, 26 Sep 2009 10:51:52 +0000 (12:51 +0200)]
Update the NEWS.

15 years agoAdd more authors to the copyright headers.
Guus Sliepen [Fri, 25 Sep 2009 19:14:56 +0000 (21:14 +0200)]
Add more authors to the copyright headers.

Git's log and blame tools were used to find out which files had significant
contributions from authors who sent in patches that were applied before we used
git.

15 years agoDrop support for localisation.
Guus Sliepen [Thu, 24 Sep 2009 22:54:07 +0000 (00:54 +0200)]
Drop support for localisation.

Localised messages don't make much sense for a daemon, and there is only the
Dutch translation which costs time to maintain.

15 years agoRemove checkpoint tracing.
Guus Sliepen [Thu, 24 Sep 2009 22:33:04 +0000 (00:33 +0200)]
Remove checkpoint tracing.

This feature is not necessary anymore since we have tools like valgrind today
that can catch stack overflow errors before they make a backtrace in gdb
impossible.

15 years agoK&R style braces.
Guus Sliepen [Thu, 24 Sep 2009 22:14:03 +0000 (00:14 +0200)]
K&R style braces.

This is essentially commit f02d3ed3e135b5326003e7f69f8331ff6a3cc219 from the
1.1 branch, making it easier to merge between master and 1.1.

15 years agoUpdate the address of the Free Software Foundation in all copyright headers.
Guus Sliepen [Thu, 24 Sep 2009 22:01:00 +0000 (00:01 +0200)]
Update the address of the Free Software Foundation in all copyright headers.

15 years agoRemove Ivo's old email addresses.
Guus Sliepen [Thu, 24 Sep 2009 21:42:30 +0000 (23:42 +0200)]
Remove Ivo's old email addresses.

15 years agoRemove all occurences of $Id$.
Guus Sliepen [Thu, 24 Sep 2009 21:39:16 +0000 (23:39 +0200)]
Remove all occurences of $Id$.

15 years agoUpdate copyright information.
Guus Sliepen [Thu, 24 Sep 2009 21:29:46 +0000 (23:29 +0200)]
Update copyright information.

- Update year numbers in copyright headers.
- Add copyright information for Michael Tokarev and Florian Forster to the
  copyright headers of files to which they have contributed significantly.
- Mention Michael and Florian in AUTHORS.
- Mention that tinc is GPLv3 or later if compiled with the --enable-tunemu
  flag.

15 years agoAdd a better autoconf check for libevent.
Guus Sliepen [Wed, 16 Sep 2009 21:43:19 +0000 (23:43 +0200)]
Add a better autoconf check for libevent.

15 years agoReplace asprintf()s not covered by the merge to xasprintf().
Guus Sliepen [Wed, 16 Sep 2009 18:28:30 +0000 (20:28 +0200)]
Replace asprintf()s not covered by the merge to xasprintf().

15 years agoUse correct format specifiers.
Guus Sliepen [Wed, 16 Sep 2009 18:17:11 +0000 (20:17 +0200)]
Use correct format specifiers.

15 years agoAdd missing #include.
Guus Sliepen [Wed, 16 Sep 2009 18:16:54 +0000 (20:16 +0200)]
Add missing #include.

15 years agoMerge branch 'master' into 1.1
Guus Sliepen [Wed, 16 Sep 2009 17:55:47 +0000 (19:55 +0200)]
Merge branch 'master' into 1.1

Conflicts:
have.h
lib/dropin.c
lib/fake-getaddrinfo.c
lib/pidfile.c
src/Makefile.am
src/bsd/device.c
src/conf.c
src/connection.c
src/connection.h
src/graph.c
src/mingw/device.c
src/net.c
src/net_setup.c
src/node.c
src/protocol_key.c
src/protocol_misc.c
src/tincd.c

15 years agoSend large packets we cannot handle properly via TCP.
Guus Sliepen [Tue, 15 Sep 2009 21:22:13 +0000 (23:22 +0200)]
Send large packets we cannot handle properly via TCP.

During the path MTU discovery phase, we might not know the maximum MTU yet, but
we do know a safe minimum.  If we encounter a packet that is larger than that
the minimum, we now send it via TCP instead to ensure it arrives.  We also
allow large packets that we cannot fragment or create ICMP replies for to be
sent via TCP.

15 years agoRaise default RSA key length to 2048 bits.
Guus Sliepen [Tue, 15 Sep 2009 21:04:52 +0000 (23:04 +0200)]
Raise default RSA key length to 2048 bits.

15 years agoUse a mutex to allow the TAP reader to process packets faster on Windows.
Guus Sliepen [Tue, 15 Sep 2009 20:59:01 +0000 (22:59 +0200)]
Use a mutex to allow the TAP reader to process packets faster on Windows.

The TAP-Win32 device is not a socket, and select() under Windows only works
with sockets.  Tinc used a separate thread to read from the TAP-Win32 device,
and passed this via a local socket to the main thread which could then select()
from it. We now use a global mutex, which is only unlocked when the main thread
is waiting for select(), to allow the TAP reader thread to process packets
directly.

15 years agoRemove extra {.
Guus Sliepen [Tue, 15 Sep 2009 20:58:16 +0000 (22:58 +0200)]
Remove extra {.

15 years agoRaise default crypto algorithms to AES256 and SHA256.
Guus Sliepen [Tue, 15 Sep 2009 10:08:05 +0000 (12:08 +0200)]
Raise default crypto algorithms to AES256 and SHA256.

In light of the recent improvements of attacks on SHA1, the default hash
algorithm in tinc is now SHA256. At the same time, the default symmetric
encryption algorithm has been changed to AES256.

15 years agoUse access() instead of stat() for checking whether scripts exist.
Guus Sliepen [Mon, 14 Sep 2009 22:36:07 +0000 (00:36 +0200)]
Use access() instead of stat() for checking whether scripts exist.

15 years agoRemove dropin random() function, as it is not used anymore.
Guus Sliepen [Mon, 14 Sep 2009 22:28:20 +0000 (00:28 +0200)]
Remove dropin random() function, as it is not used anymore.

15 years agoAllow compiling for Windows XP and higher.
Guus Sliepen [Mon, 14 Sep 2009 22:24:31 +0000 (00:24 +0200)]
Allow compiling for Windows XP and higher.

This allows us to use getaddrinfo(), getnameinfo() and related functions, which
allow tinc to make connections over existing IPv6 networks. These functions are
not available on Windows 2000 however. By default, support is enabled, but when
compiling for Windows 2000 the configure switch --with-windows2000 should be
used.

Since getaddrinfo() et al. are not functions but macros on Windows, we have to
use AC_CHECK_DECLS() instead of AC_CHECK_FUNCS() in configure.in.

15 years agoAlso do not use drand48(), it is not available on Windows.
Guus Sliepen [Mon, 14 Sep 2009 21:28:28 +0000 (23:28 +0200)]
Also do not use drand48(), it is not available on Windows.

15 years agoUse only rand(), not random().
Guus Sliepen [Mon, 14 Sep 2009 21:06:00 +0000 (23:06 +0200)]
Use only rand(), not random().

We used both rand() and random() in our code. Since it returns an int, we have
to use %x in our format strings instead of %lx. This fixes a crash under
Windows when cross-compiling tinc with a recent version of MinGW.

15 years agoApparently it's impolite to ask GCC to subtract two pointers.
Guus Sliepen [Sun, 13 Sep 2009 12:08:59 +0000 (14:08 +0200)]
Apparently it's impolite to ask GCC to subtract two pointers.

If two pointers do not belong to the same array, pointer subtraction gives
nonsensical results, depending on the level of optimisation and the
architecture one is compiling for. It is apparently not just subtracting the
pointer values and dividing by the size of the object, but uses some kind of
higher magic not intended for mere mortals. GCC will not warn about this at
all. Casting to void * is also a no-no, because then GCC does warn that strict
aliasing rules are being broken. The only safe way to query the ordering of two
pointers is to use the (in)equality operators.

The unsafe implementation of connection_compare() has probably caused the "old
connection_t for ... still lingering" messages. Our implementation of AVL trees
is augmented with a doubly linked list, which is normally what is traversed.
Only when deleting an old connection the tree itself is traversed.

15 years agoRemove superfluous call to avl_delete().
Guus Sliepen [Sun, 13 Sep 2009 12:07:40 +0000 (14:07 +0200)]
Remove superfluous call to avl_delete().

15 years agoHandle unicast packets larger than PMTU in switch mode.
Guus Sliepen [Sat, 12 Sep 2009 12:19:36 +0000 (14:19 +0200)]
Handle unicast packets larger than PMTU in switch mode.

If PMTUDiscovery is enabled, and we see a unicast packet that is larger than
the path MTU in switch mode, treat it just like we would do in router mode.

15 years agoAllow PMTUDiscovery in switch and hub modes again.
Guus Sliepen [Sat, 12 Sep 2009 11:40:32 +0000 (13:40 +0200)]
Allow PMTUDiscovery in switch and hub modes again.

PMTUDiscovery was disabled in commit d5b56bbba56480b5565ffb38496175a7c1df60ac
because tinc did not handle packets larger than the path MTU in switch and hub
modes. We now allow it again in preparation of proper support, but default to
off.

15 years agoPut Subnet weight in a separate environment variable.
Guus Sliepen [Sat, 12 Sep 2009 11:34:11 +0000 (13:34 +0200)]
Put Subnet weight in a separate environment variable.

Commit 5674bba5c54c1aee3a4ac5b3aba6b3ebded91bbc introduced weighted Subnets,
but the weight was included in the SUBNET variable passed to subnet-up/down
scripts. This makes it harder to use in those scripts. The weight is now
stripped from the SUBNET variable and put in the WEIGHT variabel.

15 years agoDon't stat() on iPhone/iPod.
Guus Sliepen [Thu, 10 Sep 2009 17:51:08 +0000 (19:51 +0200)]
Don't stat() on iPhone/iPod.

Grzegorz Dymarek noted that tinc segfaults at the stat() call in
execute_script() on the iPhone.  We can omit the stat() call for the moment,
the subsequent call to system() will fail with just a warning.

15 years agoAdd support for iPhones and recent iPods.
Guus Sliepen [Thu, 10 Sep 2009 17:32:54 +0000 (19:32 +0200)]
Add support for iPhones and recent iPods.

This is a slightly modified patch from Grzegorz Dymarek that allows tinc to use
the tunemu device, which allows tinc to be compiled for iPhones and recent
iPods. To enable support for tunemu, the --enable-tunemu option has to be used
when running the configure script.

15 years agoAnother safe bitfield conversion.
Guus Sliepen [Wed, 9 Sep 2009 12:51:36 +0000 (14:51 +0200)]
Another safe bitfield conversion.

15 years agoAdd the GPL license to the repository.
Guus Sliepen [Wed, 9 Sep 2009 11:23:16 +0000 (13:23 +0200)]
Add the GPL license to the repository.

Tinc is licensed under the GPL version 2 or later. To ensure autoconf does not
install the wrong license if COPYING is missing, we have to put the right one
in place.

15 years agoConvert bitfields to integers in a safe way.
Guus Sliepen [Wed, 9 Sep 2009 10:04:08 +0000 (12:04 +0200)]
Convert bitfields to integers in a safe way.

This is commit eb391c52eed46f3f03b404553df417851fc0cb90 redone, but without the
non-standard anonymous union.

15 years agoEnsure tinc compiles with gcc -std=c99.
Guus Sliepen [Tue, 8 Sep 2009 19:45:24 +0000 (21:45 +0200)]
Ensure tinc compiles with gcc -std=c99.

We use a lot of C99 features already, but also some extensions which are not in
the standard.

15 years agoUNIX signal numbers start at 1.
Guus Sliepen [Tue, 8 Sep 2009 16:21:52 +0000 (18:21 +0200)]
UNIX signal numbers start at 1.

15 years agoReplace asprintf() by xasprintf().
Guus Sliepen [Tue, 8 Sep 2009 16:18:36 +0000 (18:18 +0200)]
Replace asprintf() by xasprintf().

15 years agoCheck the return value of fscanf() when reading a PID file.
Guus Sliepen [Tue, 8 Sep 2009 16:18:16 +0000 (18:18 +0200)]
Check the return value of fscanf() when reading a PID file.

15 years agoAdd xasprintf() and xvasprintf().
Guus Sliepen [Tue, 8 Sep 2009 16:16:58 +0000 (18:16 +0200)]
Add xasprintf() and xvasprintf().

These functions wrap asprintf() and vasprintf(), and check the return value. If
the function failed, tinc will exit with an error message, similar to xmalloc()
and friends.

15 years agoRemove extra semicolon in my definition of setpriority()
Michael Tokarev [Sat, 5 Sep 2009 13:24:41 +0000 (17:24 +0400)]
Remove extra semicolon in my definition of setpriority()

15 years agoAlways remove a node from the UDP tree before freeing it.
Guus Sliepen [Tue, 8 Sep 2009 14:35:28 +0000 (16:35 +0200)]
Always remove a node from the UDP tree before freeing it.

Valgrind caught tinc reading free'd memory during a purge(). This was caused by
first removing it from the main node tree, which will already call free_node(),
and then removing it from the UDP tree. This might cause spurious segmentation
faults.

15 years agoChange level of some debug messages, zero pointer after freeing hostname.
Guus Sliepen [Thu, 11 Jun 2009 17:39:25 +0000 (19:39 +0200)]
Change level of some debug messages, zero pointer after freeing hostname.

15 years agoDo not log errors when recvfrom() returns EAGAIN or EINTR.
Guus Sliepen [Thu, 11 Jun 2009 17:26:34 +0000 (19:26 +0200)]
Do not log errors when recvfrom() returns EAGAIN or EINTR.

Although we select() before we call recvfrom(), it sometimes happens that
select() tells us we can read but a subsequent read fails anyway. This is
harmless.

15 years agoRemove pending MTU probe events when a node's reachability status changes.
Guus Sliepen [Thu, 11 Jun 2009 17:07:54 +0000 (19:07 +0200)]
Remove pending MTU probe events when a node's reachability status changes.

15 years agoDon't try to send MTU probes to unreachable nodes.
Guus Sliepen [Thu, 11 Jun 2009 16:36:08 +0000 (18:36 +0200)]
Don't try to send MTU probes to unreachable nodes.

If there is an outstanding MTU probe event for a node which is not reachable
anymore, a UDP packet would be sent to that node, which caused a key request to
be sent to that node, which triggered a NULL pointer dereference. Probes and
other UDP packets to unreachable nodes are now dropped.

15 years agoFix pointer arithmetic when creating and verifying message authentication codes.
Guus Sliepen [Sat, 6 Jun 2009 18:14:51 +0000 (20:14 +0200)]
Fix pointer arithmetic when creating and verifying message authentication codes.

15 years agoHandle truncated message authentication codes.
Guus Sliepen [Sat, 6 Jun 2009 17:04:04 +0000 (19:04 +0200)]
Handle truncated message authentication codes.

15 years agoMerge branch 'master' into 1.1
Guus Sliepen [Fri, 5 Jun 2009 21:03:28 +0000 (23:03 +0200)]
Merge branch 'master' into 1.1

Conflicts:
doc/tincd.8.in
lib/pidfile.c
src/graph.c
src/net.c
src/net.h
src/net_packet.c
src/net_setup.c
src/net_socket.c
src/netutl.c
src/node.c
src/node.h
src/protocol_auth.c
src/protocol_key.c
src/tincd.c

15 years agoProperly set HMAC length for incoming packets.
Guus Sliepen [Fri, 5 Jun 2009 14:14:31 +0000 (16:14 +0200)]
Properly set HMAC length for incoming packets.

15 years agotry outgoing connections before chroot/drop_privs
Michael Tokarev [Fri, 5 Jun 2009 09:33:58 +0000 (13:33 +0400)]
try outgoing connections before chroot/drop_privs

When chrooted, we either need to force-initialize resolver
and/or nsswitch somehow (no clean way) or resolve all the
names we want before entering chroot jail.  The latter
looks cleaner, easier and it is actually safe because
we still don't talk with the remote nodes there, only
initiating outgoing connections.

15 years agocleanup setpriority thing to make it readable
Michael Tokarev [Fri, 5 Jun 2009 07:58:17 +0000 (11:58 +0400)]
cleanup setpriority thing to make it readable

15 years agoAdd some const where appropriate.
Guus Sliepen [Thu, 28 May 2009 21:18:22 +0000 (23:18 +0200)]
Add some const where appropriate.

15 years agoAdd ProcessPriority option.
Guus Sliepen [Thu, 28 May 2009 20:51:30 +0000 (22:51 +0200)]
Add ProcessPriority option.

This option can be set to low, normal or high. On UNIX flavours, this changes
the nice value of the process by +10, 0 and -10 respectively. On Windows, it
sets the priority to BELOW_NORMAL_PRIORITY_CLASS, NORMAL_PRIORITY_CLASS and
HIGH_PRIORITY_CLASS respectively.

A high priority might help to reduce latency and packet loss on the VPN.

15 years agosrc/net_socket.c: Bind outgoing TCP sockets to `BindToAddress'.
Florian Forster [Wed, 27 May 2009 12:20:24 +0000 (14:20 +0200)]
src/net_socket.c: Bind outgoing TCP sockets to `BindToAddress'.

If a host has multiple addresses on an interface, the source address of the TCP
connection(s) was picked by the operating system while the UDP packets used a
bound socket, i. e. the source address was the address specified by the user.
This caused problems because the receiving code requires the TCP connection and
the UDP connection to originate from the same IP address.

This patch adds support for the `BindToInterface' and `BindToAddress' options
to the setup of outgoing TCP connections.

Tested with Debian Etch on x86 and Debian Lenny on x86_64.

Signed-off-by: Florian Forster <octo@verplant.org>
15 years agosrc/linux/device.c: Fix segfault when running without `--net'.
Florian Forster [Wed, 27 May 2009 07:27:44 +0000 (09:27 +0200)]
src/linux/device.c: Fix segfault when running without `--net'.

If running without `--net', the (global) variable `netname' is NULL. This
creates a segmentation fault because this NULL-pointer is passed to strdup:

 Program terminated with signal 11, Segmentation fault.
 #0  0xb7d30463 in strlen () from /lib/tls/i686/cmov/libc.so.6
 (gdb) bt
 #0  0xb7d30463 in strlen () from /lib/tls/i686/cmov/libc.so.6
 #1  0xb7d30175 in strdup () from /lib/tls/i686/cmov/libc.so.6
 #2  0x0805bf47 in xstrdup (s=0x0) at xmalloc.c:118  <---
 #3  0x0805be33 in setup_device () at device.c:66
 #4  0x0805072e in setup_myself () at net_setup.c:432
 #5  0x08050db2 in setup_network () at net_setup.c:536
 #6  0x0805b27f in main (argc=Cannot access memory at address 0x0) at tincd.c:580

This patch fixes this by checking `netname' in `setup_device'. An alternative
would be to check for NULL-pointers in `xstrdup' and return NULL in this case.

Signed-off-by: Florian Forster <octo@verplant.org>
15 years agotunnelserver: log which ADD_SUBNET was refused
Michael Tokarev [Sun, 24 May 2009 13:23:24 +0000 (17:23 +0400)]
tunnelserver: log which ADD_SUBNET was refused

Add some logging about refused ADD_SUBNET
(it causes subsequent client disconnect so it's
important to know which subnet was at fault).

Maybe we should just ignore it completely.

15 years agoDo not forward broadcast packets when TunnelServer is enabled.
Guus Sliepen [Mon, 25 May 2009 13:04:33 +0000 (15:04 +0200)]
Do not forward broadcast packets when TunnelServer is enabled.

First of all, the idea behind the TunnelServer option is to hide all other
nodes from each other, so we shouldn't forward broadcast packets from them
anyway. The other reason is that since edges from other nodes are ignored, the
calculated minimum spanning tree might not be correct, which can result in
routing loops.

15 years agoUse packet size before decompression to calculate path MTU.
Guus Sliepen [Mon, 25 May 2009 10:19:37 +0000 (12:19 +0200)]
Use packet size before decompression to calculate path MTU.

Since compression can either grow or shrink a packet, the size of an MTU probe
after decompression might not reflect the real path MTU. Now we use the size
before decompression, which is independent of the compression algorithm, and
substract a safety margin such that the calculated path MTU will be safe even
for packets which grow as much as possible after compression.

15 years agoAdd declaration for sockaddrcmp_noport().
Guus Sliepen [Mon, 25 May 2009 10:19:08 +0000 (12:19 +0200)]
Add declaration for sockaddrcmp_noport().

15 years agoFix ans_key exchange in recent changes
Michael Tokarev [Sun, 24 May 2009 18:32:24 +0000 (22:32 +0400)]
Fix ans_key exchange in recent changes

send_ans_key() was using the wrong in vs. outkeylength to
terminate the key being sent, so it was always empty.

15 years agoUse xrealloc instead of if(ptr) ptr = xmalloc().
Guus Sliepen [Sun, 24 May 2009 17:35:51 +0000 (19:35 +0200)]
Use xrealloc instead of if(ptr) ptr = xmalloc().

15 years agoFix initialisation of packet decryption context broken by commit 3308d13e7e3bf20cfeaf...
Guus Sliepen [Sun, 24 May 2009 17:31:31 +0000 (19:31 +0200)]
Fix initialisation of packet decryption context broken by commit 3308d13e7e3bf20cfeaf6f2ab17228a9820cea66.

Instead of a single, global decryption context, each node has its own context.
However, in send_ans_key(), the global context was initialised. This commit
fixes that and removes the global context completely.

Also only set status.validkey after all checks have been evaluated.

15 years agodon't log every strange packet coming to the UDP port
Michael Tokarev [Thu, 21 May 2009 21:10:16 +0000 (01:10 +0400)]
don't log every strange packet coming to the UDP port

it's a sure way to fill up syslog.  Only log those if
debug level is up to PROTOCOL