Commit graph

1580 commits

Author SHA1 Message Date
Guus Sliepen
d15099e002 Be liberal in accepting KEY_CHANGED/REQ_KEY/ANS_KEY requests.
When we got a key request for or from a node we don't know, we disconnected the
node that forwarded us that request.  However, especially in TunnelServer mode,
disconnecting does not help. We now ignore such requests, but since there is no
way of telling the original sender that the request was dropped, we now retry
sending REQ_KEY requests when we don't get an ANS_KEY back.
2010-01-23 18:48:01 +01:00
Guus Sliepen
469fa318bc Run subnet-up/down scripts for local MAC addresses as well. 2010-01-22 21:59:40 +01:00
Guus Sliepen
5d194b9f87 Fix subnet-up/down scripts being called with an empty SUBNET.
Commit 052ff8b2c5 contained a bug that causes
scripts to be called with an empty, or possibly corrupted SUBNET variable when
a Subnet is added or removed while the owner is still online. In router mode,
this normally does not happen, but in switch mode this is normal.
2010-01-22 21:47:26 +01:00
Guus Sliepen
b455111184 Make MSS clamping configurable, but enabled by default.
It can either be set globally in tinc.conf, or per-node in host config files.
2010-01-16 20:16:33 +01:00
Guus Sliepen
95928f7c29 Also clamp MSS of TCP over IPv6 packets. 2010-01-16 19:32:33 +01:00
Guus Sliepen
b1945f70fe Optimise handling of select() returning <= 0.
Before, we immediately retried select() if it returned -1 and errno is EAGAIN
or EINTR, and if it returned 0 it would check for network events even if we
know there are none.  Now, if -1 or 0 is returned we skip checking network
events, but we do check for timer and signal events.
2010-01-15 23:41:14 +01:00
Guus Sliepen
51099658c9 Ping nodes immediately when receiving SIGALRM.
One reason to send the ALRM signal is to let tinc immediately try to connect to
outgoing nodes, for example when PPP or DHCP configuration of the outgoing
interface finished.  Conversely, when the outgoing interface goes down one can
now send this signal to let tinc quickly detect that links are down too.
2010-01-15 23:19:08 +01:00
Guus Sliepen
2a538ed343 Clamp MSS of IPv4 SYN packets.
Some ISPs block the ICMP Fragmentation Needed packets that tinc sends.  We
clamp the MSS of IPv4 SYN packets to prevent hosts behind those ISPs from
sending too large packets.
2010-01-15 13:42:37 +01:00
Guus Sliepen
e4812ba9cc Allow Port and PMTUDiscovery options in tinc.conf, always enable PMTUDiscovery by default. 2009-12-24 12:42:21 +01:00
Guus Sliepen
7203d5fb07 Use xstrdup() instead of xasprintf() to copy static strings. 2009-12-23 19:51:55 +01:00
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
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
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
Guus Sliepen
ec4c8bcb18 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.
2009-10-12 22:14:47 +02:00
Guus Sliepen
92b8abc921 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.
2009-10-11 18:57:58 +02:00
Guus Sliepen
927064e5fd 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.
2009-10-11 15:46:52 +02:00
Guus Sliepen
2c30af6c90 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.
2009-10-11 14:20:14 +02:00
Guus Sliepen
a4f132770d 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 4bb3793e38.
2009-10-11 13:56:04 +02:00
Guus Sliepen
2762509be1 Remove code duplication when checking ADD_EDGE/DEL_EDGE messages. 2009-10-11 13:54:05 +02:00
Guus Sliepen
5cddf5e52a Don't disconnect clients in TunnelServer mode who send unauthorised ADD_SUBNETs.
So that we are liberal in what we accept.
2009-10-11 13:51:10 +02:00
Borg
430c90412c Removed last gettext function. 2009-10-03 13:06:00 +02:00
Guus Sliepen
3282375f4d 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.
2009-09-29 16:25:20 +02:00
Guus Sliepen
9a2b0f88a9 Update the NEWS. 2009-09-26 12:51:52 +02:00
Guus Sliepen
46e481dc94 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.
2009-09-25 21:14:56 +02:00
Guus Sliepen
4c85542894 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.
2009-09-25 00:54:07 +02:00
Guus Sliepen
a227843b73 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.
2009-09-25 00:33:04 +02:00
Guus Sliepen
5dde6461a3 K&R style braces.
This is essentially commit f02d3ed3e1 from the
1.1 branch, making it easier to merge between master and 1.1.
2009-09-25 00:14:03 +02:00