]> git.meshlink.io Git - meshlink/log
meshlink
5 years agoAdd autoconf checks for LXC and cmocka.
Guus Sliepen [Sun, 18 Nov 2018 14:15:13 +0000 (15:15 +0100)]
Add autoconf checks for LXC and cmocka.

If LXC or cmocka are not installed, don't build the blackbox test suite.

5 years agoAdd the blackbox channel connection tests.
Guus Sliepen [Sun, 18 Nov 2018 13:50:08 +0000 (14:50 +0100)]
Add the blackbox channel connection tests.

5 years agoAdd the blackbox container based test suite.
Elear Solutions Dev [Thu, 8 Nov 2018 20:01:10 +0000 (21:01 +0100)]
Add the blackbox container based test suite.

This test suite uses LXC containers to simulate various nodes connected
to each other in different network topologies, and allows for realistic
testing of the MeshLink library.

6 years agoReally add both local and external address to the invitation URL.
Guus Sliepen [Tue, 9 Oct 2018 21:27:05 +0000 (23:27 +0200)]
Really add both local and external address to the invitation URL.

Also make sure we add both IPv4 and IPv6 if possible, use numeric addresses
unless hostnames resolve back to the same numeric address.

Add meshlink_invite_ex() that takes a flag that makes URL generation more
configurable.

6 years agoReformat the code.
Guus Sliepen [Tue, 9 Oct 2018 14:08:20 +0000 (16:08 +0200)]
Reformat the code.

6 years agoAdd an example using curses to monitor the state of MeshLink.
Guus Sliepen [Tue, 9 Oct 2018 14:06:50 +0000 (16:06 +0200)]
Add an example using curses to monitor the state of MeshLink.

6 years agoLock meshlink.conf to ensure only one instance can run at a time.
Guus Sliepen [Tue, 9 Oct 2018 12:06:04 +0000 (14:06 +0200)]
Lock meshlink.conf to ensure only one instance can run at a time.

6 years agoFix "Connection from (null)" log message.
Guus Sliepen [Thu, 30 Aug 2018 17:52:18 +0000 (19:52 +0200)]
Fix "Connection from (null)" log message.

6 years agoAlways add both CanonicalAddress and any local address to the invitation URL.
Guus Sliepen [Thu, 30 Aug 2018 17:45:13 +0000 (19:45 +0200)]
Always add both CanonicalAddress and any local address to the invitation URL.

We don't know in advance if the invitee will be on the LAN or outside
the LAN, and because hairpin routing is not working on many home
routers, it is safer to add all possible addresses.

Also, add the port number to each individual address in the URL, instead
of allowing only one port number.

6 years agoAdd missing code for the duplicate node testcase.
Guus Sliepen [Thu, 30 Aug 2018 17:44:08 +0000 (19:44 +0200)]
Add missing code for the duplicate node testcase.

6 years agoAdd duplicate node detection callback.
Guus Sliepen [Sun, 12 Aug 2018 15:09:20 +0000 (17:09 +0200)]
Add duplicate node detection callback.

MeshLink can detect if two nodes are online simultaneously using the same
Name. Normally, one or both of the duplicate nodes will terminate its
connection. Now there is a duplicate node callback that will be called when
the local node detects a duplicate node. One use for this is to blacklist
the duplicate node and/or notify the user of the problem.

6 years agoRemove the -fPIE and -pie compiler flags.
Guus Sliepen [Tue, 7 Aug 2018 18:43:19 +0000 (20:43 +0200)]
Remove the -fPIE and -pie compiler flags.

Since we are building a library, these flags shouldn't be used. They
appear to cause problems when linking libmeshlink into another shared
library.

6 years agoUpdate UTCP to allow meshlink_channel_send() immediately.
Guus Sliepen [Sun, 22 Jul 2018 11:32:01 +0000 (13:32 +0200)]
Update UTCP to allow meshlink_channel_send() immediately.

6 years agoAllow compiling without support for Catta.
Guus Sliepen [Sat, 21 Jul 2018 15:52:07 +0000 (17:52 +0200)]
Allow compiling without support for Catta.

Configuring with --disable-catta will cause MeshLink to not be linked to
the Catta library, and local discovery will not be available.

6 years agoAdd COPYING.README, detailing license obligations for users of MeshLink.
Guus Sliepen [Sat, 21 Jul 2018 15:10:35 +0000 (17:10 +0200)]
Add COPYING.README, detailing license obligations for users of MeshLink.

MeshLink itself depends on other libraries, and this document mainly
summarizes what obligations users of the MeshLink library have when they
distribute their software in binary form.

6 years agoPass appname in the ID string during invitations as well.
Guus Sliepen [Sun, 15 Jul 2018 09:19:19 +0000 (11:19 +0200)]
Pass appname in the ID string during invitations as well.

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.

6 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.

6 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().