]> git.meshlink.io Git - meshlink/log
meshlink
6 years agoPass appname in the ID string.
Guus Sliepen [Tue, 3 Jul 2018 18:21:40 +0000 (20:21 +0200)]
Pass appname in the ID string.

This is completely ignored by MeshLink itself at the moment, but is just
a hint to any proxy/relay.

6 years agoRemove old host config files when joining using an invitation.
Guus Sliepen [Tue, 26 Jun 2018 15:10:53 +0000 (17:10 +0200)]
Remove old host config files when joining using an invitation.

6 years agoAdd meshlink_set_invitation_timeout().
Guus Sliepen [Tue, 26 Jun 2018 14:42:57 +0000 (16:42 +0200)]
Add meshlink_set_invitation_timeout().

This sets a global timeout for invitation files. If a node tries to join
with an invitation whose file is older than the timeout, the invitation is
rejected.

6 years agoFix a compiler warning.
Guus Sliepen [Tue, 26 Jun 2018 14:33:29 +0000 (16:33 +0200)]
Fix a compiler warning.

6 years agoAdd meshlink_set_canonical_address().
Guus Sliepen [Tue, 26 Jun 2018 14:12:28 +0000 (16:12 +0200)]
Add meshlink_set_canonical_address().

This introduces the concept of a canonical address for a node, which is
its "official" address/port. It is only set manually, and never updated
or removed when other addresses have been discovered for this node.

Also, this changed meshlink_add_address(mesh, address) to be equivalent to
meshlink_set_canonical_address(mesh, meshlink_get_self(mesh), address, NULL).
While not strictly equivalent to the old behaviour, it matches the
documented intent of this function.

6 years agoFix valgrind warnings about reading uninitialized bytes.
Guus Sliepen [Tue, 26 Jun 2018 14:09:54 +0000 (16:09 +0200)]
Fix valgrind warnings about reading uninitialized bytes.

This is caused by memcpy()ing sockaddr_t structs that have only been
partially written to.

6 years agoUpdate .gitignore files.
Guus Sliepen [Tue, 26 Jun 2018 14:07:35 +0000 (16:07 +0200)]
Update .gitignore files.

6 years agoFix a potential segfault when closing a stopped meshlink handle.
Guus Sliepen [Tue, 26 Jun 2018 12:23:04 +0000 (14:23 +0200)]
Fix a potential segfault when closing a stopped meshlink handle.

If meshlink_stop() was called before meshlink_close(), the latter would
cause pthread_join() being called on a thread that was already joined.

6 years agoFix a potential segfault when closing a meshlink handle.
Guus Sliepen [Tue, 26 Jun 2018 12:20:17 +0000 (14:20 +0200)]
Fix a potential segfault when closing a meshlink handle.

Freeing the UTCP instance of a node would result in meshlink_send() being
called on a node that was already partially freed.

6 years agoDon't allow any unused variables in invitation files.
Guus Sliepen [Thu, 21 Jun 2018 13:26:10 +0000 (15:26 +0200)]
Don't allow any unused variables in invitation files.

6 years agoCode reformatting.
Guus Sliepen [Tue, 5 Jun 2018 18:33:08 +0000 (20:33 +0200)]
Code reformatting.

6 years agoFix a potential NULL-pointer dereference when generating invitations.
Guus Sliepen [Tue, 5 Jun 2018 18:31:04 +0000 (20:31 +0200)]
Fix a potential NULL-pointer dereference when generating invitations.

Closes #47 on GitHub.

6 years agoUse getsockname() to get a listening sockets actual address in meshlink_stop().
Guus Sliepen [Mon, 21 May 2018 20:03:47 +0000 (22:03 +0200)]
Use getsockname() to get a listening sockets actual address in meshlink_stop().

This should be better than sending a packet to the listening address,
which might be a link-local address for which a valid scope-id is
necessary, and which might not be in listen_socket.sa.

6 years agoEnsure -export-symbols-regex is not lost.
Guus Sliepen [Tue, 8 May 2018 15:05:00 +0000 (17:05 +0200)]
Ensure -export-symbols-regex is not lost.

An earlier commit accidentily caused libmeshlink_la_LDFLAGS to be
overwritten later in src/Makefile.am, and this caused
-export-symbols-regex to be dropped, thereby exposing internal symbols
of the library.

6 years agoEnable Catta by default, as documented.
Guus Sliepen [Sun, 6 May 2018 21:08:24 +0000 (23:08 +0200)]
Enable Catta by default, as documented.

6 years agoTry to be smarter generating invitation URLs.
Guus Sliepen [Sun, 6 May 2018 20:46:36 +0000 (22:46 +0200)]
Try to be smarter generating invitation URLs.

If we have a symbol hostname associated with us, use that. Otherwise, try
to find out which external addresses we have for both IPv4 and IPv6. If we
cannot connect to www.meshlink.io, then use the local address used for
outgoing connections as a fallback. Also, don't forget to add a port number
in all cases.

The generated invitation URL can now contain two addresses in the hostname
part, separated by a comma.

6 years agoAllow multiple addresses in an invitation URL.
Guus Sliepen [Thu, 3 May 2018 20:33:58 +0000 (22:33 +0200)]
Allow multiple addresses in an invitation URL.

This allows the address field in an invitation URL to be a
comma-separated list. The goal is to allow both IPv4 and IPv6 addresses
to be encoded in a single URL.

This commit also ensures that if a hostname is given, that all address
records associated with that hostname are tried.

6 years agoFix all compiler warnings found using -Wall -W -pedantic.
Guus Sliepen [Tue, 1 May 2018 13:24:35 +0000 (15:24 +0200)]
Fix all compiler warnings found using -Wall -W -pedantic.

Using both GCC 8 and Clang 7.

6 years agoCheck the return value of check_port().
Guus Sliepen [Tue, 1 May 2018 12:10:45 +0000 (14:10 +0200)]
Check the return value of check_port().

When initializing a new MeshLink instance, fail if there is no port
available for listening. When starting an already configured instance,
if no Port statement is found in the local node's host config file,
select and add a new one.

6 years agoOnly set -fno-strict-overflow if -fwrapv is not available.
Guus Sliepen [Mon, 30 Apr 2018 19:06:51 +0000 (21:06 +0200)]
Only set -fno-strict-overflow if -fwrapv is not available.

When -fwrapv is set, -fno-strict-overflow has no effect. Clang then
decides to give an obnoxious warning.

6 years agoUse AX_PTHREAD to set the proper pthread flags.
Guus Sliepen [Mon, 30 Apr 2018 19:01:44 +0000 (21:01 +0200)]
Use AX_PTHREAD to set the proper pthread flags.

6 years agoDon't use SOL_IP and SOL_IPV6.
Guus Sliepen [Sat, 16 Dec 2017 21:38:48 +0000 (22:38 +0100)]
Don't use SOL_IP and SOL_IPV6.

These macros do not exist on all platforms, instead one should use
IPPROTO_IP and IPPROTO_IPV6. This fixes a bug on macOS where the
IPV6_V6ONLY flag would not be applied and could result in IPv4 sockets
not working.

7 years agodevtools.h must not rely on internal types.
Guus Sliepen [Thu, 9 Nov 2017 19:13:07 +0000 (20:13 +0100)]
devtools.h must not rely on internal types.

7 years agoProperly initialize mesh->outpacketqueue.
Guus Sliepen [Thu, 9 Nov 2017 19:12:29 +0000 (20:12 +0100)]
Properly initialize mesh->outpacketqueue.

7 years agoAdd a devtool function to query the status of a given node.
Guus Sliepen [Mon, 9 Oct 2017 19:47:52 +0000 (21:47 +0200)]
Add a devtool function to query the status of a given node.

7 years agoRemove PROXY_EXEC support.
Guus Sliepen [Sun, 8 Oct 2017 18:27:30 +0000 (20:27 +0200)]
Remove PROXY_EXEC support.

This calls fork(), which is not desirable from a library.

7 years agoEnsure make distcheck runs without errors.
Guus Sliepen [Sun, 8 Oct 2017 18:22:56 +0000 (20:22 +0200)]
Ensure make distcheck runs without errors.

7 years agoRemove unused/obsolete checks from configure.ac and unused functions from dropin.c.
Guus Sliepen [Sun, 8 Oct 2017 15:11:19 +0000 (17:11 +0200)]
Remove unused/obsolete checks from configure.ac and unused functions from dropin.c.

7 years agoFormat the examples and test suite.
Guus Sliepen [Mon, 2 Oct 2017 21:07:34 +0000 (23:07 +0200)]
Format the examples and test suite.

7 years agoUpdate astylerc and reformat the code.
Guus Sliepen [Mon, 2 Oct 2017 20:58:49 +0000 (22:58 +0200)]
Update astylerc and reformat the code.

Changes:

- Add braces to one-line if/else statements.
- Add empty lines around control blocks.
- Indent multi-line #defines with tabs.

7 years agoFix compiling with -Wall -W.
Guus Sliepen [Mon, 2 Oct 2017 20:25:19 +0000 (22:25 +0200)]
Fix compiling with -Wall -W.

7 years agoAdd an --enable-install-tests option to configure.
Guus Sliepen [Thu, 7 Sep 2017 18:46:52 +0000 (20:46 +0200)]
Add an --enable-install-tests option to configure.

This will enable the installation of the test binaries when running
make install. This feature is intended to make continuous integration
easier.

7 years agoAutomatically configure and compile catta.
Guus Sliepen [Thu, 7 Sep 2017 18:32:04 +0000 (20:32 +0200)]
Automatically configure and compile catta.

7 years agoReally bind to a free port if the configured port is not available.
Guus Sliepen [Wed, 16 Aug 2017 20:10:47 +0000 (22:10 +0200)]
Really bind to a free port if the configured port is not available.

7 years agoMake member variables in public structs more const.
Guus Sliepen [Wed, 16 Aug 2017 17:48:43 +0000 (19:48 +0200)]
Make member variables in public structs more const.

7 years agoCheck that autoconnect works as expected.
Guus Sliepen [Tue, 15 Aug 2017 19:00:44 +0000 (21:00 +0200)]
Check that autoconnect works as expected.

7 years agoMove meshlink_get_all_edges_state() to devtools_get_all_edges().
Guus Sliepen [Tue, 15 Aug 2017 18:59:38 +0000 (20:59 +0200)]
Move meshlink_get_all_edges_state() to devtools_get_all_edges().

There should be no reason for the application to query the list of edges,
so move this functionality to devtools.[ch].

Also, flatten the array to reduce the amount of memory allocations and
bookkeeping necessary.

7 years agoFix errors found by Clang's static analyzer.
Guus Sliepen [Mon, 14 Aug 2017 20:42:14 +0000 (22:42 +0200)]
Fix errors found by Clang's static analyzer.

7 years agoFix compiler warnings.
Guus Sliepen [Mon, 14 Aug 2017 20:31:31 +0000 (22:31 +0200)]
Fix compiler warnings.

7 years agoForce -Wall.
Guus Sliepen [Mon, 14 Aug 2017 20:31:04 +0000 (22:31 +0200)]
Force -Wall.

AM_INIT_AUTOMAKE should ensure -Wall is set, but for some reason it doesn't.
Force it by adding it to AM_CPPFLAGS.

7 years agoRemove unused/duplicate autoconf/automake definitions.
Guus Sliepen [Mon, 14 Aug 2017 20:30:14 +0000 (22:30 +0200)]
Remove unused/duplicate autoconf/automake definitions.

7 years agoGet rid of ->hostname.
Guus Sliepen [Mon, 14 Aug 2017 20:29:06 +0000 (22:29 +0200)]
Get rid of ->hostname.

This takes up memory and is only used for logging.

7 years agoRemember recently used addresses of other nodes.
Guus Sliepen [Mon, 14 Aug 2017 19:24:57 +0000 (21:24 +0200)]
Remember recently used addresses of other nodes.

7 years agoOnly keep at most 5 Address hints.
Guus Sliepen [Mon, 14 Aug 2017 19:23:50 +0000 (21:23 +0200)]
Only keep at most 5 Address hints.

7 years agoClose meta-connections in meshlink_stop().
Guus Sliepen [Mon, 14 Aug 2017 19:22:43 +0000 (21:22 +0200)]
Close meta-connections in meshlink_stop().

If we stop MeshLink for an extended time, we don't want to have open
sockets lying around that we don't take care of. Terminate all of them.

7 years agoAdd a test for a constellation of three nodes.
Guus Sliepen [Mon, 14 Aug 2017 19:19:41 +0000 (21:19 +0200)]
Add a test for a constellation of three nodes.

In particular, test whether two nodes that have been introduced to each
other via a third node can still continue to communicate with each other
when the third node goes offline.

7 years agoDon't install the example programs.
Guus Sliepen [Mon, 14 Aug 2017 17:35:49 +0000 (19:35 +0200)]
Don't install the example programs.

7 years agoDon't build SPTPS test programs.
Guus Sliepen [Mon, 14 Aug 2017 17:29:03 +0000 (19:29 +0200)]
Don't build SPTPS test programs.

7 years agoTest cornercases of MeshLink channels.
Guus Sliepen [Sun, 13 Aug 2017 21:08:56 +0000 (23:08 +0200)]
Test cornercases of MeshLink channels.

- Ensure we can open a channel before starting MeshLink.
- Check that opening channels to a peer that has unregistered its accept
  callback will not result in the poll callback to be called with a non-
  zero length.

7 years agoAdd utility functions to create paired MeshLink instances.
Guus Sliepen [Sun, 13 Aug 2017 21:07:25 +0000 (23:07 +0200)]
Add utility functions to create paired MeshLink instances.

This also adds a start_meshlink_pair() function which starts the two instances
and waits for them to establish a connection with each other. A condition
variable is used to avoid having to poll.

7 years agoDon't accept channels if we set channel_accept_cb to NULL.
Guus Sliepen [Sun, 13 Aug 2017 20:53:23 +0000 (22:53 +0200)]
Don't accept channels if we set channel_accept_cb to NULL.

7 years agoProperly destroy unclosed channels at meshlink_close() time.
Guus Sliepen [Sun, 13 Aug 2017 19:53:55 +0000 (21:53 +0200)]
Properly destroy unclosed channels at meshlink_close() time.

7 years agoReset UTCP timers after a succesful key exchange.
Guus Sliepen [Sun, 13 Aug 2017 15:51:28 +0000 (17:51 +0200)]
Reset UTCP timers after a succesful key exchange.

The problem is that MeshLink does key exchange with peers on-demand. One
has to start a channel for key exchange to be initiated, but it also tries
to send the first SYN packet immediately. This will not work, and then it
has to wait for the retransmit timer to expire before it will try to send
the SYN again. Since the retransmit timer is increased exponentially, this
can potentially take a long time. So when key exchange is finished, we now
force a reset of the timers of all UTCP connections with the peer.

7 years agoEnforce spaces around operators.
Guus Sliepen [Sun, 13 Aug 2017 13:14:27 +0000 (15:14 +0200)]
Enforce spaces around operators.

7 years agoConvert sizeof foo to sizeof(foo).
Guus Sliepen [Sun, 13 Aug 2017 13:06:51 +0000 (15:06 +0200)]
Convert sizeof foo to sizeof(foo).

While technically sizeof is an operator and doesn't need the parentheses
around expressions it operates on, except if they are type names, code
formatters don't seem to handle this very well.

7 years agoRemove hack to wait for a valid key.
Guus Sliepen [Sun, 13 Aug 2017 12:57:29 +0000 (14:57 +0200)]
Remove hack to wait for a valid key.

This was obviously only necessary because the missing retransmits of SYN
packets. Now, if a channel is opened before we have finished the key
exchange with the peer, UTCP will retry after a second.

7 years agoAllow Catta to be disabled.
Guus Sliepen [Sun, 13 Aug 2017 12:53:51 +0000 (14:53 +0200)]
Allow Catta to be disabled.

Normally, we want to enable Catta, however for testing it produces a lot
of unwanted network packets and log messages.

7 years agoDrop dependency on zlib.
Guus Sliepen [Thu, 27 Jul 2017 13:06:17 +0000 (15:06 +0200)]
Drop dependency on zlib.

It's not used, since nothing in the code enables compression. If the
application wants to use compression, it should perform this itself.

7 years agoEnable silent build rules.
Guus Sliepen [Thu, 27 Jul 2017 13:00:55 +0000 (15:00 +0200)]
Enable silent build rules.

7 years agoUpdate all header guards.
Guus Sliepen [Thu, 27 Jul 2017 12:58:13 +0000 (14:58 +0200)]
Update all header guards.

Don't start with underscores, as those are reserved for system
libraries. Make sure all start with MESHLINK_, and that they appear at
the top of the file.

7 years agoAdd an astylerc file and reformat all code.
Guus Sliepen [Thu, 27 Jul 2017 12:26:47 +0000 (14:26 +0200)]
Add an astylerc file and reformat all code.

This allows astyle to be used as a pre-commit hook.

7 years agoRemove avahi submodule.
Guus Sliepen [Thu, 27 Jul 2017 09:38:35 +0000 (11:38 +0200)]
Remove avahi submodule.

7 years agoUse new version of UTCP which also return errors via the poll callback.
Guus Sliepen [Thu, 27 Jul 2017 09:27:58 +0000 (11:27 +0200)]
Use new version of UTCP which also return errors via the poll callback.

7 years agoDon't call abort() when no channel receive callback is set.
Guus Sliepen [Thu, 27 Jul 2017 09:03:09 +0000 (11:03 +0200)]
Don't call abort() when no channel receive callback is set.

7 years agoIf binding to the configured port fails, ask the OS to provide a port.
Guus Sliepen [Thu, 27 Jul 2017 08:50:23 +0000 (10:50 +0200)]
If binding to the configured port fails, ask the OS to provide a port.

This will still allow MeshLink to make outgoing connections to other
nodes.

7 years agoCall srand() at startup.
Guus Sliepen [Thu, 27 Jul 2017 08:38:50 +0000 (10:38 +0200)]
Call srand() at startup.

7 years agoRestart the mesh after a failed join() in the other examples as well.
Guus Sliepen [Thu, 6 Jul 2017 20:08:37 +0000 (22:08 +0200)]
Restart the mesh after a failed join() in the other examples as well.

7 years agoRestart the mesh even after a failed join().
Guus Sliepen [Thu, 6 Jul 2017 20:04:00 +0000 (22:04 +0200)]
Restart the mesh even after a failed join().

7 years agoSet a timeout of 5 seconds on sockets in meshlink_join() and get_external_address().
Guus Sliepen [Thu, 6 Jul 2017 20:00:34 +0000 (22:00 +0200)]
Set a timeout of 5 seconds on sockets in meshlink_join() and get_external_address().

7 years agoDocument that meshlink_join() and meshlink_get_external_address() are blocking.
Guus Sliepen [Thu, 6 Jul 2017 19:59:17 +0000 (21:59 +0200)]
Document that meshlink_join() and meshlink_get_external_address() are blocking.

7 years agoAdd meshlink_channel_open_ex().
Guus Sliepen [Mon, 3 Jul 2017 21:36:45 +0000 (23:36 +0200)]
Add meshlink_channel_open_ex().

This allows flags to be passed to the underlying UTCP connection, which
determines what kind of connection semantics to use.

7 years agoAllow '-' in node names.
Guus Sliepen [Sat, 1 Jul 2017 09:05:55 +0000 (11:05 +0200)]
Allow '-' in node names.

This allows URL-safe base64 encoding to be used in node names.

7 years agoEnsure consistent use of SPTPS session labels.
Guus Sliepen [Sun, 25 Jun 2017 18:54:12 +0000 (20:54 +0200)]
Ensure consistent use of SPTPS session labels.

7 years agoFix meshlink_stop() calling pthread_mutex_lock() twice.
Guus Sliepen [Sun, 25 Jun 2017 16:29:17 +0000 (18:29 +0200)]
Fix meshlink_stop() calling pthread_mutex_lock() twice.

7 years agoRemove debug messages incorrectly marked as warnings.
Guus Sliepen [Sun, 25 Jun 2017 15:12:42 +0000 (17:12 +0200)]
Remove debug messages incorrectly marked as warnings.

7 years agoUpdate the C++ header file.
Guus Sliepen [Fri, 11 Mar 2016 15:17:00 +0000 (16:17 +0100)]
Update the C++ header file.

7 years agoAdd the meshlink_get_port() and meshlink_set_port() functions.
Guus Sliepen [Fri, 11 Mar 2016 15:10:55 +0000 (16:10 +0100)]
Add the meshlink_get_port() and meshlink_set_port() functions.

The latter can be used to change the port on which MeshLink
listens. It may only be called when the mesh is not running.

7 years agoAdd modify_config_file() to allow overwriting existing configuration values.
Guus Sliepen [Fri, 11 Mar 2016 15:01:24 +0000 (16:01 +0100)]
Add modify_config_file() to allow overwriting existing configuration values.

7 years agoFix processing of mixed ID and SPTPS data.
Guus Sliepen [Sun, 25 Jun 2017 14:32:15 +0000 (16:32 +0200)]
Fix processing of mixed ID and SPTPS data.

When making a connection with another peer, the ID message and the first
SPTPS data is sent using separate send() calls, but they can be merged
along the way to the other side. When receiving the ID message, we
accidentily discarded the rest of the received packet. Handle this
properly.

The problem was found to trigger much more often on Linux kernel 4.4 in
KVM.

7 years agoAdd meshlink_get_external_address() and meshlink_add_external_address().
Guus Sliepen [Fri, 11 Mar 2016 11:08:48 +0000 (12:08 +0100)]
Add meshlink_get_external_address() and meshlink_add_external_address().

These functions try to discover the local node's external address by
contacting the meshlink.io server. The get function just returns the
discovered address as a string, the add function adds it as an Address,
so it will end up in the list of addresses when calling
meshlink_export().

7 years agoUse free_known_addresses() to free memory allocated by get_known_addresses().
Guus Sliepen [Thu, 17 Dec 2015 17:44:21 +0000 (18:44 +0100)]
Use free_known_addresses() to free memory allocated by get_known_addresses().

We know what struct addrinfo looks like, but the standard says nothing about
how it is allocated. So we cannot trust freeaddrinfo() to work correctly on
the struct addrinfo list we allocated ourselves in get_known_addresses().
To make a distinction by allocations from the latter and from str2addrinfo(),
we keep two pointers (*ai and *aip) in struct outgoing, and use the freeing
function that is appropriate for each.

7 years agoFix resource leaks found by cppcheck.
Guus Sliepen [Sun, 15 Nov 2015 16:18:37 +0000 (17:18 +0100)]
Fix resource leaks found by cppcheck.

7 years agoMake repeated calls to meshlink_start() without meshlink_stop() safe.
Guus Sliepen [Fri, 13 Nov 2015 08:51:39 +0000 (08:51 +0000)]
Make repeated calls to meshlink_start() without meshlink_stop() safe.

7 years agoFix race condition when calling meshlink_stop() immediately after meshlink_start().
Guus Sliepen [Fri, 13 Nov 2015 08:50:45 +0000 (08:50 +0000)]
Fix race condition when calling meshlink_stop() immediately after meshlink_start().

The event loop didn't react to event_loop_stop() if it wasn't started yet
(because that is done in mesh->thread). The solution is to add a
event_loop_start() function that is to be called by meshlink_start().

7 years agoSend a UDP packet to ourself instead of doing a dummy connect().
Guus Sliepen [Sat, 7 Nov 2015 22:48:37 +0000 (22:48 +0000)]
Send a UDP packet to ourself instead of doing a dummy connect().

This is simpler, hopefully with less chance of failing.

7 years agoFix check for succesful opening of UDP ports.
Guus Sliepen [Sat, 7 Nov 2015 22:24:48 +0000 (22:24 +0000)]
Fix check for succesful opening of UDP ports.

7 years agoFix meshlink_stop() on Mac OS X.
Guus Sliepen [Fri, 6 Nov 2015 22:33:58 +0000 (23:33 +0100)]
Fix meshlink_stop() on Mac OS X.

Mac OS X doesn't like shutdown(SHUT_RDWR) on listening sockets, and also
doesn't allow reopening a listening socket right after closing the
previous one on the same port. So avoid the whole business of closing
and reopening sockets by stopping the event loop and then doing a dummy
connect() to ourself to ensure select() in the network thread returns
immediately.

# Conflicts:
# src/meshlink.c

7 years agomeshlink_start() now fails when the listening socket could not be opened.
Guus Sliepen [Fri, 6 Nov 2015 21:56:34 +0000 (22:56 +0100)]
meshlink_start() now fails when the listening socket could not be opened.

7 years agoLibtool wants AM_PROG_AR.
Guus Sliepen [Fri, 6 Nov 2015 21:53:57 +0000 (22:53 +0100)]
Libtool wants AM_PROG_AR.

7 years agoAdd meshlink_get_self().
Guus Sliepen [Wed, 28 Oct 2015 21:57:49 +0000 (22:57 +0100)]
Add meshlink_get_self().

This returns a handle for the local node. This can also be used to determine
our own name using meshlink_get_self(mesh)->name.

7 years agoFix the basicpp test.
Guus Sliepen [Wed, 28 Oct 2015 21:06:52 +0000 (22:06 +0100)]
Fix the basicpp test.

7 years agoAdd a function to destroy a MeshLink instance.
Guus Sliepen [Wed, 28 Oct 2015 21:06:21 +0000 (22:06 +0100)]
Add a function to destroy a MeshLink instance.

This will remove all configuration files related to a MeshLink instance.

7 years agoFix incorrect SPTPS session labels.
Guus Sliepen [Mon, 26 Oct 2015 22:06:53 +0000 (23:06 +0100)]
Fix incorrect SPTPS session labels.

To prevent a MITM from being able to splice different SPTPS sessions
together, each session has a unique label. snprintf() was used to fill a
buffer with the label, however the buffer was not big enough for the whole
label. Linux made sure the last byte of the buffer was a NUL character,
Windows did not, resulting in the two unable to connect to each other.

7 years agoDouble the default size of the replay window in SPTPS.
Guus Sliepen [Thu, 15 Oct 2015 11:27:18 +0000 (13:27 +0200)]
Double the default size of the replay window in SPTPS.

7 years agoRemove unused replay window and RTT/bandwidth estimation code.
Guus Sliepen [Thu, 15 Oct 2015 11:26:31 +0000 (13:26 +0200)]
Remove unused replay window and RTT/bandwidth estimation code.

The replay window handling is done by SPTPS. The replaywin member of node_t
was not used at all. Somehwat related, there was RTT and bandwidth
estimation code that didn't work anymore and is not used anyway.

7 years agoDetermine the local node's address(es) and add them to its host config file.
Guus Sliepen [Tue, 13 Oct 2015 12:14:08 +0000 (14:14 +0200)]
Determine the local node's address(es) and add them to its host config file.

Use the "UDP connect() to an external IP address" trick to determine the
local node's addresses in a platform independent way, without sending any
actual packets. Do this at meshlink_open() time, so the application has
immediate access to them when calling meshlink_export().

7 years agoDon't append duplicate entries to configuration files.
Guus Sliepen [Tue, 13 Oct 2015 12:12:13 +0000 (14:12 +0200)]
Don't append duplicate entries to configuration files.

Automatically detected addresses are appended to host config files by
Catta. However, it doesn't check whether the address is already known.
Have append_config_file() check that it doesn't write duplicate entries.

7 years agoFix a memory leak when retrying outgoing connections.
Guus Sliepen [Fri, 9 Oct 2015 20:47:55 +0000 (22:47 +0200)]
Fix a memory leak when retrying outgoing connections.

When retry_outgoing_handler() calls setup_outgoing_connection(), it can
be that the old configuration is still in memory. So clean that up
before reading in new configuration data.

7 years agoIgnore address hints for our local node.
Guus Sliepen [Wed, 21 Jun 2017 20:57:34 +0000 (22:57 +0200)]
Ignore address hints for our local node.

Catta also sees itself, which causes MeshLink to add address hints for
its own node. That causes link-local addresses to be added. When calling
meshlink_invite(), the first link-local address would then be used for
the invitation URL, which is not desirable.

9 years agofix for autoconnect (prevent ping pong)
Niklas Hofmann [Sat, 27 Dec 2014 14:02:33 +0000 (15:02 +0100)]
fix for autoconnect (prevent ping pong)