Generalized request broadcasting/forwarding.
This commit is contained in:
parent
431fa10b37
commit
8b2b67e26c
10 changed files with 76 additions and 118 deletions
|
@ -17,7 +17,7 @@
|
||||||
along with this program; if not, write to the Free Software
|
along with this program; if not, write to the Free Software
|
||||||
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||||
|
|
||||||
$Id: connection.c,v 1.1.2.30 2002/06/21 10:11:12 guus Exp $
|
$Id: connection.c,v 1.1.2.31 2002/09/04 16:26:44 guus Exp $
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "config.h"
|
#include "config.h"
|
||||||
|
@ -41,6 +41,7 @@
|
||||||
#include "system.h"
|
#include "system.h"
|
||||||
|
|
||||||
avl_tree_t *connection_tree; /* Meta connections */
|
avl_tree_t *connection_tree; /* Meta connections */
|
||||||
|
connection_t *broadcast;
|
||||||
|
|
||||||
int connection_compare(connection_t *a, connection_t *b)
|
int connection_compare(connection_t *a, connection_t *b)
|
||||||
{
|
{
|
||||||
|
@ -51,6 +52,10 @@ void init_connections(void)
|
||||||
{
|
{
|
||||||
cp
|
cp
|
||||||
connection_tree = avl_alloc_tree((avl_compare_t)connection_compare, NULL);
|
connection_tree = avl_alloc_tree((avl_compare_t)connection_compare, NULL);
|
||||||
|
cp
|
||||||
|
broadcast = new_connection();
|
||||||
|
broadcast->name = xstrdup(_("everyone"));
|
||||||
|
broadcast->hostname = xstrdup(_("BROADCAST"));
|
||||||
cp
|
cp
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -58,6 +63,8 @@ void exit_connections(void)
|
||||||
{
|
{
|
||||||
cp
|
cp
|
||||||
avl_delete_tree(connection_tree);
|
avl_delete_tree(connection_tree);
|
||||||
|
cp
|
||||||
|
free_connection(broadcast);
|
||||||
cp
|
cp
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -17,7 +17,7 @@
|
||||||
along with this program; if not, write to the Free Software
|
along with this program; if not, write to the Free Software
|
||||||
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||||
|
|
||||||
$Id: connection.h,v 1.1.2.29 2002/09/04 13:48:51 guus Exp $
|
$Id: connection.h,v 1.1.2.30 2002/09/04 16:26:44 guus Exp $
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef __TINC_CONNECTION_H__
|
#ifndef __TINC_CONNECTION_H__
|
||||||
|
@ -99,6 +99,7 @@ typedef struct connection_t {
|
||||||
|
|
||||||
char buffer[MAXBUFSIZE]; /* metadata input buffer */
|
char buffer[MAXBUFSIZE]; /* metadata input buffer */
|
||||||
int buflen; /* bytes read into buffer */
|
int buflen; /* bytes read into buffer */
|
||||||
|
int reqlen; /* length of incoming request */
|
||||||
int tcplen; /* length of incoming TCPpacket */
|
int tcplen; /* length of incoming TCPpacket */
|
||||||
int allow_request; /* defined if there's only one request possible */
|
int allow_request; /* defined if there's only one request possible */
|
||||||
|
|
||||||
|
@ -108,6 +109,7 @@ typedef struct connection_t {
|
||||||
} connection_t;
|
} connection_t;
|
||||||
|
|
||||||
extern avl_tree_t *connection_tree;
|
extern avl_tree_t *connection_tree;
|
||||||
|
extern connection_t *broadcast;
|
||||||
|
|
||||||
extern void init_connections(void);
|
extern void init_connections(void);
|
||||||
extern void exit_connections(void);
|
extern void exit_connections(void);
|
||||||
|
|
|
@ -17,7 +17,7 @@
|
||||||
along with this program; if not, write to the Free Software
|
along with this program; if not, write to the Free Software
|
||||||
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||||
|
|
||||||
$Id: meta.c,v 1.1.2.26 2002/06/21 10:11:12 guus Exp $
|
$Id: meta.c,v 1.1.2.27 2002/09/04 16:26:44 guus Exp $
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "config.h"
|
#include "config.h"
|
||||||
|
@ -182,6 +182,7 @@ cp
|
||||||
|
|
||||||
if(reqlen)
|
if(reqlen)
|
||||||
{
|
{
|
||||||
|
c->reqlen = reqlen;
|
||||||
if(receive_request(c))
|
if(receive_request(c))
|
||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
|
|
36
src/net.c
36
src/net.c
|
@ -17,7 +17,7 @@
|
||||||
along with this program; if not, write to the Free Software
|
along with this program; if not, write to the Free Software
|
||||||
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||||
|
|
||||||
$Id: net.c,v 1.35.4.176 2002/09/04 13:48:51 guus Exp $
|
$Id: net.c,v 1.35.4.177 2002/09/04 16:26:44 guus Exp $
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "config.h"
|
#include "config.h"
|
||||||
|
@ -87,11 +87,10 @@ time_t now = 0;
|
||||||
|
|
||||||
void purge(void)
|
void purge(void)
|
||||||
{
|
{
|
||||||
avl_node_t *nnode, *nnext, *enode, *enext, *snode, *snext, *cnode;
|
avl_node_t *nnode, *nnext, *enode, *enext, *snode, *snext;
|
||||||
node_t *n;
|
node_t *n;
|
||||||
edge_t *e;
|
edge_t *e;
|
||||||
subnet_t *s;
|
subnet_t *s;
|
||||||
connection_t *c;
|
|
||||||
cp
|
cp
|
||||||
if(debug_lvl >= DEBUG_PROTOCOL)
|
if(debug_lvl >= DEBUG_PROTOCOL)
|
||||||
syslog(LOG_DEBUG, _("Purging unreachable nodes"));
|
syslog(LOG_DEBUG, _("Purging unreachable nodes"));
|
||||||
|
@ -110,14 +109,7 @@ cp
|
||||||
{
|
{
|
||||||
snext = snode->next;
|
snext = snode->next;
|
||||||
s = (subnet_t *)snode->data;
|
s = (subnet_t *)snode->data;
|
||||||
|
send_del_subnet(broadcast, s);
|
||||||
for(cnode = connection_tree->head; cnode; cnode = cnode->next)
|
|
||||||
{
|
|
||||||
c = (connection_t *)cnode->data;
|
|
||||||
if(c->status.active)
|
|
||||||
send_del_subnet(c, s);
|
|
||||||
}
|
|
||||||
|
|
||||||
subnet_del(n, s);
|
subnet_del(n, s);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -125,14 +117,7 @@ cp
|
||||||
{
|
{
|
||||||
enext = enode->next;
|
enext = enode->next;
|
||||||
e = (edge_t *)enode->data;
|
e = (edge_t *)enode->data;
|
||||||
|
send_del_edge(broadcast, e);
|
||||||
for(cnode = connection_tree->head; cnode; cnode = cnode->next)
|
|
||||||
{
|
|
||||||
c = (connection_t *)cnode->data;
|
|
||||||
if(c->status.active)
|
|
||||||
send_del_edge(c, e);
|
|
||||||
}
|
|
||||||
|
|
||||||
edge_del(e);
|
edge_del(e);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -188,8 +173,6 @@ cp
|
||||||
*/
|
*/
|
||||||
void terminate_connection(connection_t *c, int report)
|
void terminate_connection(connection_t *c, int report)
|
||||||
{
|
{
|
||||||
avl_node_t *node;
|
|
||||||
connection_t *other;
|
|
||||||
cp
|
cp
|
||||||
if(c->status.remove)
|
if(c->status.remove)
|
||||||
return;
|
return;
|
||||||
|
@ -210,14 +193,7 @@ cp
|
||||||
if(c->edge)
|
if(c->edge)
|
||||||
{
|
{
|
||||||
if(report)
|
if(report)
|
||||||
{
|
send_del_edge(broadcast, c->edge);
|
||||||
for(node = connection_tree->head; node; node = node->next)
|
|
||||||
{
|
|
||||||
other = (connection_t *)node->data;
|
|
||||||
if(other->status.active && other != c)
|
|
||||||
send_del_edge(other, c->edge);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
edge_del(c->edge);
|
edge_del(c->edge);
|
||||||
|
|
||||||
|
@ -407,7 +383,7 @@ cp
|
||||||
syslog(LOG_INFO, _("Regenerating symmetric key"));
|
syslog(LOG_INFO, _("Regenerating symmetric key"));
|
||||||
|
|
||||||
RAND_pseudo_bytes(myself->key, myself->keylength);
|
RAND_pseudo_bytes(myself->key, myself->keylength);
|
||||||
send_key_changed(myself->connection, myself);
|
send_key_changed(broadcast, myself);
|
||||||
keyexpires = now + keylifetime;
|
keyexpires = now + keylifetime;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -17,7 +17,7 @@
|
||||||
along with this program; if not, write to the Free Software
|
along with this program; if not, write to the Free Software
|
||||||
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||||
|
|
||||||
$Id: protocol.c,v 1.28.4.132 2002/09/04 13:48:52 guus Exp $
|
$Id: protocol.c,v 1.28.4.133 2002/09/04 16:26:44 guus Exp $
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "config.h"
|
#include "config.h"
|
||||||
|
@ -89,7 +89,28 @@ cp
|
||||||
|
|
||||||
buffer[len++] = '\n';
|
buffer[len++] = '\n';
|
||||||
cp
|
cp
|
||||||
return send_meta(c, buffer, len);
|
if(c == broadcast)
|
||||||
|
return broadcast_meta(NULL, buffer, len);
|
||||||
|
else
|
||||||
|
return send_meta(c, buffer, len);
|
||||||
|
}
|
||||||
|
|
||||||
|
int forward_request(connection_t *from)
|
||||||
|
{
|
||||||
|
int request;
|
||||||
|
cp
|
||||||
|
if(debug_lvl >= DEBUG_PROTOCOL)
|
||||||
|
{
|
||||||
|
sscanf(from->buffer, "%d", &request);
|
||||||
|
if(debug_lvl >= DEBUG_META)
|
||||||
|
syslog(LOG_DEBUG, _("Broadcasting %s from %s (%s): %s"), request_name[request], from->name, from->hostname, from->buffer);
|
||||||
|
else
|
||||||
|
syslog(LOG_DEBUG, _("Broadcasting %s from %s (%s)"), request_name[request], from->name, from->hostname);
|
||||||
|
}
|
||||||
|
|
||||||
|
from->buffer[from->reqlen - 1] = '\n';
|
||||||
|
cp
|
||||||
|
return broadcast_meta(from, from->buffer, from->reqlen);
|
||||||
}
|
}
|
||||||
|
|
||||||
int receive_request(connection_t *c)
|
int receive_request(connection_t *c)
|
||||||
|
|
|
@ -17,7 +17,7 @@
|
||||||
along with this program; if not, write to the Free Software
|
along with this program; if not, write to the Free Software
|
||||||
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||||
|
|
||||||
$Id: protocol.h,v 1.5.4.33 2002/09/04 13:48:52 guus Exp $
|
$Id: protocol.h,v 1.5.4.34 2002/09/04 16:26:45 guus Exp $
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef __TINC_PROTOCOL_H__
|
#ifndef __TINC_PROTOCOL_H__
|
||||||
|
@ -62,6 +62,7 @@ typedef struct past_request_t {
|
||||||
/* Basic functions */
|
/* Basic functions */
|
||||||
|
|
||||||
extern int send_request(connection_t*, const char*, ...);
|
extern int send_request(connection_t*, const char*, ...);
|
||||||
|
extern int forward_request(connection_t *);
|
||||||
extern int receive_request(connection_t *);
|
extern int receive_request(connection_t *);
|
||||||
extern int check_id(char *);
|
extern int check_id(char *);
|
||||||
|
|
||||||
|
|
|
@ -17,7 +17,7 @@
|
||||||
along with this program; if not, write to the Free Software
|
along with this program; if not, write to the Free Software
|
||||||
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||||
|
|
||||||
$Id: protocol_auth.c,v 1.1.4.13 2002/09/04 14:17:28 guus Exp $
|
$Id: protocol_auth.c,v 1.1.4.14 2002/09/04 16:26:45 guus Exp $
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "config.h"
|
#include "config.h"
|
||||||
|
@ -483,7 +483,7 @@ void send_everything(connection_t *c)
|
||||||
subnet_t *s;
|
subnet_t *s;
|
||||||
edge_t *e;
|
edge_t *e;
|
||||||
|
|
||||||
/* Send all known subnets */
|
/* Send all known subnets and edges */
|
||||||
|
|
||||||
for(node = node_tree->head; node; node = node->next)
|
for(node = node_tree->head; node; node = node->next)
|
||||||
{
|
{
|
||||||
|
@ -494,15 +494,12 @@ void send_everything(connection_t *c)
|
||||||
s = (subnet_t *)node2->data;
|
s = (subnet_t *)node2->data;
|
||||||
send_add_subnet(c, s);
|
send_add_subnet(c, s);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
/* Send all known edges */
|
for(node2 = n->edge_tree->head; node2; node2 = node2->next)
|
||||||
|
{
|
||||||
for(node = edge_tree->head; node; node = node->next)
|
e = (edge_t *)node2->data;
|
||||||
{
|
send_add_edge(c, e);
|
||||||
e = (edge_t *)node->data;
|
}
|
||||||
|
|
||||||
send_add_edge(c, e);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -513,8 +510,6 @@ int ack_h(connection_t *c)
|
||||||
int weight;
|
int weight;
|
||||||
long int options;
|
long int options;
|
||||||
node_t *n;
|
node_t *n;
|
||||||
connection_t *other;
|
|
||||||
avl_node_t *node;
|
|
||||||
cp
|
cp
|
||||||
if(sscanf(c->buffer, "%*d "MAX_STRING" %d %lx", hisport, &weight, &options) != 3)
|
if(sscanf(c->buffer, "%*d "MAX_STRING" %d %lx", hisport, &weight, &options) != 3)
|
||||||
{
|
{
|
||||||
|
@ -541,14 +536,24 @@ cp
|
||||||
syslog(LOG_DEBUG, _("Established a second connection with %s (%s), closing old connection"), n->name, n->hostname);
|
syslog(LOG_DEBUG, _("Established a second connection with %s (%s), closing old connection"), n->name, n->hostname);
|
||||||
terminate_connection(n->connection, 0);
|
terminate_connection(n->connection, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* FIXME: check if information in existing node matches that of the other end of this connection */
|
|
||||||
}
|
}
|
||||||
|
|
||||||
n->connection = c;
|
n->connection = c;
|
||||||
c->node = n;
|
c->node = n;
|
||||||
c->options |= options;
|
c->options |= options;
|
||||||
|
|
||||||
|
/* Activate this connection */
|
||||||
|
|
||||||
|
c->allow_request = ALL;
|
||||||
|
c->status.active = 1;
|
||||||
|
|
||||||
|
if(debug_lvl >= DEBUG_CONNECTIONS)
|
||||||
|
syslog(LOG_NOTICE, _("Connection with %s (%s) activated"), c->name, c->hostname);
|
||||||
|
|
||||||
|
/* Send him everything we know */
|
||||||
|
|
||||||
|
send_everything(c);
|
||||||
|
|
||||||
/* Create an edge_t for this connection */
|
/* Create an edge_t for this connection */
|
||||||
|
|
||||||
c->edge = new_edge();
|
c->edge = new_edge();
|
||||||
|
@ -565,28 +570,10 @@ cp
|
||||||
cp
|
cp
|
||||||
edge_add(c->edge);
|
edge_add(c->edge);
|
||||||
|
|
||||||
/* Activate this connection */
|
|
||||||
|
|
||||||
c->allow_request = ALL;
|
|
||||||
c->status.active = 1;
|
|
||||||
|
|
||||||
if(debug_lvl >= DEBUG_CONNECTIONS)
|
|
||||||
syslog(LOG_NOTICE, _("Connection with %s (%s) activated"), c->name, c->hostname);
|
|
||||||
|
|
||||||
cp
|
cp
|
||||||
/* Send him everything we know */
|
/* Notify everyone of the new edge */
|
||||||
|
|
||||||
send_everything(c);
|
send_add_edge(broadcast, c->edge);
|
||||||
|
|
||||||
/* Notify others of this connection */
|
|
||||||
|
|
||||||
for(node = connection_tree->head; node; node = node->next)
|
|
||||||
{
|
|
||||||
other = (connection_t *)node->data;
|
|
||||||
|
|
||||||
if(other->status.active && other != c)
|
|
||||||
send_add_edge(other, c->edge);
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Run MST and SSSP algorithms */
|
/* Run MST and SSSP algorithms */
|
||||||
|
|
||||||
|
|
|
@ -17,7 +17,7 @@
|
||||||
along with this program; if not, write to the Free Software
|
along with this program; if not, write to the Free Software
|
||||||
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||||
|
|
||||||
$Id: protocol_edge.c,v 1.1.4.9 2002/09/04 13:48:52 guus Exp $
|
$Id: protocol_edge.c,v 1.1.4.10 2002/09/04 16:26:45 guus Exp $
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "config.h"
|
#include "config.h"
|
||||||
|
@ -62,7 +62,6 @@ cp
|
||||||
|
|
||||||
int add_edge_h(connection_t *c)
|
int add_edge_h(connection_t *c)
|
||||||
{
|
{
|
||||||
connection_t *other;
|
|
||||||
edge_t *e;
|
edge_t *e;
|
||||||
node_t *from, *to;
|
node_t *from, *to;
|
||||||
char from_name[MAX_STRING_SIZE];
|
char from_name[MAX_STRING_SIZE];
|
||||||
|
@ -72,7 +71,6 @@ int add_edge_h(connection_t *c)
|
||||||
sockaddr_t address;
|
sockaddr_t address;
|
||||||
long int options;
|
long int options;
|
||||||
int weight;
|
int weight;
|
||||||
avl_node_t *node;
|
|
||||||
cp
|
cp
|
||||||
if(sscanf(c->buffer, "%*d %*x "MAX_STRING" "MAX_STRING" "MAX_STRING" "MAX_STRING" %lx %d",
|
if(sscanf(c->buffer, "%*d %*x "MAX_STRING" "MAX_STRING" "MAX_STRING" "MAX_STRING" %lx %d",
|
||||||
from_name, to_name, to_address, to_port, &options, &weight) != 6)
|
from_name, to_name, to_address, to_port, &options, &weight) != 6)
|
||||||
|
@ -169,12 +167,7 @@ cp
|
||||||
|
|
||||||
/* Tell the rest about the new edge */
|
/* Tell the rest about the new edge */
|
||||||
|
|
||||||
for(node = connection_tree->head; node; node = node->next)
|
forward_request(c);
|
||||||
{
|
|
||||||
other = (connection_t *)node->data;
|
|
||||||
if(other->status.active && other != c)
|
|
||||||
send_request(other, "%s", c->buffer);
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Run MST before or after we tell the rest? */
|
/* Run MST before or after we tell the rest? */
|
||||||
|
|
||||||
|
@ -196,8 +189,6 @@ int del_edge_h(connection_t *c)
|
||||||
char from_name[MAX_STRING_SIZE];
|
char from_name[MAX_STRING_SIZE];
|
||||||
char to_name[MAX_STRING_SIZE];
|
char to_name[MAX_STRING_SIZE];
|
||||||
node_t *from, *to;
|
node_t *from, *to;
|
||||||
connection_t *other;
|
|
||||||
avl_node_t *node;
|
|
||||||
cp
|
cp
|
||||||
if(sscanf(c->buffer, "%*d %*x "MAX_STRING" "MAX_STRING"", from_name, to_name) != 2)
|
if(sscanf(c->buffer, "%*d %*x "MAX_STRING" "MAX_STRING"", from_name, to_name) != 2)
|
||||||
{
|
{
|
||||||
|
@ -264,12 +255,7 @@ cp
|
||||||
|
|
||||||
/* Tell the rest about the deleted edge */
|
/* Tell the rest about the deleted edge */
|
||||||
|
|
||||||
for(node = connection_tree->head; node; node = node->next)
|
forward_request(c);
|
||||||
{
|
|
||||||
other = (connection_t *)node->data;
|
|
||||||
if(other->status.active && other != c)
|
|
||||||
send_request(other, "%s", c->buffer);
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Delete the edge */
|
/* Delete the edge */
|
||||||
|
|
||||||
|
|
|
@ -17,7 +17,7 @@
|
||||||
along with this program; if not, write to the Free Software
|
along with this program; if not, write to the Free Software
|
||||||
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||||
|
|
||||||
$Id: protocol_key.c,v 1.1.4.9 2002/09/04 08:02:33 guus Exp $
|
$Id: protocol_key.c,v 1.1.4.10 2002/09/04 16:26:45 guus Exp $
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "config.h"
|
#include "config.h"
|
||||||
|
@ -54,17 +54,13 @@ cp
|
||||||
|
|
||||||
if(n == myself && !mykeyused)
|
if(n == myself && !mykeyused)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
send_request(NULL, "%d %lx %s", KEY_CHANGED, random(), n->name);
|
|
||||||
cp
|
cp
|
||||||
return 0;
|
return send_request(c, "%d %lx %s", KEY_CHANGED, random(), n->name);
|
||||||
}
|
}
|
||||||
|
|
||||||
int key_changed_h(connection_t *c)
|
int key_changed_h(connection_t *c)
|
||||||
{
|
{
|
||||||
char name[MAX_STRING_SIZE];
|
char name[MAX_STRING_SIZE];
|
||||||
avl_node_t *node;
|
|
||||||
connection_t *other;
|
|
||||||
node_t *n;
|
node_t *n;
|
||||||
cp
|
cp
|
||||||
if(sscanf(c->buffer, "%*d %*x "MAX_STRING, name) != 1)
|
if(sscanf(c->buffer, "%*d %*x "MAX_STRING, name) != 1)
|
||||||
|
@ -91,12 +87,7 @@ cp
|
||||||
|
|
||||||
/* Tell the others */
|
/* Tell the others */
|
||||||
|
|
||||||
for(node = connection_tree->head; node; node = node->next)
|
forward_request(c);
|
||||||
{
|
|
||||||
other = (connection_t *)node->data;
|
|
||||||
if(other->status.active && other != c)
|
|
||||||
send_request(other, "%s", c->buffer);
|
|
||||||
}
|
|
||||||
cp
|
cp
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
|
@ -17,7 +17,7 @@
|
||||||
along with this program; if not, write to the Free Software
|
along with this program; if not, write to the Free Software
|
||||||
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||||
|
|
||||||
$Id: protocol_subnet.c,v 1.1.4.5 2002/09/03 20:43:26 guus Exp $
|
$Id: protocol_subnet.c,v 1.1.4.6 2002/09/04 16:26:45 guus Exp $
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "config.h"
|
#include "config.h"
|
||||||
|
@ -60,9 +60,7 @@ int add_subnet_h(connection_t *c)
|
||||||
char subnetstr[MAX_STRING_SIZE];
|
char subnetstr[MAX_STRING_SIZE];
|
||||||
char name[MAX_STRING_SIZE];
|
char name[MAX_STRING_SIZE];
|
||||||
node_t *owner;
|
node_t *owner;
|
||||||
connection_t *other;
|
|
||||||
subnet_t *s;
|
subnet_t *s;
|
||||||
avl_node_t *node;
|
|
||||||
cp
|
cp
|
||||||
if(sscanf(c->buffer, "%*d %*x "MAX_STRING" "MAX_STRING, name, subnetstr) != 2)
|
if(sscanf(c->buffer, "%*d %*x "MAX_STRING" "MAX_STRING, name, subnetstr) != 2)
|
||||||
{
|
{
|
||||||
|
@ -125,12 +123,7 @@ cp
|
||||||
|
|
||||||
/* Tell the rest */
|
/* Tell the rest */
|
||||||
|
|
||||||
for(node = connection_tree->head; node; node = node->next)
|
forward_request(c);
|
||||||
{
|
|
||||||
other = (connection_t *)node->data;
|
|
||||||
if(other->status.active && other != c)
|
|
||||||
send_request(other, "%s", c->buffer);
|
|
||||||
}
|
|
||||||
cp
|
cp
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@ -152,9 +145,7 @@ int del_subnet_h(connection_t *c)
|
||||||
char subnetstr[MAX_STRING_SIZE];
|
char subnetstr[MAX_STRING_SIZE];
|
||||||
char name[MAX_STRING_SIZE];
|
char name[MAX_STRING_SIZE];
|
||||||
node_t *owner;
|
node_t *owner;
|
||||||
connection_t *other;
|
|
||||||
subnet_t *s, *find;
|
subnet_t *s, *find;
|
||||||
avl_node_t *node;
|
|
||||||
cp
|
cp
|
||||||
if(sscanf(c->buffer, "%*d %*x "MAX_STRING" "MAX_STRING, name, subnetstr) != 2)
|
if(sscanf(c->buffer, "%*d %*x "MAX_STRING" "MAX_STRING, name, subnetstr) != 2)
|
||||||
{
|
{
|
||||||
|
@ -219,12 +210,7 @@ cp
|
||||||
|
|
||||||
/* Tell the rest */
|
/* Tell the rest */
|
||||||
|
|
||||||
for(node = connection_tree->head; node; node = node->next)
|
forward_request(c);
|
||||||
{
|
|
||||||
other = (connection_t *)node->data;
|
|
||||||
if(other->status.active && other != c)
|
|
||||||
send_request(other, "%s", c->buffer);
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Finally, delete it. */
|
/* Finally, delete it. */
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue