Require ExperimentalProtocol = yes for new features, update documentation.

This commit is contained in:
Guus Sliepen 2011-07-11 21:54:01 +02:00
parent d1cd3c8145
commit bbeab00f46
8 changed files with 44 additions and 14 deletions

View file

@ -339,7 +339,9 @@ static bool setup_myself(void) {
read_config_file(config_tree, fname);
free(fname);
if(!read_ecdsa_private_key())
get_config_bool(lookup_config(config_tree, "ExperimentalProtocol"), &experimental);
if(experimental && !read_ecdsa_private_key())
return false;
if(!read_rsa_private_key())

View file

@ -30,6 +30,7 @@
bool tunnelserver = false;
bool strictsubnets = false;
bool experimental = false;
/* Jumptable for the request handlers */

View file

@ -54,6 +54,7 @@ typedef struct past_request_t {
extern bool tunnelserver;
extern bool strictsubnets;
extern bool experimental;
/* Maximum size of strings in a request.
* scanf terminates %2048s with a NUL character,

View file

@ -43,12 +43,16 @@
bool send_id(connection_t *c) {
gettimeofday(&c->start, NULL);
int minor = myself->connection->protocol_minor;
if(c->config_tree && !read_ecdsa_public_key(c))
minor = 1;
int minor = 0;
return send_request(c, "%d %s %d.%d", ID, myself->connection->name,
myself->connection->protocol_major, minor);
if(experimental) {
if(c->config_tree && !read_ecdsa_public_key(c))
minor = 1;
else
minor = myself->connection->protocol_minor;
}
return send_request(c, "%d %s %d.%d", ID, myself->connection->name, myself->connection->protocol_major, minor);
}
bool id_h(connection_t *c, char *request) {
@ -115,7 +119,7 @@ bool id_h(connection_t *c, char *request) {
return false;
}
if(c->protocol_minor >= 2)
if(experimental && c->protocol_minor >= 2)
if(!read_ecdsa_public_key(c))
return false;
} else {
@ -123,6 +127,9 @@ bool id_h(connection_t *c, char *request) {
c->protocol_minor = 1;
}
if(!experimental)
c->protocol_minor = 0;
c->allow_request = METAKEY;
if(c->protocol_minor >= 2)

View file

@ -84,7 +84,7 @@ bool key_changed_h(connection_t *c, char *request) {
}
bool send_req_key(node_t *to) {
return send_request(to->nexthop->connection, "%d %s %s 1", REQ_KEY, myself->name, to->name);
return send_request(to->nexthop->connection, "%d %s %s %d", REQ_KEY, myself->name, to->name, experimental ? 1 : 0);
}
bool req_key_h(connection_t *c, char *request) {
@ -123,7 +123,7 @@ bool req_key_h(connection_t *c, char *request) {
/* Check if this key request is for us */
if(to == myself) { /* Yes, send our own key back */
if(kx_version > 0) {
if(experimental && kx_version >= 1) {
logger(LOG_DEBUG, "Got ECDH key request from %s", from->name);
from->status.ecdh = true;
}
@ -161,7 +161,7 @@ bool send_ans_key_ecdh(node_t *to) {
}
bool send_ans_key(node_t *to) {
if(to->status.ecdh)
if(experimental && to->status.ecdh)
return send_ans_key_ecdh(to);
size_t keylen = cipher_keylength(&myself->incipher);
@ -280,7 +280,7 @@ bool ans_key_h(connection_t *c, char *request) {
/* ECDH or old-style key exchange? */
if(!strncmp(key, "ECDH:", 5)) {
if(experimental && !strncmp(key, "ECDH:", 5)) {
keylen = (strlen(key) - 5) / 2;
if(keylen != ECDH_SIZE) {