projects
/
tinc
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Never delete Subnets when StrictSubnets is set
[tinc]
/
src
/
net.c
diff --git
a/src/net.c
b/src/net.c
index
59dd39b
..
6ffd998
100644
(file)
--- a/
src/net.c
+++ b/
src/net.c
@@
-1,7
+1,7
@@
/*
net.c -- most of the network code
Copyright (C) 1998-2005 Ivo Timmermans,
/*
net.c -- most of the network code
Copyright (C) 1998-2005 Ivo Timmermans,
- 2000-20
09
Guus Sliepen <guus@tinc-vpn.org>
+ 2000-20
10
Guus Sliepen <guus@tinc-vpn.org>
2006 Scott Lamb <slamb@slamb.org>
This program is free software; you can redistribute it and/or modify
2006 Scott Lamb <slamb@slamb.org>
This program is free software; you can redistribute it and/or modify
@@
-68,9
+68,9
@@
static void purge(void) {
for(snode = n->subnet_tree->head; snode; snode = snext) {
snext = snode->next;
s = snode->data;
for(snode = n->subnet_tree->head; snode; snode = snext) {
snext = snode->next;
s = snode->data;
- if(!tunnelserver)
- send_del_subnet(broadcast, s);
- subnet_del(n, s);
+ send_del_subnet(broadcast, s);
+ if(!strictsubnets)
+
subnet_del(n, s);
}
for(enode = n->edge_tree->head; enode; enode = enext) {
}
for(enode = n->edge_tree->head; enode; enode = enext) {
@@
-98,7
+98,8
@@
static void purge(void) {
break;
}
break;
}
- if(!enode)
+ if(!enode && (!strictsubnets || !n->subnet_tree->head))
+ /* in strictsubnets mode do not delete nodes with subnets */
node_del(n);
}
}
node_del(n);
}
}
@@
-303,7
+304,7
@@
static void check_network_activity(fd_set * readset, fd_set * writeset) {
else {
ifdebug(CONNECTIONS) logger(LOG_DEBUG,
"Error while connecting to %s (%s): %s",
else {
ifdebug(CONNECTIONS) logger(LOG_DEBUG,
"Error while connecting to %s (%s): %s",
- c->name, c->hostname, strerror(result));
+ c->name, c->hostname, s
ocks
trerror(result));
closesocket(c->socket);
do_outgoing_connection(c);
continue;
closesocket(c->socket);
do_outgoing_connection(c);
continue;
@@
-369,17
+370,15
@@
int main_loop(void) {
#endif
if(r < 0) {
#endif
if(r < 0) {
- if(errno != EINTR && errno != EAGAIN) {
- logger(LOG_ERR, "Error while waiting for input: %s",
- strerror(errno));
+ if(!sockwouldblock(sockerrno)) {
+ logger(LOG_ERR, "Error while waiting for input: %s", sockstrerror(sockerrno));
dump_connections();
return 1;
}
dump_connections();
return 1;
}
-
- continue;
}
}
- check_network_activity(&readset, &writeset);
+ if(r > 0)
+ check_network_activity(&readset, &writeset);
if(do_purge) {
purge();
if(do_purge) {
purge();
@@
-419,8
+418,13
@@
int main_loop(void) {
}
if(sigalrm) {
}
if(sigalrm) {
+ avl_node_t *node;
logger(LOG_INFO, "Flushing event queue");
expire_events();
logger(LOG_INFO, "Flushing event queue");
expire_events();
+ for(node = connection_tree->head; node; node = node->next) {
+ connection_t *c = node->data;
+ send_ping(c);
+ }
sigalrm = false;
}
sigalrm = false;
}