projects
/
tinc
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Bump minor protocol to indicate ECDH capability for UDP session keys.
[tinc]
/
src
/
protocol_auth.c
diff --git
a/src/protocol_auth.c
b/src/protocol_auth.c
index
8527230
..
d98e5c4
100644
(file)
--- a/
src/protocol_auth.c
+++ b/
src/protocol_auth.c
@@
-1,7
+1,7
@@
/*
protocol_auth.c -- handle the meta-protocol, authentication
Copyright (C) 1999-2005 Ivo Timmermans,
/*
protocol_auth.c -- handle the meta-protocol, authentication
Copyright (C) 1999-2005 Ivo Timmermans,
- 2000-20
09
Guus Sliepen <guus@tinc-vpn.org>
+ 2000-20
10
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
@@
-40,14
+40,14
@@
bool send_id(connection_t *c) {
gettimeofday(&c->start, NULL);
bool send_id(connection_t *c) {
gettimeofday(&c->start, NULL);
- return send_request(c, "%d %s %d", ID, myself->connection->name,
- myself->connection->protocol_
version
);
+ return send_request(c, "%d %s %d
.%d
", ID, myself->connection->name,
+ myself->connection->protocol_
major, myself->connection->protocol_minor
);
}
bool id_h(connection_t *c, char *request) {
char name[MAX_STRING_SIZE];
}
bool id_h(connection_t *c, char *request) {
char name[MAX_STRING_SIZE];
- if(sscanf(request, "%*d " MAX_STRING " %d
", name, &c->protocol_version) !=
2) {
+ if(sscanf(request, "%*d " MAX_STRING " %d
.%d", name, &c->protocol_major, &c->protocol_minor) <
2) {
logger(LOG_ERR, "Got bad %s from %s (%s)", "ID", c->name,
c->hostname);
return false;
logger(LOG_ERR, "Got bad %s from %s (%s)", "ID", c->name,
c->hostname);
return false;
@@
-86,9
+86,9
@@
bool id_h(connection_t *c, char *request) {
/* Check if version matches */
/* Check if version matches */
- if(c->protocol_
version != myself->connection->protocol_version
) {
- logger(LOG_ERR, "Peer %s (%s) uses incompatible version %d",
- c->name, c->hostname, c->protocol_
version
);
+ if(c->protocol_
major != myself->connection->protocol_major
) {
+ logger(LOG_ERR, "Peer %s (%s) uses incompatible version %d
.%d
",
+ c->name, c->hostname, c->protocol_
major, c->protocol_minor
);
return false;
}
return false;
}
@@
-261,7
+261,7
@@
bool send_challenge(connection_t *c) {
bool challenge_h(connection_t *c, char *request) {
char buffer[MAX_STRING_SIZE];
size_t len = rsa_size(&myself->connection->rsa);
bool challenge_h(connection_t *c, char *request) {
char buffer[MAX_STRING_SIZE];
size_t len = rsa_size(&myself->connection->rsa);
- size_t digestlen = digest_length(&c->
out
digest);
+ size_t digestlen = digest_length(&c->
in
digest);
char digest[digestlen];
if(sscanf(request, "%*d " MAX_STRING, buffer) != 1) {
char digest[digestlen];
if(sscanf(request, "%*d " MAX_STRING, buffer) != 1) {
@@
-357,6
+357,11
@@
bool send_ack(connection_t *c) {
if(myself->options & OPTION_PMTU_DISCOVERY)
c->options |= OPTION_PMTU_DISCOVERY;
if(myself->options & OPTION_PMTU_DISCOVERY)
c->options |= OPTION_PMTU_DISCOVERY;
+ choice = myself->options & OPTION_CLAMP_MSS;
+ get_config_bool(lookup_config(c->config_tree, "ClampMSS"), &choice);
+ if(choice)
+ c->options |= OPTION_CLAMP_MSS;
+
get_config_int(lookup_config(c->config_tree, "Weight"), &c->estimated_weight);
return send_request(c, "%d %s %d %x", ACK, myport, c->estimated_weight, c->options);
get_config_int(lookup_config(c->config_tree, "Weight"), &c->estimated_weight);
return send_request(c, "%d %s %d %x", ACK, myport, c->estimated_weight, c->options);
@@
-396,10
+401,11
@@
static void send_everything(connection_t *c) {
bool ack_h(connection_t *c, char *request) {
char hisport[MAX_STRING_SIZE];
bool ack_h(connection_t *c, char *request) {
char hisport[MAX_STRING_SIZE];
- char *hisaddress
, *dummy
;
+ char *hisaddress;
int weight, mtu;
uint32_t options;
node_t *n;
int weight, mtu;
uint32_t options;
node_t *n;
+ bool choice;
if(sscanf(request, "%*d " MAX_STRING " %d %x", hisport, &weight, &options) != 3) {
logger(LOG_ERR, "Got bad %s from %s (%s)", "ACK", c->name,
if(sscanf(request, "%*d " MAX_STRING " %d %x", hisport, &weight, &options) != 3) {
logger(LOG_ERR, "Got bad %s from %s (%s)", "ACK", c->name,
@@
-446,9
+452,19
@@
bool ack_h(connection_t *c, char *request) {
if(get_config_int(lookup_config(c->config_tree, "PMTU"), &mtu) && mtu < n->mtu)
n->mtu = mtu;
if(get_config_int(lookup_config(c->config_tree, "PMTU"), &mtu) && mtu < n->mtu)
n->mtu = mtu;
- if(get_config_int(lookup_config(
myself->connection->
config_tree, "PMTU"), &mtu) && mtu < n->mtu)
+ if(get_config_int(lookup_config(config_tree, "PMTU"), &mtu) && mtu < n->mtu)
n->mtu = mtu;
n->mtu = mtu;
+ if(get_config_bool(lookup_config(c->config_tree, "ClampMSS"), &choice)) {
+ if(choice)
+ c->options |= OPTION_CLAMP_MSS;
+ else
+ c->options &= ~OPTION_CLAMP_MSS;
+ }
+
+ if(c->protocol_minor > 0)
+ c->node->status.ecdh = true;
+
/* Activate this connection */
c->allow_request = ALL;
/* Activate this connection */
c->allow_request = ALL;
@@
-466,10
+482,9
@@
bool ack_h(connection_t *c, char *request) {
c->edge = new_edge();
c->edge->from = myself;
c->edge->to = n;
c->edge = new_edge();
c->edge->from = myself;
c->edge->to = n;
- sockaddr2str(&c->address, &hisaddress,
&dummy
);
+ sockaddr2str(&c->address, &hisaddress,
NULL
);
c->edge->address = str2sockaddr(hisaddress, hisport);
free(hisaddress);
c->edge->address = str2sockaddr(hisaddress, hisport);
free(hisaddress);
- free(dummy);
c->edge->weight = (weight + c->estimated_weight) / 2;
c->edge->connection = c;
c->edge->options = c->options;
c->edge->weight = (weight + c->estimated_weight) / 2;
c->edge->connection = c;
c->edge->options = c->options;