Commit graph

143 commits

Author SHA1 Message Date
Guus Sliepen
4c30004cb6 Avoid calling time(NULL).
In most cases we can use the cached time.
2013-03-08 14:11:15 +01:00
Guus Sliepen
f9ab8e266b Flush output buffers in the tap reader thread on Windows.
This is basically a port of commit 50fcfea1 to 1.1.
2013-03-01 17:37:56 +01:00
Guus Sliepen
3847b78ba5 Fix compiler warnings on Windows. 2013-02-20 15:34:55 +01:00
Guus Sliepen
079dcd0179 Don't send proxy requests for incoming connections. 2013-02-07 14:22:28 +01:00
Guus Sliepen
053af97c9e Check for writability when waiting for a socket to finish connecting.
We were checking only for readability, which is not a problem for normal
connections, since the server side of a connection will always send an ID
request. But when using a proxy, the proxy server doesn't send anything before
the client, so tinc would not see that its connection to the proxy had already
been established.
2013-02-06 15:12:53 +01:00
Guus Sliepen
cc3c69c892 Releasing 1.1pre5. 2013-01-20 21:03:22 +01:00
Guus Sliepen
94587264bd Allow connections via UNIX sockets.
This is mainly useful for control connections. The client must still present
the control cookie from the PID file.
2013-01-17 18:12:55 +01:00
Guus Sliepen
f5bb64b36a Move make_names() and related variables to its own source file. 2013-01-17 16:39:02 +01:00
Guus Sliepen
6bc5d626a8 Drop libevent and use our own event handling again.
There are several reasons for this:

- MacOS/X doesn't support polling the tap device using kqueue, requiring a
  workaround to fall back to select().
- On Windows only sockets are properly handled, therefore tinc uses a second
  thread that does a blocking ReadFile() on the TAP-Win32/64 device. However,
  this does not mix well with libevent.
- Libevent, event just the core, is quite large, and although it is easy to get
  and install on many platforms, it can be a burden.
- Libev is more lightweight and seems technically superior, but it doesn't
  abstract away all the platform differences (for example, async events are not
  supported on Windows).
2012-11-29 12:28:23 +01:00
Guus Sliepen
edc08b73a9 Slightly randomize all timeouts. 2012-10-21 17:45:16 +02:00
Guus Sliepen
3254e75afe Fix a few compiler errors/warnings. 2012-10-14 19:21:13 +02:00
Guus Sliepen
d917c8cb6b Fix whitespace. 2012-10-10 17:17:49 +02:00
Guus Sliepen
d1ec010660 Fix memory leaks found by valgrind. 2012-10-09 16:27:28 +02:00
Guus Sliepen
b346338f9c Remove unused variables, fix some #includes. 2012-10-09 13:28:09 +02:00
Guus Sliepen
0b8b23e0dd C99 extravaganza. 2012-10-08 00:35:38 +02:00
Guus Sliepen
ff306f0cda Replace the connection_tree with a connection_list.
The tree functions were never used on the connection_tree, a list is more appropriate.
Also be more paranoid about connections disappearing while traversing the list.
2012-10-07 21:59:53 +02:00
Guus Sliepen
ce059e36fd Refactor outgoing connection handling.
Struct outgoing_ts and connection_ts were depending too much on each other,
causing lots of problems, especially the reuse of a connection_t. Now, whenever
a connection is closed it is immediately removed from the list of connections
and destroyed.
2012-10-07 21:02:40 +02:00
Guus Sliepen
b99af2f813 Useful error messages when writing to a meta connection fails. 2012-10-07 11:45:54 +02:00
Guus Sliepen
c5325ffdd1 Correctly add/remove outgoing connections when reloading configuration. 2012-09-28 17:05:01 +02:00
Guus Sliepen
e9de08be0d Remove newlines at end of log messages. 2012-09-04 14:21:50 +02:00
Guus Sliepen
19be9cf715 Merge branch 'master' of git://tinc-vpn.org/tinc into 1.1
Conflicts:
	NEWS
	README
	configure.in
	lib/utils.c
	src/linux/device.c
	src/meta.c
	src/net.h
	src/net_setup.c
	src/net_socket.c
	src/protocol.c
	src/protocol_auth.c
	src/tincd.c
2012-06-26 13:24:20 +02:00
Guus Sliepen
0a84f9cb8f Fix compiler warnings. 2012-06-25 19:01:51 +02:00
Guus Sliepen
c0af4c37d2 Small fixes in proxy code. 2012-06-25 15:00:24 +02:00
Guus Sliepen
5ae19cb0bb Add support for proxying through an external command.
Proxy type "exec" can be used to have an external script or binary set
up an outgoing connection. Standard input and output will be used to
exchange data with the external command. The variables REMOTEADDRESS and
REMOTEPORT are set to the intended destination address and port.
2012-04-19 15:18:31 +02:00
Guus Sliepen
b58d95eb29 Add basic support for SOCKS 4 and HTTP CONNECT proxies.
When the Proxy option is used, outgoing connections will be made via the
specified proxy. There is no support for authentication methods or for having
the proxy forward incoming connections, and there is no attempt to proxy UDP.
2012-04-18 23:19:40 +02:00
Guus Sliepen
8ac096b5bf Allow log messages to be captured by tincctl.
This allows tincctl to receive log messages from a running tincd,
independent of what is logged to syslog or to file. Tincctl can receive
debug messages with an arbitrary level.
2012-02-26 18:37:36 +01:00
Guus Sliepen
f5dc136cfd Merge branch 'master' of git://tinc-vpn.org/tinc into 1.1
Conflicts:
	src/net.c
	src/net_packet.c
	src/net_socket.c
2012-02-23 13:26:01 +01:00
Guus Sliepen
5a28aa7b8b Add LocalDiscovery option which tries to detect peers on the local network.
Currently, this is implemented by sending IPv4 broadcast packets to the
LAN during path MTU discovery.
2012-02-22 23:17:43 +01:00
Guus Sliepen
3fba80174d Merge branch 'master' of git://tinc-vpn.org/tinc into 1.1
Conflicts:
	NEWS
	README
	configure.in
	doc/tincd.8.in
	src/Makefile.am
	src/bsd/device.c
	src/connection.c
	src/connection.h
	src/cygwin/device.c
	src/device.h
	src/dropin.h
	src/linux/device.c
	src/mingw/device.c
	src/net.c
	src/net_packet.c
	src/net_setup.c
	src/net_socket.c
	src/process.c
	src/protocol.c
	src/protocol_key.c
	src/raw_socket_device.c
	src/route.c
	src/solaris/device.c
	src/tincd.c
	src/uml_device.c
2012-02-22 14:23:59 +01:00
Guus Sliepen
cff5a844a3 Don't bind outgoing TCP sockets anymore.
The code introduced in commit 41a05f59ba is not
needed anymore, since tinc has been able to handle UDP packets from a different
source address than those of the TCP packets since 1.0.10.  When using multiple
BindToAddress statements, this code does not make sense anymore, we do want the
kernel to choose the source address on its own.
2012-02-20 16:52:53 +01:00
Guus Sliepen
708314df2f Set FD_CLOEXEC flag on all sockets.
Scripts called by tinc would inherit its open filedescriptors. This could
be a problem if other long-running daemons are started from those scripts,
if those daemons would not close all filedescriptors before going into the
background.

Problem found and solution suggested by Nick Hibma.
2012-02-17 16:13:38 +01:00
Guus Sliepen
5989a29d7b Fix format strings for Windows.
Windows doesn't like %zd, so cast (s)size_t to int. Also, some shorts were
incorrectly printed with %d instead of %hd.
2011-06-03 00:46:56 +02:00
Guus Sliepen
3ade33bfac Use send() when writing to sockets, and the return type is ssize_t. 2011-06-03 00:34:30 +02:00
Guus Sliepen
af2e0c9a32 Remove unused functions and variables. 2011-06-02 17:57:53 +02:00
Sven-Haegar Koch
04de15984f do_outgoing_connection() may delete a failed connection, and the structure
must not be accessed afterwards.
2011-05-29 22:05:14 +02:00
Sven-Haegar Koch
82109868b5 src/net_socket.c bind_to_address(): Use after free in error path. 2011-05-29 22:05:04 +02:00
Guus Sliepen
6d08eb1614 Fix sparse warnings and add an extra sprinkling of const.
This is more or less the equivalent of Sven-Haegar Koch's fixes in the 1.1
branch.
2011-05-28 23:36:52 +02:00
Sven-Haegar Koch
d772289f6d sparse fixup: warning: symbol '...' was not declared. Should it be static? 2011-05-28 15:24:39 +02:00
Guus Sliepen
8ddcad5fa1 Check if an event is initialized before calling event_del().
Libevent prints a warning to stderr if we do that.
2011-05-22 13:24:01 +02:00
Guus Sliepen
cdb793f687 Remove use of bufferevent and eventbuffers, use our own buffering instead. 2011-05-14 19:20:56 +02:00
Guus Sliepen
886a6f61a1 Merge branch 'master' into 1.1
Conflicts:
	src/net_packet.c
	src/openssl/rsagen.h
	src/protocol_auth.c
	src/protocol_key.c
2010-11-19 12:22:48 +00:00
Guus Sliepen
a9445e38f2 Fix warning message when setting SO_RCVBUF or SO_SNDBUF fails. 2010-11-13 21:34:59 +01:00
Brandon L Black
8dfe1b374e Configurable SO_RCVBUF/SO_SNDBUF for the UDP socket 2010-11-13 21:25:44 +01:00
Guus Sliepen
a22041922f 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
2010-11-12 16:15:29 +01:00
Guus Sliepen
f5122ccece Fix all warnings when compiling with mingw64. 2010-05-01 15:39:59 +02:00
Sven-Haegar Koch
0310deb225 Demote all LOG_EMERG to LOG_ERR, spamming all xterms is bad. 2010-03-31 05:06:33 +02:00
Sven-Haegar Koch
103543aa2c Merge branch 'master' into 1.1
Conflicts:
	NEWS
	README
	configure.in
	have.h
	src/conf.c
	src/conf.h
	src/net.c
	src/net_packet.c
	src/protocol_key.c
	src/protocol_subnet.c
	src/route.c
	src/tincd.c
2010-03-26 16:51:03 +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
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