projects
/
tinc
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
- Try old TUN/TAP ioctl() request if the one from if_tun.h fails.
[tinc]
/
src
/
protocol.c
diff --git
a/src/protocol.c
b/src/protocol.c
index
29282a1
..
1d39a83
100644
(file)
--- 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.
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.28.4.10
1 2001/07/20 13:54:1
9 guus Exp $
+ $Id: protocol.c,v 1.28.4.10
5 2001/09/01 12:02:3
9 guus Exp $
*/
#include "config.h"
*/
#include "config.h"
@@
-238,21
+238,17
@@
cp
if((old = lookup_id(cl->name)))
{
if(debug_lvl >= DEBUG_CONNECTIONS)
if((old = lookup_id(cl->name)))
{
if(debug_lvl >= DEBUG_CONNECTIONS)
- syslog(LOG_NOTICE, _("Removing old connection for %s at %s in favour of new connection
from
%s"),
-
cl
->name, old->hostname, cl->hostname);
+ syslog(LOG_NOTICE, _("Removing old connection for %s at %s in favour of new connection
at
%s"),
+
old
->name, old->hostname, cl->hostname);
if(old->status.outgoing)
{
cl->status.outgoing = 1;
old->status.outgoing = 0;
}
if(old->status.outgoing)
{
cl->status.outgoing = 1;
old->status.outgoing = 0;
}
- terminate_connection(old);
+ terminate_connection(old
, 0
);
return 0;
}
return 0;
}
- /* Now we can add the name to the id tree */
-
- id_add(cl);
-
/* Also check if no other tinc daemon uses the same IP and port for UDP traffic */
old = avl_search(active_tree, cl);
/* Also check if no other tinc daemon uses the same IP and port for UDP traffic */
old = avl_search(active_tree, cl);
@@
-266,7
+262,6
@@
cp
/* Activate this connection */
cl->allow_request = ALL;
/* Activate this connection */
cl->allow_request = ALL;
- cl->status.active = 1;
cl->nexthop = cl;
cl->cipher_pkttype = EVP_bf_cbc();
cl->cipher_pktkeylength = cl->cipher_pkttype->key_len + cl->cipher_pkttype->iv_len;
cl->nexthop = cl;
cl->cipher_pkttype = EVP_bf_cbc();
cl->cipher_pktkeylength = cl->cipher_pkttype->key_len + cl->cipher_pkttype->iv_len;
@@
-620,10
+615,7
@@
int send_add_subnet(connection_t *cl, subnet_t *subnet)
char *netstr;
char *owner;
cp
char *netstr;
char *owner;
cp
- if((cl->options | myself->options | subnet->owner->options) & OPTION_INDIRECT)
- owner = myself->name;
- else
- owner = subnet->owner->name;
+ owner = subnet->owner->name;
x = send_request(cl, "%d %s %s", ADD_SUBNET,
owner, netstr = net2str(subnet));
x = send_request(cl, "%d %s %s", ADD_SUBNET,
owner, netstr = net2str(subnet));
@@
-703,10
+695,7
@@
int send_del_subnet(connection_t *cl, subnet_t *subnet)
char *netstr;
char *owner;
cp
char *netstr;
char *owner;
cp
- if(cl->options & OPTION_INDIRECT)
- owner = myself->name;
- else
- owner = subnet->owner->name;
+ owner = subnet->owner->name;
x = send_request(cl, "%d %s %s", DEL_SUBNET, owner, netstr = net2str(subnet));
free(netstr);
x = send_request(cl, "%d %s %s", DEL_SUBNET, owner, netstr = net2str(subnet));
free(netstr);
@@
-786,11
+775,8
@@
cp
int send_add_host(connection_t *cl, connection_t *other)
{
cp
int send_add_host(connection_t *cl, connection_t *other)
{
cp
- if(!((cl->options | myself->options | other->options) & OPTION_INDIRECT))
- return send_request(cl, "%d %s %lx:%d %lx", ADD_HOST,
+ return send_request(cl, "%d %s %lx:%d %lx", ADD_HOST,
other->name, other->address, other->port, other->options);
other->name, other->address, other->port, other->options);
- else
- return 0;
}
int add_host_h(connection_t *cl)
}
int add_host_h(connection_t *cl)
@@
-834,7
+820,7
@@
cp
if((old = lookup_id(name)))
{
if((old = lookup_id(name)))
{
- if((new->address == old->address) && (new->port == old->port))
+ if((new->address == old->address) && (new->port == old->port)
&& (cl->nexthop == old->nexthop)
)
{
if(debug_lvl >= DEBUG_CONNECTIONS)
syslog(LOG_NOTICE, _("Got duplicate ADD_HOST for %s (%s) from %s (%s)"),
{
if(debug_lvl >= DEBUG_CONNECTIONS)
syslog(LOG_NOTICE, _("Got duplicate ADD_HOST for %s (%s) from %s (%s)"),
@@
-845,10
+831,10
@@
cp
else
{
if(debug_lvl >= DEBUG_CONNECTIONS)
else
{
if(debug_lvl >= DEBUG_CONNECTIONS)
- syslog(LOG_NOTICE, _("Removing old entry for %s (%s)
in favour of new connection
"),
- old->name, old->hostname);
+ syslog(LOG_NOTICE, _("Removing old entry for %s (%s)
from %s in favour of new connection from %s
"),
+ old->name, old->hostname
, old->nexthop->name, cl->nexthop->name
);
- terminate_connection(old);
+ terminate_connection(old
, 0
);
}
}
}
}
@@
-856,7
+842,6
@@
cp
new->name = xstrdup(name);
active_add(new);
new->name = xstrdup(name);
active_add(new);
- id_add(new);
/* Tell the rest about the new host */
/* Tell the rest about the new host */
@@
-870,7
+855,6
@@
cp
/* Fill in rest of connection structure */
new->nexthop = cl;
/* Fill in rest of connection structure */
new->nexthop = cl;
- new->status.active = 1;
new->cipher_pkttype = EVP_bf_cbc();
new->cipher_pktkeylength = cl->cipher_pkttype->key_len + cl->cipher_pkttype->iv_len;
cp
new->cipher_pkttype = EVP_bf_cbc();
new->cipher_pktkeylength = cl->cipher_pkttype->key_len + cl->cipher_pkttype->iv_len;
cp
@@
-880,11
+864,8
@@
cp
int send_del_host(connection_t *cl, connection_t *other)
{
cp
int send_del_host(connection_t *cl, connection_t *other)
{
cp
- if(!((cl->options | myself->options) & OPTION_INDIRECT))
- return send_request(cl, "%d %s %lx:%d %lx", DEL_HOST,
+ return send_request(cl, "%d %s %lx:%d %lx", DEL_HOST,
other->name, other->address, other->port, other->options);
other->name, other->address, other->port, other->options);
- else
- return 0;
}
int del_host_h(connection_t *cl)
}
int del_host_h(connection_t *cl)
@@
-921,7
+902,7
@@
cp
return 0;
}
return 0;
}
- /* Check if the
new
host already exists in the connnection list */
+ /* Check if the
deleted
host already exists in the connnection list */
if(!(old = lookup_id(name)))
{
if(!(old = lookup_id(name)))
{
@@
-940,10
+921,9
@@
cp
/* Ok, since EVERYTHING seems to check out all right, delete it */
/* Ok, since EVERYTHING seems to check out all right, delete it */
- old->status.active = 0;
- terminate_connection(old);
+ terminate_connection(old, 0);
- /* Tell the rest about the
new
host */
+ /* Tell the rest about the
deleted
host */
for(node = connection_tree->head; node; node = node->next)
{
for(node = connection_tree->head; node; node = node->next)
{
@@
-1014,7
+994,7
@@
cp
cl->name, cl->hostname, strerror(err), errorstring);
}
cl->name, cl->hostname, strerror(err), errorstring);
}
- terminate_connection(cl);
+ terminate_connection(cl
, cl->status.meta
);
cp
return 0;
}
cp
return 0;
}
@@
-1028,7
+1008,7
@@
cp
int termreq_h(connection_t *cl)
{
cp
int termreq_h(connection_t *cl)
{
cp
- terminate_connection(cl);
+ terminate_connection(cl
, cl->status.meta
);
cp
return 0;
}
cp
return 0;
}
@@
-1089,8
+1069,7
@@
cp
{
p = (connection_t *)node->data;
if(p != cl && p->status.active)
{
p = (connection_t *)node->data;
if(p != cl && p->status.active)
- if(!(p->options & OPTION_INDIRECT) || from == myself)
- send_request(p, "%d %s", KEY_CHANGED, from->name);
+ send_request(p, "%d %s", KEY_CHANGED, from->name);
}
cp
return 0;
}
cp
return 0;
@@
-1118,8
+1097,7
@@
cp
from->status.validkey = 0;
from->status.waitingforkey = 0;
from->status.validkey = 0;
from->status.waitingforkey = 0;
- if(!(from->options | cl->options | myself->options) & OPTION_INDIRECT)
- send_key_changed(from, cl);
+ send_key_changed(from, cl);
cp
return 0;
}
cp
return 0;
}