From: Guus Sliepen Date: Mon, 29 May 2000 23:40:05 +0000 (+0000) Subject: Only activate a connection upon receiving it's public key if it's an X-Git-Tag: import-tinc-1.1~865 X-Git-Url: https://git.meshlink.io/?a=commitdiff_plain;h=a7ad161d2b115b6a2a69c5dc8ddd33008d3562d0;p=meshlink Only activate a connection upon receiving it's public key if it's an incoming connection. When it's outgoing, we need to receive an ack first. --- diff --git a/src/net.c b/src/net.c index 66496cc6..71836a70 100644 --- a/src/net.c +++ b/src/net.c @@ -17,7 +17,7 @@ along with this program; if not, write to the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - $Id: net.c,v 1.31 2000/05/29 22:20:04 zarq Exp $ + $Id: net.c,v 1.32 2000/05/29 23:40:05 guus Exp $ */ #include "config.h" @@ -973,7 +973,7 @@ cp { if(sscanf(cl->buffer, "%d", &request) == 1) { - if((request < 0 || request > 255) || request_handlers[request] == NULL) + if((request < 0) || (request > 255) || (request_handlers[request] == NULL)) { syslog(LOG_ERR, _("Unknown request: %s"), cl->buffer); return -1; diff --git a/src/protocol.c b/src/protocol.c index f0b7cb9f..0385c9c0 100644 --- a/src/protocol.c +++ b/src/protocol.c @@ -17,7 +17,7 @@ along with this program; if not, write to the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - $Id: protocol.c,v 1.26 2000/05/29 21:01:25 zarq Exp $ + $Id: protocol.c,v 1.27 2000/05/29 23:40:05 guus Exp $ */ #include "config.h" @@ -451,19 +451,21 @@ cp if(cl->status.outgoing) send_public_key(cl); else - send_ack(cl); + { + send_ack(cl); - /* Okay, before we active the connection, we check if there is another entry - in the connection list with the same vpn_ip. If so, it presumably is an - old connection that has timed out but we don't know it yet. Because our - conn_list entry is not active, lookup_conn will skip ourself. */ + /* Okay, before we active the connection, we check if there is another entry + in the connection list with the same vpn_ip. If so, it presumably is an + old connection that has timed out but we don't know it yet. Because our + conn_list entry is not active, lookup_conn will skip ourself. */ - while(old=lookup_conn(cl->vpn_ip)) - terminate_connection(old); + while(old=lookup_conn(cl->vpn_ip)) + terminate_connection(old); - cl->status.active = 1; - notify_others(cl, NULL, send_add_host); - notify_one(cl); + cl->status.active = 1; + notify_others(cl, NULL, send_add_host); + notify_one(cl); + } cp return 0; }