projects
/
tinc
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Using alloca() for a constant sized buffer is very silly.
[tinc]
/
src
/
control.c
diff --git
a/src/control.c
b/src/control.c
index
d074ebb
..
c166943
100644
(file)
--- a/
src/control.c
+++ b/
src/control.c
@@
-29,7
+29,6
@@
#include "netutl.h"
#include "protocol.h"
#include "route.h"
#include "netutl.h"
#include "protocol.h"
#include "route.h"
-#include "splay_tree.h"
#include "utils.h"
#include "xalloc.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);
}
return control_return(c, type, 0);
}
-bool control_h(connection_t *c, char *request) {
+bool control_h(connection_t *c, c
onst c
har *request) {
int type;
if(!c->status.control || c->allow_request != CONTROL) {
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_NODES:
return dump_nodes(c);
-
+
case REQ_DUMP_EDGES:
return dump_edges(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];
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);
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);
if(strcmp(other->name, name))
continue;
terminate_connection(other, other->status.active);