projects
/
tinc
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Use splay trees instead of AVL trees.
[tinc]
/
src
/
protocol_auth.c
diff --git
a/src/protocol_auth.c
b/src/protocol_auth.c
index
4c88562
..
70ccda1
100644
(file)
--- a/
src/protocol_auth.c
+++ b/
src/protocol_auth.c
@@
-1,7
+1,7
@@
/*
protocol_auth.c -- handle the meta-protocol, authentication
/*
protocol_auth.c -- handle the meta-protocol, authentication
- Copyright (C) 1999-2005 Ivo Timmermans
<ivo@tinc-vpn.org>
,
- 2000-200
5
Guus Sliepen <guus@tinc-vpn.org>
+ Copyright (C) 1999-2005 Ivo Timmermans,
+ 2000-200
7
Guus Sliepen <guus@tinc-vpn.org>
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
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
@@
-27,7
+27,7
@@
#include <openssl/err.h>
#include <openssl/evp.h>
#include <openssl/err.h>
#include <openssl/evp.h>
-#include "
avl
_tree.h"
+#include "
splay
_tree.h"
#include "conf.h"
#include "connection.h"
#include "edge.h"
#include "conf.h"
#include "connection.h"
#include "edge.h"
@@
-40,16
+40,14
@@
#include "utils.h"
#include "xalloc.h"
#include "utils.h"
#include "xalloc.h"
-bool send_id(connection_t *c)
-{
+bool send_id(connection_t *c) {
cp();
return send_request(c, "%d %s %d", ID, myself->connection->name,
myself->connection->protocol_version);
}
cp();
return send_request(c, "%d %s %d", ID, myself->connection->name,
myself->connection->protocol_version);
}
-bool id_h(connection_t *c)
-{
+bool id_h(connection_t *c) {
char name[MAX_STRING_SIZE];
cp();
char name[MAX_STRING_SIZE];
cp();
@@
-68,9
+66,9
@@
bool id_h(connection_t *c)
return false;
}
return false;
}
- /* If
we set c->name in advance
, make sure we are connected to the right host */
+ /* If
this is an outgoing connection
, make sure we are connected to the right host */
- if(c->
name
) {
+ if(c->
outgoing
) {
if(strcmp(c->name, name)) {
logger(LOG_ERR, _("Peer %s is %s instead of %s"), c->hostname, name,
c->name);
if(strcmp(c->name, name)) {
logger(LOG_ERR, _("Peer %s is %s instead of %s"), c->hostname, name,
c->name);
@@
-116,8
+114,7
@@
bool id_h(connection_t *c)
return send_metakey(c);
}
return send_metakey(c);
}
-bool send_metakey(connection_t *c)
-{
+bool send_metakey(connection_t *c) {
char *buffer;
int len;
bool x;
char *buffer;
int len;
bool x;
@@
-202,8
+199,7
@@
bool send_metakey(connection_t *c)
return x;
}
return x;
}
-bool metakey_h(connection_t *c)
-{
+bool metakey_h(connection_t *c) {
char buffer[MAX_STRING_SIZE];
int cipher, digest, maclength, compression;
int len;
char buffer[MAX_STRING_SIZE];
int cipher, digest, maclength, compression;
int len;
@@
-302,8
+298,7
@@
bool metakey_h(connection_t *c)
return send_challenge(c);
}
return send_challenge(c);
}
-bool send_challenge(connection_t *c)
-{
+bool send_challenge(connection_t *c) {
char *buffer;
int len;
char *buffer;
int len;
@@
-334,8
+329,7
@@
bool send_challenge(connection_t *c)
return send_request(c, "%d %s", CHALLENGE, buffer);
}
return send_request(c, "%d %s", CHALLENGE, buffer);
}
-bool challenge_h(connection_t *c)
-{
+bool challenge_h(connection_t *c) {
char buffer[MAX_STRING_SIZE];
int len;
char buffer[MAX_STRING_SIZE];
int len;
@@
-373,8
+367,7
@@
bool challenge_h(connection_t *c)
return send_chal_reply(c);
}
return send_chal_reply(c);
}
-bool send_chal_reply(connection_t *c)
-{
+bool send_chal_reply(connection_t *c) {
char hash[EVP_MAX_MD_SIZE * 2 + 1];
EVP_MD_CTX ctx;
char hash[EVP_MAX_MD_SIZE * 2 + 1];
EVP_MD_CTX ctx;
@@
-400,8
+393,7
@@
bool send_chal_reply(connection_t *c)
return send_request(c, "%d %s", CHAL_REPLY, hash);
}
return send_request(c, "%d %s", CHAL_REPLY, hash);
}
-bool chal_reply_h(connection_t *c)
-{
+bool chal_reply_h(connection_t *c) {
char hishash[MAX_STRING_SIZE];
char myhash[EVP_MAX_MD_SIZE];
EVP_MD_CTX ctx;
char hishash[MAX_STRING_SIZE];
char myhash[EVP_MAX_MD_SIZE];
EVP_MD_CTX ctx;
@@
-460,8
+452,7
@@
bool chal_reply_h(connection_t *c)
return send_ack(c);
}
return send_ack(c);
}
-bool send_ack(connection_t *c)
-{
+bool send_ack(connection_t *c) {
/* ACK message contains rest of the information the other end needs
to create node_t and edge_t structures. */
/* ACK message contains rest of the information the other end needs
to create node_t and edge_t structures. */
@@
-491,9
+482,8
@@
bool send_ack(connection_t *c)
return send_request(c, "%d %s %d %lx", ACK, myport, c->estimated_weight, c->options);
}
return send_request(c, "%d %s %d %lx", ACK, myport, c->estimated_weight, c->options);
}
-static void send_everything(connection_t *c)
-{
- avl_node_t *node, *node2;
+static void send_everything(connection_t *c) {
+ splay_node_t *node, *node2;
node_t *n;
subnet_t *s;
edge_t *e;
node_t *n;
subnet_t *s;
edge_t *e;
@@
-524,8
+514,7
@@
static void send_everything(connection_t *c)
}
}
}
}
-bool ack_h(connection_t *c)
-{
+bool ack_h(connection_t *c) {
char hisport[MAX_STRING_SIZE];
char *hisaddress, *dummy;
int weight, mtu;
char hisport[MAX_STRING_SIZE];
char *hisaddress, *dummy;
int weight, mtu;