+ pthread_mutex_unlock(&mesh->mutex);
+}
+
+meshlink_submesh_t **devtool_get_all_submeshes(meshlink_handle_t *mesh, meshlink_submesh_t **submeshes, size_t *nmemb) {
+ if(!mesh || !nmemb || (*nmemb && !submeshes)) {
+ meshlink_errno = MESHLINK_EINVAL;
+ return NULL;
+ }
+
+ meshlink_submesh_t **result;
+
+ //lock mesh->nodes
+ pthread_mutex_lock(&mesh->mutex);
+
+ *nmemb = mesh->submeshes->count;
+ result = realloc(submeshes, *nmemb * sizeof(*submeshes));
+
+ if(result) {
+ meshlink_submesh_t **p = result;
+
+ for list_each(submesh_t, s, mesh->submeshes) {
+ *p++ = (meshlink_submesh_t *)s;
+ }
+ } else {
+ *nmemb = 0;
+ free(submeshes);
+ meshlink_errno = MESHLINK_ENOMEM;
+ }
+
+ pthread_mutex_unlock(&mesh->mutex);
+
+ return result;
+}
+
+meshlink_handle_t *devtool_open_in_netns(const char *confbase, const char *name, const char *appname, dev_class_t devclass, int netns) {
+ meshlink_open_params_t *params = meshlink_open_params_init(confbase, name, appname, devclass);
+ params->netns = dup(netns);
+ meshlink_handle_t *handle;
+
+ if(params->netns == -1) {
+ handle = NULL;
+ meshlink_errno = MESHLINK_EINVAL;
+ } else {
+ handle = meshlink_open_ex(params);
+ }
+
+ meshlink_open_params_free(params);
+
+ return handle;
+}
+
+void devtool_force_sptps_renewal(meshlink_handle_t *mesh, meshlink_node_t *node) {
+ if(!mesh || !node) {
+ meshlink_errno = MESHLINK_EINVAL;
+ return;
+ }
+
+ node_t *n = (node_t *)node;
+ connection_t *c = n->connection;
+
+ n->last_req_key = -3600;
+
+ if(c) {
+ c->last_key_renewal = -3600;
+ }