X-Git-Url: https://tinc-vpn.org/git/browse?a=blobdiff_plain;f=src%2Fprotocol.c;h=e866e3165ef19f3e3c29686365d024dff6e03e7f;hb=e49891e188f618a0e98f1d30bcbf240286e8ad5c;hp=ac4b767ea5d10d50672a39df51f7667c4db2b552;hpb=108b238915c5f58b3d94ab433dc5d04e064c2b11;p=tinc diff --git a/src/protocol.c b/src/protocol.c index ac4b767e..e866e316 100644 --- a/src/protocol.c +++ b/src/protocol.c @@ -29,6 +29,7 @@ #include "xalloc.h" bool tunnelserver = false; +bool strictsubnets = false; /* Jumptable for the request handlers */ @@ -38,7 +39,7 @@ static bool (*request_handlers[])(connection_t *, char *) = { ping_h, pong_h, add_subnet_h, del_subnet_h, add_edge_h, del_edge_h, - key_changed_h, req_key_h, ans_key_h, tcppacket_h, + key_changed_h, req_key_h, ans_key_h, tcppacket_h, control_h, }; /* Request names */ @@ -48,7 +49,7 @@ static char (*request_name[]) = { "STATUS", "ERROR", "TERMREQ", "PING", "PONG", "ADD_SUBNET", "DEL_SUBNET", - "ADD_EDGE", "DEL_EDGE", "KEY_CHANGED", "REQ_KEY", "ANS_KEY", "PACKET", + "ADD_EDGE", "DEL_EDGE", "KEY_CHANGED", "REQ_KEY", "ANS_KEY", "PACKET", "CONTROL", }; static splay_tree_t *past_request_tree; @@ -102,6 +103,7 @@ bool send_request(connection_t *c, const char *format, ...) { } void forward_request(connection_t *from, char *request) { + /* Note: request is not zero terminated anymore after a call to this function! */ ifdebug(PROTOCOL) { ifdebug(META) logger(LOG_DEBUG, "Forwarding %s from %s (%s): %s", @@ -112,7 +114,7 @@ void forward_request(connection_t *from, char *request) { } int len = strlen(request); - request[len] = '\n'; + request[len++] = '\n'; broadcast_meta(from, request, len); }