Commit graph

1571 commits

Author SHA1 Message Date
Julien Muchembled
8c3105283a 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.
2010-09-05 22:26:26 +02:00
Guus Sliepen
4b6a9f1c1f 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.
2010-06-04 16:03:19 +02:00
Guus Sliepen
798fa2f04c Use 64 bit counters to keep track of bytes sent/received from the virtual network interface. 2010-06-04 15:04:08 +02:00
Guus Sliepen
4a21aabada 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.
2010-06-04 14:53:52 +02:00
Guus Sliepen
dbf3d168b7 Use strrchr() insteaad of rindex().
The latter function is deprecated, some build environments do not support.
2010-05-07 12:24:49 +02:00
Timothy Redaelli
eda7179874 Fix warnings under BSD 2010-05-06 21:19:49 +02:00
Timothy Redaelli
df985256a7 Fix warnings showed using -D_FORTIFY_SOURCE=2 2010-05-04 00:54:37 +02:00
Guus Sliepen
f5122ccece Fix all warnings when compiling with mingw64. 2010-05-01 15:39:59 +02:00
Guus Sliepen
ef92a5725c OpenSSL 1.0.0 compiled for 64 bit Windows requires linking with -lcrypt32. 2010-05-01 15:39:03 +02:00
Guus Sliepen
0fdd7da520 Use intptr_t instead of long to store a pointer. 2010-05-01 15:38:04 +02:00
Guus Sliepen
c94ede3b87 Define WINVER before including any other header file on Windows. 2010-05-01 15:37:11 +02:00
Guus Sliepen
4766359e14 Fix reading configuration files that do not end with a newline. Again. 2010-04-17 12:01:38 +02:00
Guus Sliepen
26b8cf8680 Releasing 1.0.13. 2010-04-11 20:40:20 +02:00
Guus Sliepen
74653beb5b Mark Forwarding and DirectOnly options as being experimental. 2010-04-11 19:47:44 +02:00
Guus Sliepen
0ddce6370d Don't redefine MAX if it already exists. 2010-04-11 19:39:31 +02:00
Guus Sliepen
a9bbb3357a Fixes for definitions under Windows. 2010-04-11 19:20:02 +02:00
Guus Sliepen
4708f2c89e Ensure subnet-up/down scripts are called after HUP when necessary. 2010-04-11 18:34:50 +02:00
Guus Sliepen
32f5524c4b Fix reloading Subnets when StrictSubnets is set. 2010-04-11 04:35:16 +02:00
Guus Sliepen
9f53ab209d Reload Subnets when getting a HUP signal and StrictSubnets is used. 2010-04-11 00:50:42 +02:00
Guus Sliepen
d1cc637470 Ensure ICMP_NET_ANO is defined. 2010-04-10 23:55:15 +02:00
Guus Sliepen
f75e71bc69 Convert Port to numeric form before sending it to other nodes.
If one uses a symbolic name for the Port option, tinc will send that name
literally to other nodes.  However, it is not guaranteed that all nodes have
the same contents in /etc/services, or have such a file at all.
2010-04-03 09:46:45 +01:00
Sven-Haegar Koch
292354912f Never delete Subnets when StrictSubnets is set
If a node is unreachable, and not connected to an edge anymore, it gets
deleted. When this happens its subnets are also removed, which should
not happen with StrictSubnets=yes.

Solution:
- do not remove subnets in src/net.c::purge(), we know that all subnets
  in the list came from our hosts files.
  I think here you got the check wrong by looking at the tunnelserver
  code below it - with strictsubnets we still inform others but do not
  remove the subnet from our data.
- do not remove nodes in net.c::purge() that still have subnets
  attached.
2010-03-18 11:50:45 +01:00
Guus Sliepen
146760bd35 Fix typo. 2010-03-10 16:07:01 +01:00
Guus Sliepen
f2346771cf Log unauthorized Subnets when StrictSubnets is set. 2010-03-08 21:44:32 +01:00
Guus Sliepen
ee64b8ef33 ConnectTo does not mean tinc does not listen for incoming connections anymore. 2010-03-08 17:54:57 +01:00
Guus Sliepen
8ae54dc7c7 Fixes for the Forwarding option. 2010-03-02 23:27:50 +01:00
Guus Sliepen
3e4829e78a Add the DirectOnly option.
When this option is enabled, packets that cannot be sent directly to the destination node,
but which would have to be forwarded by an intermediate node, are dropped instead.
When combined with the IndirectData option,
packets for nodes for which we do not have a meta connection with are also dropped.
2010-03-02 22:55:24 +01:00
Guus Sliepen
95a6974de1 Add the Forwarding option.
This determines if and how incoming packets that are not meant for the local
node are forwarded.  It can either be off, internal (tinc forwards them itself,
as in previous versions), or kernel (packets are always sent to the TUN/TAP
device, letting the kernel sort them out).
2010-03-02 22:34:26 +01:00
Guus Sliepen
5038964032 Add the StrictSubnets option.
When this option is enabled, tinc will not accept dynamic updates of Subnets
from other nodes, but will only use Subnets read from local host config files
to build its routing table.
2010-03-02 00:18:44 +01:00
Guus Sliepen
9fed0ec34b Preload all Subnets in TunnelServer mode.
This simplifies the logic in protocol_subnet.c.
2010-03-01 23:44:56 +01:00
Guus Sliepen
d47ab576a2 Check for dirent.h. 2010-03-01 23:44:46 +01:00
Guus Sliepen
21f33b6382 Simplify reading lines from configuration files.
Instead of allocating storage for each line read, we now read into fixed-size
buffers on the stack. This fixes a case where a malformed configuration file
could crash tinc.
2010-03-01 23:35:02 +01:00
Guus Sliepen
3cb91d75f8 Clamp MSS to miminum MTU in both directions.
Clamp MSS of both incoming and outgoing packets, and use the minimum of the
PMTU of both directions when clamping.
2010-02-28 18:20:13 +01:00
Timothy Redaelli
ddb8cb0779 Add --disable-zlib configure option 2010-02-10 16:47:52 +01:00
Timothy Redaelli
eeb505af36 Add --disable-lzo configure option 2010-02-10 16:47:52 +01:00
Guus Sliepen
f7b2a2ea43 Releasing 1.0.12. 2010-02-03 22:49:48 +01:00
Guus Sliepen
cd0c2e86a4 Ensure peers with a meta connection always have our key.
This keeps UDP probes going, which in turn keeps NAT mappings alive.
2010-02-03 11:18:46 +01:00
Guus Sliepen
40d91ff619 Update copyright notices. 2010-02-02 22:49:21 +01:00
Guus Sliepen
44f8f61396 Try to set DF bit on BSDs as well.
Every operating system seems to have its own, slightly different way to disable
packet fragmentation. Emit a compiler warning when no suitable way is found.
On OpenBSD, it seems impossible to do it for IPv4.
2010-02-02 22:22:27 +01:00
Guus Sliepen
ed14ef93b4 Immediately exchange keys when establishing a meta connection.
This in turn will trigger PMTU discovery, and ensures nodes know each others
reflexive UDP address and port.
2010-02-02 01:02:40 +01:00
Guus Sliepen
4a0b998151 Determine peer's reflexive address and port when exchanging keys.
To help peers that are behind NAT connect to each other directly via UDP, they
need to know the exact external address and port that they use. Keys exchanged
between NATted peers necessarily go via a third node, which knows this address
and port, and can append this information to the keys, which is in turned used
by the peers.

Since PMTU discovery will immediately trigger UDP communication from both sides
to each other, this should allow direct communication between peers behind
full, address-restricted and port-restricted cone NAT.
2010-02-02 00:51:44 +01:00
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