From: Guus Sliepen Date: Wed, 21 Jun 2017 20:57:34 +0000 (+0200) Subject: Ignore address hints for our local node. X-Git-Url: https://git.meshlink.io/?a=commitdiff_plain;h=19e3a59047f31fc9143d09c3ef151f25d7d60452;p=meshlink 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. --- diff --git a/src/meshlink.c b/src/meshlink.c index 994d8957..addb4900 100644 --- a/src/meshlink.c +++ b/src/meshlink.c @@ -1,6 +1,6 @@ /* meshlink.c -- Implementation of the MeshLink API. - Copyright (C) 2014 Guus Sliepen + Copyright (C) 2014, 2017 Guus Sliepen This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -1834,6 +1834,10 @@ void meshlink_set_default_blacklist(meshlink_handle_t *mesh, bool blacklist) { void meshlink_hint_address(meshlink_handle_t *mesh, meshlink_node_t *node, const struct sockaddr *addr) { if(!mesh || !node || !addr) return; + + // Ignore hints about ourself. + if((node_t *)node == mesh->self) + return; pthread_mutex_lock(&(mesh->mesh_mutex));