Commit graph

1835 commits

Author SHA1 Message Date
Guus Sliepen
a9a803d566 Allow port to be specified in Address statements.
This allows one to connect to use more than one port number to connect to
another node. The syntax is now:

Address = <hostname> [<port>]
2009-12-23 19:49:38 +01:00
Guus Sliepen
43e34d8180 Do not fragment packets smaller than RFC defined minimum MTUs.
For IPv6, the minimum MTU is 1280 (RFC 2460), for IPv4 the minimum is actually
68, but this is such a low limit that it will probably hurt performance, so we
do as if it is 576 (the minimum packet size hosts should be able to handle, RFC
791). If we detect a path MTU smaller than those minima, and we have to handle
a packet that is bigger than the PMTU but smaller than those minima, we forward
them via TCP instead of fragmenting or returning ICMP packets.
2009-12-23 19:22:06 +01:00
Guus Sliepen
3626165002 Do not use hardcoded cipher block length when padding. 2009-12-19 23:23:25 +01:00
Guus Sliepen
f542ef8f9e Fix alignment of results of RSA operations when using libgcrypt.
If the result of an RSA encryption or decryption operation can be represented
in less bytes than given, gcry_mpi_print() will not add leading zero bytes. Fix
this by adding those ourself.
2009-12-19 22:17:39 +01:00
Guus Sliepen
4c68a8cb60 Do not consider unreachable nodes when trying to determine packet origin. 2009-12-19 20:53:48 +01:00
Guus Sliepen
74e50d52e0 recv() and recvfrom() return int, do not prematurely cast the return value. 2009-12-19 20:52:19 +01:00
Guus Sliepen
0bfd69a273 Fix reading raw RSA keys with libgcrypt. 2009-12-19 20:26:30 +01:00
Guus Sliepen
0ff44fc241 Reinitialise block cipher IV each time we encrypt a packet when using libgcrypt. 2009-12-19 20:10:38 +01:00
Guus Sliepen
3c90be7678 Fix block cipher padding when using libgcrypt. 2009-12-19 18:57:54 +01:00
Guus Sliepen
c845bc109c Fix packet authentication.
This wasn't working at all, since we didn't do HMAC but just a plain hash.
Also, verification of packets failed because it was checking the whole packet,
not the packet minus the HMAC.
2009-12-18 01:15:25 +01:00
Guus Sliepen
10d609b1f0 Start of a GUI for tinc. 2009-12-16 21:18:21 +01:00
Guus Sliepen
55ef2f806f Allow connections to be closed.
This only closes existing meta connections, it may not affect node
reachability.
2009-12-16 21:16:56 +01:00
Guus Sliepen
f12c36afd5 Include missing header files and source directories. 2009-12-14 21:25:06 +01:00
Guus Sliepen
2a410cd26d Do not include OpenSSL headers directly. 2009-12-14 21:20:56 +01:00
Guus Sliepen
5d78e497f1 Fix compiler warnings. 2009-12-11 22:38:06 +01:00
Guus Sliepen
d6c50eb73a Merge branch 'master' into 1.1
Conflicts:
	src/subnet.c
2009-12-11 22:31:27 +01:00
Guus Sliepen
fec14791e8 Only call ioctlsocket() on Windows. 2009-12-11 22:24:07 +01:00
Guus Sliepen
369fe1ab1c Forget addresses of unreachable nodes.
We clear the cached address used for UDP connections when a node becomes
unreachable. This also prevents host-up scripts from passing the old, cached
address from when the host becomes reachable again from a different address.
2009-12-08 22:18:37 +00:00
Guus Sliepen
62f235e05c Remove unused variable in lookup_subnet_*() functions. 2009-11-28 11:56:13 +00:00
Guus Sliepen
92aefd25bf When learning MAC addresses, only check our own Subnets for previous entries.
Before it would check all addresses, and not learn an address if another node
already claimed that address. This caused fast roaming to fail, the code from
commit 6f6f426b35 was never triggered.
2009-11-28 11:52:23 +00:00
Guus Sliepen
edebf579f2 Use the TCP socket infrastructure for control sockets.
The control socket code was completely different from how meta connections are
handled, resulting in lots of extra code to handle requests.  Also, not every
operating system has UNIX sockets, so we have to resort to another type of
sockets or pipes for those anyway.  To reduce code duplication and make control
sockets work the same on all platforms, we now just connect to the TCP port
where tincd is already listening on.

To authenticate, the program that wants to control a running tinc daemon must
send the contents of a cookie file. The cookie is a random 256 bits number that
is regenerated every time tincd starts. The cookie file should only be readable
by the same user that can start a tincd.

Instead of the binary-ish protocol previously used, we now use an ASCII
protocol similar to that of the meta connections, but this can still change.
2009-11-07 23:43:25 +01:00
Guus Sliepen
c388527e34 Small fixes to get really working control sockets on Windows. 2009-11-07 16:09:56 +01:00
Guus Sliepen
5c5548fc71 Better integration of libevent in build system.
Since event.h is not part of tinc, we include it in have.h were all other
system header files are included.  We also ensure -levent comes before -lgdi32
when compiling with MinGW, apparently it doesn't work when the order is
reversed.
2009-11-07 14:35:48 +01:00
Guus Sliepen
075264a9e1 Make sure the 1.1 branch compiles in a MinGW environment.
UNIX domain sockets, of course, don't exist on Windows. For now, when compiling
tinc in a MinGW environment, try to use a TCP socket bound to localhost as an
alternative.
2009-11-05 23:29:28 +01:00
Guus Sliepen
08615e420b Handle PKCS#5 padding in the gcrypt backend. 2009-11-05 00:02:42 +01:00
Guus Sliepen
d9b2ac6767 Handle truncated message authentication codes with gcrypt.
Commit 4124b9682f did not update the gcrypt
backend.
2009-11-05 00:01:25 +01:00
Guus Sliepen
c4afc48154 Use %x instead of %lx where appropriate.
Some conversions were not properly merged from the master branch.
2009-11-04 16:19:08 +01:00
Guus Sliepen
37ccb325af Don't enable device events when there is no valid filedescriptor. 2009-11-04 16:18:08 +01:00
Guus Sliepen
108b238915 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
2009-11-02 14:24:27 +01:00
Guus Sliepen
44834d0304 Releasing 1.0.11. 2009-11-01 16:24:39 +01:00
Guus Sliepen
d331f04e45 Start a tinc service if it already exists. 2009-11-01 15:57:28 +01:00
Guus Sliepen
6f6f426b35 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.
2009-10-27 23:53:49 +01:00
Guus Sliepen
e00b44cb98 Move socket error interpretation to utils.h. 2009-10-25 01:40:07 +02:00
Guus Sliepen
c11dc8079b Use WSAGetLastError() to determine cause of network errors on Windows.
This reduces log spam and lets path MTU discovery work faster.
2009-10-25 00:50:09 +02:00
Michael Tokarev
1bca167b7e Remove localedir leftovers. 2009-10-24 23:46:11 +02:00
Guus Sliepen
c3acae034c 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.
2009-10-24 22:32:35 +02:00
Guus Sliepen
242c4e2ca6 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.
2009-10-24 21:53:01 +02:00
Guus Sliepen
d922db253c 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.
2009-10-24 21:35:40 +02:00
Guus Sliepen
a8f7fccbc2 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.
2009-10-24 21:32:06 +02:00
Guus Sliepen
cddcdc9af3 Allow UDP packets with an address different from the corresponding TCP connection. 2009-10-24 20:54:44 +02:00
Guus Sliepen
5cbddc68ba 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.
2009-10-24 16:15:24 +02:00
Guus Sliepen
468f393c4f Add dummy device. 2009-10-24 16:05:12 +02:00
Guus Sliepen
b6543af762 Clarify and increase level of log message about MTU probes to unreachable nodes. 2009-10-20 22:39:07 +02:00
Guus Sliepen
43a6e78664 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.
2009-10-20 22:33:16 +02:00
Guus Sliepen
3a925479c2 Starting to work towards 1.0.11. 2009-10-20 22:22:59 +02:00
Guus Sliepen
35af4051c3 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.
2009-10-20 22:14:47 +02:00
Guus Sliepen
8c267d3d55 Releasing 1.0.10. 2009-10-18 16:45:13 +02:00
Guus Sliepen
3849de9a33 Fix description of the WEIGHT environment variable. 2009-10-18 16:44:32 +02:00
Guus Sliepen
87364c1656 Include missing header. 2009-10-18 14:22:20 +02:00
Guus Sliepen
c7fdc7d5b8 Remove debugging message when reading packets from a BSD device.
This was inadvertently introduced by commit
4a5d42178c.
2009-10-12 23:51:57 +02:00