Commit graph

2734 commits

Author SHA1 Message Date
Guus Sliepen
88d158e15b Fix potential segfault in the replacement vasprintf() function. 2017-01-31 12:03:27 +01:00
Etienne Dechamps
06b8201332 Fix address memory leaks in add_edge_h().
Note that this is not as bad as it looks, because in practice
sockaddrfree() is a no-op for typical address types.
2016-12-18 17:14:17 +00:00
Etienne Dechamps
02093b12b0 Clarify the flow of add_edge_h().
This is an attempt at making the control flow through this function
easier to understand by rearranging branches and cutting back on
indentation levels.

This is a pure refactoring; there is no change in behavior.
2016-12-18 17:14:16 +00:00
Etienne Dechamps
3bf3d7d3e7 Fix edge updates containing local address changes.
This commit fixes a logic bug in the edge update code where local
address changes are not taken into account if they are bundled in with
other changes. This bug breaks local discovery in some scenarios.

The regression was introduced by commit
e4670fc4a0576eb76f1807ce29fa9455dd247632.
2016-12-18 17:14:16 +00:00
Etienne Dechamps
0792a10a5a Fix edge local addresses not being set when connections are established.
This bug prevented nodes from advertising their local addresses, thus
breaking local discovery.

The regression was introduced in
ab13c14a14.
2016-12-18 17:14:16 +00:00
Guus Sliepen
979acc48ad Enforce maximum amount of bytes sent/received on meta-connections.
This is 2^{block_length_in_bits / 2 - 1}.
2016-10-30 15:19:12 +01:00
Guus Sliepen
edc1efed3c Use AES256 and SHA256 by default for the legacy protocol.
At the start of the decade, there were still distributions that shipped
with versions of OpenSSL that did not support these algorithms. By now
everyone should support them. The old defaults were Blowfish and SHA1,
both of which are not considered secure anymore.

The meta-protocol now always uses AES in CFB mode, but the key length
will adapt to the one specified by the Cipher option. The digest for the
meta-protocol is hardcoded to SHA256.
2016-10-30 15:17:52 +01:00
Dennis Lan
fcaf158494 Fix typo in src/upnp.c. 2016-10-12 13:35:39 +02:00
Vittorio G (VittGam)
9cbd3c2b5b tincctl: Avoid falling back to 1024 bits RSA key generation when an invalid key size is specified.
Also warn the user if a key smaller than 2048 bits is being generated.

Signed-off-by: Vittorio Gambaletta <openwrt@vittgam.net>
2016-10-11 20:30:41 +02:00
Vittorio G (VittGam)
c7c5c74d4a fsck: Fix ed25519 public key reading, and fclose usage.
Signed-off-by: Vittorio Gambaletta <openwrt@vittgam.net>
2016-10-11 13:30:05 +02:00
Guus Sliepen
e6497a23f7 Log warnings about dropped packets only with debug level 5 or higher. 2016-07-26 16:47:45 +02:00
Etienne Dechamps
2784a171ec Fix error handling when setting up the UDP socket.
Due to this typo, if tinc managed to set up the TCP socket but not the
UDP socket, it would continue anyway.

The regression was introduced in
6bc5d626a8.
2016-07-14 19:15:35 +01:00
Guus Sliepen
b1c29464b6 Fix compiling with OpenSSL < 1.1.0. 2016-06-24 11:22:24 +02:00
Guus Sliepen
9a9f6fac00 Add missing m4 files.
ax_cflags_warn_all.m4 depends on them.
2016-06-24 11:22:11 +02:00
Guus Sliepen
b9b0defaf4 Fix potential memory leaks found by the Clang static analyzer. 2016-06-23 15:59:43 +02:00
Guus Sliepen
49edf9c53a Fix warnings from the Clang static analyzer.
These are all false positives or harmless dead stores.
2016-06-23 15:59:16 +02:00
Guus Sliepen
e16ab7b899 Force nul-termination of strings after vsnprintf().
Apparently, on Windows this function might not always be properly
terminated.
2016-06-23 15:26:58 +02:00
Guus Sliepen
2de5d866b5 Use EVP_MD_CTX_destroy() instead of _free().
Thanks to azrdev for pointing out the build failure on Fedora 23.
2016-06-22 23:08:30 +02:00
Guus Sliepen
9b148fd844 Check return value of RSA_generate_key_ex(). 2016-06-22 17:42:25 +02:00
Guus Sliepen
172763f4af Add -Wall to CFLAGS. 2016-06-22 17:35:12 +02:00
Guus Sliepen
323c17e232 Ensure compatibility with OpenSSL 1.1.0. 2016-06-22 16:32:05 +02:00
Guus Sliepen
74eb4cc974 Fix the previous commit. 2016-06-05 15:20:57 +02:00
Guus Sliepen
ab13c14a14 Preserve IPv6 scope_id in edges.
When creating an edge after authenticating a peer, we copy the
address used for the TCP connection, but change the port to that used
for UDP. But the way we did it discarded the scope_id for IPv6
addresses. This prevented UDP communication from working correctly when
connecting to a peer on the same LAN using an IPv6 link-local address.

Thanks to Rafał Leśniak for pointing out this issue.
2016-06-05 14:47:21 +02:00
Sean McVeigh
e47fe48aed fix check in cmd_pid() for failure to connect to tincd 2016-05-21 17:38:14 -04:00
Sean McVeigh
4314df644e check for daemon pid existence before trying to connect to the control socket, and clean up stale files otherwise. 2016-05-21 17:25:18 -04:00
lemoer
9d0e86683c Added comments and unfold deep "if"-construct in timeout_handler 2016-05-21 12:54:02 +02:00
thorkill
5baecfd11b Prevent tincd from sending packets to unexpecting nodes
Make tincd recognize when it was asleep and close connections to it's
peers. This happens when e.g. RoadWarrior has been suspended for
"longer" time period. After resume, it will start to communicate
with it's peers using the contextes it had before suspend.

On the other side, the nodes closed the connections since PingTimeout
and/or TCP connection went down.

Sending data to such unaware (sptps mostly) nodes will cause
havoc in the logs. Misleading the developers to wrong assumptions
that something is wrong with sptps.

# Conflicts:
#	src/net.c
2016-05-19 15:58:29 +02:00
thorkill
0cf943753a Send PKT_PROBE only when handshake has been done already. 2016-05-12 11:20:41 +02:00
Guus Sliepen
0edef996a6 Releasing 1.1pre14. 2016-05-01 20:35:26 +02:00
Guus Sliepen
3f6c663a06 Revert "Remove tinc.service, it is not necessary."
This reverts commit 0b6f84f96e. Although
systemd does automatically provide a "tinc.slice" when there is only a
tinc@.service template, it doesn't quite work the same way as
tinc.service.
2016-05-01 12:07:44 +02:00
Guus Sliepen
0a6d89acc6 Releasing 1.1pre13. 2016-04-30 20:55:12 +02:00
Guus Sliepen
2055c3e21d AutoConnect now only chooses from nodes for which we know an address.
Based partially on work from Rafał Leśniak.
2016-04-30 20:11:55 +02:00
Guus Sliepen
0b6f84f96e Remove tinc.service, it is not necessary.
Thanks to Alexander Ried for pointing out that if you have
tinc@.service template, systemd will provide a default slice containing
all instances of that template. So "systemctl start tinc" will still do
what we want it to do.
2016-04-30 18:08:31 +02:00
Guus Sliepen
8377d0b856 Fix BSD tun device support.
This was broken by a botched merge from the master branch in commit d7f6737.
2016-04-27 20:30:36 +02:00
Guus Sliepen
390d25f0b8 Releasing 1.1pre12. 2016-04-24 13:23:06 +02:00
Guus Sliepen
5a7c6546a4 Don't check file permissions on Windows during fsck. 2016-04-23 21:39:53 +02:00
Guus Sliepen
83fa44ce42 Fix starting tinc as a service on Windows.
Don't assume tincd.exe is in the working directory, especially now that
chdir() is called very early. We use GetModuleFileName() instead.
2016-04-23 21:32:42 +02:00
Guus Sliepen
9a66d7499a Fix a compiler warning on Windows. 2016-04-23 21:32:29 +02:00
Guus Sliepen
ab5f4cbdc6 Fix possible read of freed memory when verifying the signature of a file. 2016-04-23 17:28:30 +02:00
Guus Sliepen
76955a6c8b Have "tinc fsck" recognize Ed25519PublicKey statements. 2016-04-23 17:20:08 +02:00
Guus Sliepen
6805b15731 Move documentation of invitations to the manual. 2016-04-23 16:28:12 +02:00
Guus Sliepen
51a0dc5145 Fix the "network" command in tinc shell. 2016-04-17 18:11:04 +02:00
Guus Sliepen
b6b302cee9 Speed up AutoConnect at startup.
Call periodic_handler() immediately at startup. Also, don't try to
connect to ourself.
2016-04-17 17:06:11 +02:00
Guus Sliepen
f934417aa6 Don't call terminate_connection(myself->connection).
It doesn't do anything except give a confusing error message that we are
closing the connection to ourself. Replace it with connection_del().
This also fixes a double free.
2016-04-17 16:25:13 +02:00
Guus Sliepen
2213ecaea5 Handle special characters in sptps_test only if the --special option is given.
sptps_test treats lines starting with #, ^ and $ specially, in order to
test the SPTPS protocol. However, this should only be done if explicitly
requested, otherwise it can unexpectedly fail.
2016-04-17 16:01:49 +02:00
Guus Sliepen
c2dc3784f1 Add stricter checks for netnames.
When passing a NetName via an invitation, we don't allow any characters
that are unsafe (either because they could cause shells to expand things,
or because they are not allowed on some filesystems).

Also, warn when tinc is started with unsafe netnames.
2016-04-17 14:38:37 +02:00
Guus Sliepen
097c69fc6a Use ifconfig_header(). 2016-04-17 14:36:29 +02:00
Guus Sliepen
af9ee7ff00 Chdir() to the configuration directory instead of /. 2016-04-17 14:04:57 +02:00
Guus Sliepen
9bd978cc8e Add a test for tinc-up creation from invitations. 2016-04-17 13:56:37 +02:00
Guus Sliepen
0b96b69672 Fix compiler warnings. 2016-04-17 13:55:36 +02:00