X-Git-Url: https://tinc-vpn.org/git/browse?a=blobdiff_plain;f=src%2Fcontrol.c;h=c166943ba59a607aa0ba8a85198ef68303167bc6;hb=d917c8cb6b69475d568ccbe82389b9f2b3eb5e80;hp=d074ebbafa7005bca163de4ff1460124ca2f5fda;hpb=8ac096b5bf9da1b3961a3ac4a03d083629222a63;p=tinc diff --git a/src/control.c b/src/control.c index d074ebba..c166943b 100644 --- a/src/control.c +++ b/src/control.c @@ -29,7 +29,6 @@ #include "netutl.h" #include "protocol.h" #include "route.h" -#include "splay_tree.h" #include "utils.h" #include "xalloc.h" @@ -44,7 +43,7 @@ static bool control_ok(connection_t *c, int type) { return control_return(c, type, 0); } -bool control_h(connection_t *c, char *request) { +bool control_h(connection_t *c, const char *request) { int type; if(!c->status.control || c->allow_request != CONTROL) { @@ -64,7 +63,7 @@ bool control_h(connection_t *c, char *request) { case REQ_DUMP_NODES: return dump_nodes(c); - + case REQ_DUMP_EDGES: return dump_edges(c); @@ -99,16 +98,12 @@ bool control_h(connection_t *c, char *request) { case REQ_DISCONNECT: { char name[MAX_STRING_SIZE]; - connection_t *other; - splay_node_t *node, *next; bool found = false; if(sscanf(request, "%*d %*d " MAX_STRING, name) != 1) return control_return(c, REQ_DISCONNECT, -1); - for(node = connection_tree->head; node; node = next) { - next = node->next; - other = node->data; + for list_each(connection_t, other, connection_list) { if(strcmp(other->name, name)) continue; terminate_connection(other, other->status.active);