From: Guus Sliepen Date: Sat, 12 Jun 2021 15:58:58 +0000 (+0200) Subject: Drop support for meshlink_blacklist()/whitelist(). X-Git-Url: https://git.meshlink.io/?a=commitdiff_plain;h=ae661459191862c5c2abbf0722fdbc2523425b7d;p=meshlink-tiny Drop support for meshlink_blacklist()/whitelist(). Keep the internal tracking of the blacklist status of each node for now. --- diff --git a/src/meshlink++.h b/src/meshlink++.h index dc5412a..1fa7c7b 100644 --- a/src/meshlink++.h +++ b/src/meshlink++.h @@ -274,12 +274,6 @@ public: (void)meshlink_errno; } - /// This functions is called whenever MeshLink is blacklisted by another node. - virtual void blacklisted(node *peer) { - /* do nothing */ - (void)peer; - } - /// This functions is called whenever MeshLink a meta-connection attempt is made. virtual void connection_try(node *peer) { /* do nothing */ @@ -380,7 +374,6 @@ public: meshlink_set_node_duplicate_cb(handle, &node_duplicate_trampoline); meshlink_set_log_cb(handle, MESHLINK_DEBUG, &log_trampoline); meshlink_set_error_cb(handle, &error_trampoline); - meshlink_set_blacklisted_cb(handle, &blacklisted_trampoline); meshlink_set_channel_listen_cb(handle, &channel_listen_trampoline); meshlink_set_channel_accept_cb(handle, &channel_accept_trampoline); meshlink_set_connection_try_cb(handle, &connection_try_trampoline); @@ -438,17 +431,6 @@ public: return meshlink_get_node_reachability(handle, node, last_reachable, last_unreachable); } - /// Get a node's blacklist status. - /** This function returns the current blacklist status of a given node. - * - * @param node A pointer to a meshlink::node describing the node. - * - * @return This function returns true if the node is currently blacklisted, false otherwise. - */ - bool get_node_blacklisted(node *node) { - return meshlink_get_node_blacklisted(handle, node); - } - /// Get a handle for a specific submesh. /** This function returns a handle for the submesh with the given name. * @@ -483,22 +465,6 @@ public: return (node **)meshlink_get_all_nodes(handle, (meshlink_node_t **)nodes, nmemb); } - /// Get a list of all nodes by blacklist status. - /** This function returns a list with handles for all the nodes who were either blacklisted or whitelisted. - * - * @param blacklisted If true, a list of blacklisted nodes will be returned, otherwise whitelisted nodes. - * @param nodes A pointer to an array of pointers to meshlink::node, which should be allocated by the application. - * @param nmemb The maximum number of pointers that can be stored in the nodes array. - * - * @return A pointer to an array containing pointers to all known nodes with the given blacklist status. - * If the @a nodes argument was not NULL, then the return value can either be the same value or a different value. - * If it is a new value, the old value of @a nodes should not be used anymore. - * If the new value is NULL, then the old array will have been freed by MeshLink. - */ - node **get_all_nodes_by_blacklisted(bool blacklisted, node **nodes, size_t *nmemb) { - return (node **)meshlink_get_all_nodes_by_blacklisted(handle, blacklisted, (meshlink_node_t **)nodes, nmemb); - } - /// Sign data using the local node's MeshLink key. /** This function signs data using the local node's MeshLink key. * The generated signature can be securely verified by other nodes. @@ -677,7 +643,7 @@ public: /** This sets the policy MeshLink uses when it has new information about nodes. * By default, all udpates will be stored to disk (unless an ephemeral instance has been opened). * Setting the policy to MESHLINK_STORAGE_KEYS_ONLY, only updates that contain new keys for nodes - * are stored, as well as blacklist/whitelist settings. + * are stored. * By setting the policy to MESHLINK_STORAGE_DISABLED, no updates will be stored. * * @param policy The storage policy to use. @@ -752,64 +718,6 @@ public: return meshlink_forget_node(handle, node); } - /// Blacklist a node from the mesh. - /** This function causes the local node to blacklist another node. - * The local node will drop any existing connections to that node, - * and will not send data to it nor accept any data received from it any more. - * - * @param node A pointer to a meshlink::node describing the node to be blacklisted. - * - * @return This function returns true if the node has been whitelisted, false otherwise. - */ - bool blacklist(node *node) { - return meshlink_blacklist(handle, node); - } - - /// Blacklist a node from the mesh by name. - /** This function causes the local node to blacklist another node by name. - * The local node will drop any existing connections to that node, - * and will not send data to it nor accept any data received from it any more. - * - * If no node by the given name is known, it is created. - * - * @param name The name of the node to blacklist. - * - * @return This function returns true if the node has been blacklisted, false otherwise. - */ - bool blacklist_by_name(const char *name) { - return meshlink_blacklist_by_name(handle, name); - } - - /// Whitelist a node on the mesh. - /** This function causes the local node to whitelist another node. - * The local node will allow connections to and from that node, - * and will send data to it and accept any data received from it. - * - * @param node A pointer to a meshlink::node describing the node to be whitelisted. - * - * @return This function returns true if the node has been whitelisted, false otherwise. - */ - bool whitelist(node *node) { - return meshlink_whitelist(handle, node); - } - - /// Whitelist a node on the mesh by name. - /** This function causes the local node to whitelist a node by name. - * The local node will allow connections to and from that node, - * and will send data to it and accept any data received from it. - * - * If no node by the given name is known, it is created. - * This is useful if new nodes are blacklisted by default. - * - * \memberof meshlink_node - * @param name The name of the node to whitelist. - * - * @return This function returns true if the node has been whitelisted, false otherwise. - */ - bool whitelist_by_name(const char *name) { - return meshlink_whitelist_by_name(handle, name); - } - /// Set the poll callback. /** This functions sets the callback that is called whenever data can be sent to another node. * The callback is run in MeshLink's own thread. @@ -1243,15 +1151,6 @@ private: that->error(meshlink_errno); } - static void blacklisted_trampoline(meshlink_handle_t *handle, meshlink_node_t *peer) { - if(!(handle->priv)) { - return; - } - - meshlink::mesh *that = static_cast(handle->priv); - that->blacklisted(static_cast(peer)); - } - static void connection_try_trampoline(meshlink_handle_t *handle, meshlink_node_t *peer) { if(!(handle->priv)) { return; diff --git a/src/meshlink.c b/src/meshlink.c index 3941ff0..0d607fe 100644 --- a/src/meshlink.c +++ b/src/meshlink.c @@ -1974,22 +1974,6 @@ void meshlink_set_error_cb(struct meshlink_handle *mesh, meshlink_error_cb_t cb) pthread_mutex_unlock(&mesh->mutex); } -void meshlink_set_blacklisted_cb(struct meshlink_handle *mesh, meshlink_blacklisted_cb_t cb) { - logger(mesh, MESHLINK_DEBUG, "meshlink_set_blacklisted_cb(%p)", (void *)(intptr_t)cb); - - if(!mesh) { - meshlink_errno = MESHLINK_EINVAL; - return; - } - - if(pthread_mutex_lock(&mesh->mutex) != 0) { - abort(); - } - - mesh->blacklisted_cb = cb; - pthread_mutex_unlock(&mesh->mutex); -} - static bool prepare_packet(meshlink_handle_t *mesh, meshlink_node_t *destination, const void *data, size_t len, vpn_packet_t *packet) { meshlink_packethdr_t *hdr; @@ -2292,10 +2276,6 @@ static bool search_node_by_dev_class(const node_t *node, const void *condition) return false; } -static bool search_node_by_blacklisted(const node_t *node, const void *condition) { - return *(bool *)condition == node->status.blacklisted; -} - static bool search_node_by_submesh(const node_t *node, const void *condition) { if(condition == node->submesh) { return true; @@ -2358,15 +2338,6 @@ meshlink_node_t **meshlink_get_all_nodes_by_last_reachable(meshlink_handle_t *me return meshlink_get_all_nodes_by_condition(mesh, &range, nodes, nmemb, search_node_by_last_reachable); } -meshlink_node_t **meshlink_get_all_nodes_by_blacklisted(meshlink_handle_t *mesh, bool blacklisted, meshlink_node_t **nodes, size_t *nmemb) { - if(!mesh || !nmemb) { - meshlink_errno = MESHLINK_EINVAL; - return NULL; - } - - return meshlink_get_all_nodes_by_condition(mesh, &blacklisted, nodes, nmemb, search_node_by_blacklisted); -} - dev_class_t meshlink_get_node_dev_class(meshlink_handle_t *mesh, meshlink_node_t *node) { if(!mesh || !node) { meshlink_errno = MESHLINK_EINVAL; @@ -2386,28 +2357,6 @@ dev_class_t meshlink_get_node_dev_class(meshlink_handle_t *mesh, meshlink_node_t return devclass; } -bool meshlink_get_node_blacklisted(meshlink_handle_t *mesh, meshlink_node_t *node) { - if(!mesh) { - meshlink_errno = MESHLINK_EINVAL; - } - - if(!node) { - return mesh->default_blacklist; - } - - bool blacklisted; - - if(pthread_mutex_lock(&mesh->mutex) != 0) { - abort(); - } - - blacklisted = ((node_t *)node)->status.blacklisted; - - pthread_mutex_unlock(&mesh->mutex); - - return blacklisted; -} - meshlink_submesh_t *meshlink_get_node_submesh(meshlink_handle_t *mesh, meshlink_node_t *node) { if(!mesh || !node) { meshlink_errno = MESHLINK_EINVAL; @@ -3156,189 +3105,6 @@ bool meshlink_import(meshlink_handle_t *mesh, const char *data) { return true; } -static bool blacklist(meshlink_handle_t *mesh, node_t *n) { - if(n == mesh->self) { - logger(mesh, MESHLINK_ERROR, "%s blacklisting itself?\n", n->name); - meshlink_errno = MESHLINK_EINVAL; - return false; - } - - if(n->status.blacklisted) { - logger(mesh, MESHLINK_DEBUG, "Node %s already blacklisted\n", n->name); - return true; - } - - n->status.blacklisted = true; - - /* Immediately shut down any connections we have with the blacklisted node. - * We can't call terminate_connection(), because we might be called from a callback function. - */ - for list_each(connection_t, c, mesh->connections) { - if(c->node == n) { - if(c->status.active) { - send_error(mesh, c, BLACKLISTED, "blacklisted"); - } - - shutdown(c->socket, SHUT_RDWR); - } - } - - utcp_reset_all_connections(n->utcp); - - n->mtu = 0; - n->minmtu = 0; - n->maxmtu = MTU; - n->mtuprobes = 0; - n->status.udp_confirmed = false; - - if(n->status.reachable) { - n->last_unreachable = time(NULL); - } - - /* Graph updates will suppress status updates for blacklisted nodes, so we need to - * manually call the status callback if necessary. - */ - if(n->status.reachable && mesh->node_status_cb) { - mesh->node_status_cb(mesh, (meshlink_node_t *)n, false); - } - - return node_write_config(mesh, n, true) && config_sync(mesh, "current"); -} - -bool meshlink_blacklist(meshlink_handle_t *mesh, meshlink_node_t *node) { - logger(mesh, MESHLINK_DEBUG, "meshlink_blacklist(%s)", node ? node->name : "(null)"); - - if(!mesh || !node) { - meshlink_errno = MESHLINK_EINVAL; - return false; - } - - if(pthread_mutex_lock(&mesh->mutex) != 0) { - abort(); - } - - if(!blacklist(mesh, (node_t *)node)) { - pthread_mutex_unlock(&mesh->mutex); - return false; - } - - pthread_mutex_unlock(&mesh->mutex); - - logger(mesh, MESHLINK_DEBUG, "Blacklisted %s.\n", node->name); - return true; -} - -bool meshlink_blacklist_by_name(meshlink_handle_t *mesh, const char *name) { - logger(mesh, MESHLINK_DEBUG, "meshlink_blacklist_by_name(%s)", name ? name : "(null)"); - - if(!mesh || !name) { - meshlink_errno = MESHLINK_EINVAL; - return false; - } - - if(pthread_mutex_lock(&mesh->mutex) != 0) { - abort(); - } - - node_t *n = lookup_node(mesh, (char *)name); - - if(!n) { - n = new_node(); - n->name = xstrdup(name); - node_add(mesh, n); - } - - if(!blacklist(mesh, (node_t *)n)) { - pthread_mutex_unlock(&mesh->mutex); - return false; - } - - pthread_mutex_unlock(&mesh->mutex); - - logger(mesh, MESHLINK_DEBUG, "Blacklisted %s.\n", name); - return true; -} - -static bool whitelist(meshlink_handle_t *mesh, node_t *n) { - if(n == mesh->self) { - logger(mesh, MESHLINK_ERROR, "%s whitelisting itself?\n", n->name); - meshlink_errno = MESHLINK_EINVAL; - return false; - } - - if(!n->status.blacklisted) { - logger(mesh, MESHLINK_DEBUG, "Node %s was already whitelisted\n", n->name); - return true; - } - - n->status.blacklisted = false; - - if(n->status.reachable) { - n->last_reachable = time(NULL); - update_node_status(mesh, n); - } - - return node_write_config(mesh, n, true) && config_sync(mesh, "current"); -} - -bool meshlink_whitelist(meshlink_handle_t *mesh, meshlink_node_t *node) { - logger(mesh, MESHLINK_DEBUG, "meshlink_whitelist(%s)", node ? node->name : "(null)"); - - if(!mesh || !node) { - meshlink_errno = MESHLINK_EINVAL; - return false; - } - - if(pthread_mutex_lock(&mesh->mutex) != 0) { - abort(); - } - - if(!whitelist(mesh, (node_t *)node)) { - pthread_mutex_unlock(&mesh->mutex); - return false; - } - - pthread_mutex_unlock(&mesh->mutex); - - logger(mesh, MESHLINK_DEBUG, "Whitelisted %s.\n", node->name); - return true; -} - -bool meshlink_whitelist_by_name(meshlink_handle_t *mesh, const char *name) { - logger(mesh, MESHLINK_DEBUG, "meshlink_whitelist_by_name(%s)", name ? name : "(null)"); - - if(!mesh || !name) { - meshlink_errno = MESHLINK_EINVAL; - return false; - } - - if(pthread_mutex_lock(&mesh->mutex) != 0) { - abort(); - } - - node_t *n = lookup_node(mesh, (char *)name); - - if(!n) { - n = new_node(); - n->name = xstrdup(name); - node_add(mesh, n); - } - - if(!whitelist(mesh, (node_t *)n)) { - pthread_mutex_unlock(&mesh->mutex); - return false; - } - - pthread_mutex_unlock(&mesh->mutex); - - logger(mesh, MESHLINK_DEBUG, "Whitelisted %s.\n", name); - return true; -} - -void meshlink_set_default_blacklist(meshlink_handle_t *mesh, bool blacklist) { - mesh->default_blacklist = blacklist; -} - bool meshlink_forget_node(meshlink_handle_t *mesh, meshlink_node_t *node) { logger(mesh, MESHLINK_DEBUG, "meshlink_forget_node(%s)", node ? node->name : "(null)"); diff --git a/src/meshlink.h b/src/meshlink.h index 75ce60e..ea463a0 100644 --- a/src/meshlink.h +++ b/src/meshlink.h @@ -590,27 +590,6 @@ typedef void (*meshlink_error_cb_t)(struct meshlink_handle *mesh, meshlink_errno */ void meshlink_set_error_cb(struct meshlink_handle *mesh, meshlink_error_cb_t cb); -/// A callback for receiving blacklisted conditions encountered by the MeshLink thread. -/** @param mesh A handle which represents an instance of MeshLink, or NULL. - * @param node The node that blacklisted the local node. - */ -typedef void (*meshlink_blacklisted_cb_t)(struct meshlink_handle *mesh, struct meshlink_node *node); - -/// Set the blacklisted callback. -/** This functions sets the callback that is called whenever MeshLink detects that it is blacklisted by another node. - * - * The callback is run in MeshLink's own thread. - * It is important that the callback uses apprioriate methods (queues, pipes, locking, etc.) - * to hand the data over to the application's thread. - * The callback should also not block itself and return as quickly as possible. - * - * \memberof meshlink_handle - * @param mesh A handle which represents an instance of MeshLink, or NULL. - * @param cb A pointer to the function which will be called when a serious error is encountered. - * If a NULL pointer is given, the callback will be disabled. - */ -void meshlink_set_blacklisted_cb(struct meshlink_handle *mesh, meshlink_blacklisted_cb_t cb); - /// Send data to another node. /** This functions sends one packet of data to another node in the mesh. * The packet is sent using UDP semantics, which means that @@ -803,27 +782,6 @@ struct meshlink_node **meshlink_get_all_nodes_by_submesh(struct meshlink_handle */ struct meshlink_node **meshlink_get_all_nodes_by_last_reachable(struct meshlink_handle *mesh, time_t start, time_t end, struct meshlink_node **nodes, size_t *nmemb) __attribute__((__warn_unused_result__)); -/// Get the list of all nodes by blacklist status. -/** This function returns a list with handles for all the nodes who were either blacklisted or whitelisted. - * - * \memberof meshlink_handle - * @param mesh A handle which represents an instance of MeshLink. - * @param blacklisted If true, a list of blacklisted nodes will be returned, otherwise whitelisted nodes. - * @param nodes A pointer to a previously allocated array of pointers to struct meshlink_node, or NULL in which case MeshLink will allocate a new array. - * The application can supply an array it allocated itself with malloc, or the return value from the previous call to this function (which is the preferred way). - * The application is allowed to call free() on the array whenever it wishes. - * The pointers in the array are valid until meshlink_close() is called. - * @param nmemb A pointer to a variable holding the number of nodes that were reachable within the period given by @a start and @a end. - * In case the @a nodes argument is not NULL, MeshLink might call realloc() on the array to change its size. - * The contents of this variable will be changed to reflect the new size of the array. - * - * @return A pointer to an array containing pointers to all known nodes with the given blacklist status. - * If the @a nodes argument was not NULL, then the return value can either be the same value or a different value. - * If it is a new value, the old value of @a nodes should not be used anymore. - * If the new value is NULL, then the old array will have been freed by MeshLink. - */ -struct meshlink_node **meshlink_get_all_nodes_by_blacklisted(struct meshlink_handle *mesh, bool blacklisted, struct meshlink_node **nodes, size_t *nmemb) __attribute__((__warn_unused_result__)); - /// Get the node's device class. /** This function returns the device class of the given node. * @@ -835,17 +793,6 @@ struct meshlink_node **meshlink_get_all_nodes_by_blacklisted(struct meshlink_han */ dev_class_t meshlink_get_node_dev_class(struct meshlink_handle *mesh, struct meshlink_node *node) __attribute__((__warn_unused_result__)); -/// Get the node's blacklist status. -/** This function returns the given node is blacklisted. - * - * \memberof meshlink_node - * @param mesh A handle which represents an instance of MeshLink. - * @param node A pointer to a struct meshlink_node describing the node. - * - * @return This function returns true if the node is blacklisted, false otherwise. - */ -bool meshlink_get_node_blacklisted(struct meshlink_handle *mesh, struct meshlink_node *node) __attribute__((__warn_unused_result__)); - /// Get the node's submesh handle. /** This function returns the submesh handle of the given node. * @@ -1129,76 +1076,6 @@ bool meshlink_import(struct meshlink_handle *mesh, const char *data) __attribute */ bool meshlink_forget_node(struct meshlink_handle *mesh, struct meshlink_node *node); -/// Blacklist a node from the mesh. -/** This function causes the local node to blacklist another node. - * The local node will drop any existing connections to that node, - * and will not send data to it nor accept any data received from it any more. - * - * \memberof meshlink_node - * @param mesh A handle which represents an instance of MeshLink. - * @param node A pointer to a struct meshlink_node describing the node to be blacklisted. - * - * @return This function returns true if the node has been blacklisted, false otherwise. - */ -bool meshlink_blacklist(struct meshlink_handle *mesh, struct meshlink_node *node) __attribute__((__warn_unused_result__)); - -/// Blacklist a node from the mesh by name. -/** This function causes the local node to blacklist another node by name. - * The local node will drop any existing connections to that node, - * and will not send data to it nor accept any data received from it any more. - * - * If no node by the given name is known, it is created. - * - * \memberof meshlink_node - * @param mesh A handle which represents an instance of MeshLink. - * @param name The name of the node to blacklist. - * - * @return This function returns true if the node has been blacklisted, false otherwise. - */ -bool meshlink_blacklist_by_name(struct meshlink_handle *mesh, const char *name) __attribute__((__warn_unused_result__)); - -/// Whitelist a node on the mesh. -/** This function causes the local node to whitelist a previously blacklisted node. - * The local node will allow connections to and from that node, - * and will send data to it and accept any data received from it. - * - * \memberof meshlink_node - * @param mesh A handle which represents an instance of MeshLink. - * @param node A pointer to a struct meshlink_node describing the node to be whitelisted. - * - * @return This function returns true if the node has been whitelisted, false otherwise. - */ -bool meshlink_whitelist(struct meshlink_handle *mesh, struct meshlink_node *node) __attribute__((__warn_unused_result__)); - -/// Whitelist a node on the mesh by name. -/** This function causes the local node to whitelist a node by name. - * The local node will allow connections to and from that node, - * and will send data to it and accept any data received from it. - * - * If no node by the given name is known, it is created. - * This is useful if new nodes are blacklisted by default. - * - * \memberof meshlink_node - * @param mesh A handle which represents an instance of MeshLink. - * @param name The name of the node to whitelist. - * - * @return This function returns true if the node has been whitelisted, false otherwise. - */ -bool meshlink_whitelist_by_name(struct meshlink_handle *mesh, const char *name) __attribute__((__warn_unused_result__)); - -/// Set whether new nodes are blacklisted by default. -/** This function sets the blacklist behaviour for newly discovered nodes. - * If set to true, new nodes will be automatically blacklisted. - * If set to false, which is the default, new nodes are automatically whitelisted. - * The whitelist/blacklist status of a node may be changed afterwards with the - * meshlink_whitelist() and meshlink_blacklist() functions. - * - * \memberof meshlink_handle - * @param mesh A handle which represents an instance of MeshLink. - * @param blacklist True if new nodes are to be blacklisted, false if whitelisted. - */ -void meshlink_set_default_blacklist(struct meshlink_handle *mesh, bool blacklist); - /// A callback for listening for incoming channels. /** This function is called whenever a remote node wants to open a channel to the local node. * This callback should only make a decision whether to accept or reject this channel. @@ -1780,7 +1657,7 @@ void meshlink_set_scheduling_granularity(struct meshlink_handle *mesh, long gran /** This sets the policy MeshLink uses when it has new information about nodes. * By default, all udpates will be stored to disk (unless an ephemeral instance has been opened). * Setting the policy to MESHLINK_STORAGE_KEYS_ONLY, only updates that contain new keys for nodes - * are stored, as well as blacklist/whitelist settings. + * are stored. * By setting the policy to MESHLINK_STORAGE_DISABLED, no updates will be stored. * * \memberof meshlink_handle diff --git a/src/meshlink.sym b/src/meshlink.sym index 245e254..acb8525 100644 --- a/src/meshlink.sym +++ b/src/meshlink.sym @@ -10,8 +10,6 @@ devtool_set_inviter_commits_first devtool_trybind_probe meshlink_add_address meshlink_add_external_address -meshlink_blacklist -meshlink_blacklist_by_name meshlink_channel_abort meshlink_channel_aio_fd_receive meshlink_channel_aio_fd_send @@ -36,7 +34,6 @@ meshlink_errno meshlink_export meshlink_forget_node meshlink_get_all_nodes -meshlink_get_all_nodes_by_blacklisted meshlink_get_all_nodes_by_dev_class meshlink_get_all_nodes_by_last_reachable meshlink_get_all_nodes_by_submesh @@ -45,7 +42,6 @@ meshlink_get_external_address_for_family meshlink_get_fingerprint meshlink_get_local_address_for_family meshlink_get_node -meshlink_get_node_blacklisted meshlink_get_node_dev_class meshlink_get_node_reachability meshlink_get_node_submesh @@ -70,7 +66,6 @@ meshlink_open_params_set_storage_key meshlink_open_params_set_storage_policy meshlink_reset_timers meshlink_send -meshlink_set_blacklisted_cb meshlink_set_canonical_address meshlink_set_channel_accept_cb meshlink_set_channel_flags @@ -82,7 +77,6 @@ meshlink_set_channel_receive_cb meshlink_set_channel_sndbuf meshlink_set_channel_sndbuf_storage meshlink_set_connection_try_cb -meshlink_set_default_blacklist meshlink_set_dev_class_fast_retry_period meshlink_set_dev_class_maxtimeout meshlink_set_dev_class_timeouts @@ -104,5 +98,3 @@ meshlink_set_storage_policy meshlink_strerror meshlink_submesh_open meshlink_verify -meshlink_whitelist -meshlink_whitelist_by_name diff --git a/src/meshlink_internal.h b/src/meshlink_internal.h index 2934925..17ff9d9 100644 --- a/src/meshlink_internal.h +++ b/src/meshlink_internal.h @@ -139,7 +139,6 @@ struct meshlink_handle { meshlink_node_duplicate_cb_t node_duplicate_cb; meshlink_connection_try_cb_t connection_try_cb; meshlink_error_cb_t error_cb; - meshlink_blacklisted_cb_t blacklisted_cb; // Mesh parameters char *appname; @@ -155,7 +154,6 @@ struct meshlink_handle { int netns; - bool default_blacklist; bool inviter_commits_first; // Configuration diff --git a/src/protocol_edge.c b/src/protocol_edge.c index a2ab267..aa1a648 100644 --- a/src/protocol_edge.c +++ b/src/protocol_edge.c @@ -144,7 +144,7 @@ bool add_edge_h(meshlink_handle_t *mesh, connection_t *c, const char *request) { if(!from) { from = new_node(); from->status.dirty = true; - from->status.blacklisted = mesh->default_blacklist; + from->status.blacklisted = false; from->name = xstrdup(from_name); from->devclass = from_devclass; @@ -172,7 +172,7 @@ bool add_edge_h(meshlink_handle_t *mesh, connection_t *c, const char *request) { if(!to) { to = new_node(); to->status.dirty = true; - to->status.blacklisted = mesh->default_blacklist; + to->status.blacklisted = false; to->name = xstrdup(to_name); to->devclass = to_devclass; diff --git a/src/protocol_misc.c b/src/protocol_misc.c index 7410ad1..0fbb520 100644 --- a/src/protocol_misc.c +++ b/src/protocol_misc.c @@ -70,13 +70,6 @@ bool error_h(meshlink_handle_t *mesh, connection_t *c, const char *request) { logger(mesh, MESHLINK_INFO, "Error message from %s: %d: %s", c->name, err, errorstring); - switch(err) { - case BLACKLISTED: - if(mesh->blacklisted_cb) { - mesh->blacklisted_cb(mesh, (meshlink_node_t *)lookup_node(mesh, c->name)); - } - } - return false; } diff --git a/test/Makefile.am b/test/Makefile.am index c0b4838..56f6a3e 100644 --- a/test/Makefile.am +++ b/test/Makefile.am @@ -1,7 +1,6 @@ TESTS = \ basic \ basicpp \ - blacklist \ channels \ channels-aio \ channels-aio-abort \ @@ -43,7 +42,6 @@ check_PROGRAMS = \ api_set_node_status_cb \ basic \ basicpp \ - blacklist \ channels \ channels-aio \ channels-aio-abort \ @@ -82,9 +80,6 @@ basic_LDADD = $(top_builddir)/src/libmeshlink.la basicpp_SOURCES = basicpp.cpp utils.c utils.h basicpp_LDADD = $(top_builddir)/src/libmeshlink.la -blacklist_SOURCES = blacklist.c utils.c utils.h -blacklist_LDADD = $(top_builddir)/src/libmeshlink.la - channels_SOURCES = channels.c utils.c utils.h channels_LDADD = $(top_builddir)/src/libmeshlink.la diff --git a/test/duplicate.c b/test/duplicate.c index df9f86b..a5b85bb 100644 --- a/test/duplicate.c +++ b/test/duplicate.c @@ -15,7 +15,6 @@ static struct sync_flag duplicate_detected; static void handle_duplicate(meshlink_handle_t *mesh, meshlink_node_t *node) { set_sync_flag(&duplicate_detected, true); - assert(meshlink_blacklist(mesh, node)); } int main(void) {