X-Git-Url: https://www.tinc-vpn.org/git/browse?p=tinc;a=blobdiff_plain;f=src%2Fprotocol_edge.c;h=a13a096a9f62dc1d98cae5e1cff9bcc1237303df;hp=d6b55b014d404ba0276d72097ba1ffeb3b50d4bc;hb=627f7c22b447bd464b536cd016278545674df93d;hpb=d6b70ed6f8b7ed65f64193fcfcdb6c8f4625e03c diff --git a/src/protocol_edge.c b/src/protocol_edge.c index d6b55b01..a13a096a 100644 --- a/src/protocol_edge.c +++ b/src/protocol_edge.c @@ -1,7 +1,7 @@ /* protocol_edge.c -- handle the meta-protocol, edges - Copyright (C) 1999-2002 Ivo Timmermans , - 2000-2002 Guus Sliepen + Copyright (C) 1999-2002 Ivo Timmermans , + 2000-2002 Guus Sliepen This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -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_edge.c,v 1.1.4.5 2002/03/22 12:41:54 guus Exp $ + $Id: protocol_edge.c,v 1.1.4.8 2002/06/21 10:11:19 guus Exp $ */ #include "config.h" @@ -51,20 +51,14 @@ int send_add_edge(connection_t *c, edge_t *e) char *from_udpaddress, *from_udpport; char *to_udpaddress, *to_udpport; cp -// sockaddr2str(&e->from.tcpaddress, &from_tcpaddress, &from_tcpport); sockaddr2str(&e->from.udpaddress, &from_udpaddress, &from_udpport); -// sockaddr2str(&e->to.tcpaddress, &to_tcpaddress, &to_tcpport); sockaddr2str(&e->to.udpaddress, &to_udpaddress, &to_udpport); x = send_request(c, "%d %lx %s %s %s %s %s %s %lx %d", ADD_EDGE, random(), e->from.node->name, from_udpaddress, from_udpport, e->to.node->name, to_udpaddress, to_udpport, e->options, e->weight); -// free(from_tcpaddress); -// free(from_tcpport); free(from_udpaddress); free(from_udpport); -// free(to_tcpaddress); -// free(to_tcpport); free(to_udpaddress); free(to_udpport); cp @@ -79,10 +73,8 @@ int add_edge_h(connection_t *c) char from_name[MAX_STRING_SIZE]; char to_name[MAX_STRING_SIZE]; char from_address[MAX_STRING_SIZE]; -// char from_tcpport[MAX_STRING_SIZE]; char from_udpport[MAX_STRING_SIZE]; char to_address[MAX_STRING_SIZE]; -// char to_tcpport[MAX_STRING_SIZE]; char to_udpport[MAX_STRING_SIZE]; sockaddr_t from_udpaddress; sockaddr_t to_udpaddress; @@ -90,7 +82,7 @@ int add_edge_h(connection_t *c) int weight; avl_node_t *node; cp - if(sscanf(c->buffer, "%*d %*lx "MAX_STRING" "MAX_STRING" "MAX_STRING" "MAX_STRING" "MAX_STRING" "MAX_STRING" %lx %d", + if(sscanf(c->buffer, "%*d %*x "MAX_STRING" "MAX_STRING" "MAX_STRING" "MAX_STRING" "MAX_STRING" "MAX_STRING" %lx %d", from_name, from_address, from_udpport, to_name, to_address, to_udpport, &options, &weight) != 8) @@ -138,9 +130,7 @@ cp /* Convert addresses */ -// from_tcpaddress = str2sockaddr(from_address, from_tcpport); from_udpaddress = str2sockaddr(from_address, from_udpport); -// to_tcpaddress = str2sockaddr(to_address, to_tcpport); to_udpaddress = str2sockaddr(to_address, to_udpport); /* Check if edge already exists */ @@ -185,10 +175,8 @@ cp e = new_edge(); e->from.node = from; -// e->from.tcpaddress = from_tcpaddress; e->from.udpaddress = from_udpaddress; e->to.node = to; -// e->to.tcpaddress = to_tcpaddress; e->to.udpaddress = to_udpaddress; e->options = options; e->weight = weight; @@ -226,7 +214,7 @@ int del_edge_h(connection_t *c) connection_t *other; avl_node_t *node; cp - if(sscanf(c->buffer, "%*d %*lx "MAX_STRING" "MAX_STRING"", from_name, to_name) != 2) + if(sscanf(c->buffer, "%*d %*x "MAX_STRING" "MAX_STRING"", from_name, to_name) != 2) { syslog(LOG_ERR, _("Got bad %s from %s (%s)"), "DEL_EDGE", c->name, c->hostname);