projects
/
tinc
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Put Subnet weight in a separate environment variable.
[tinc]
/
src
/
protocol_auth.c
diff --git
a/src/protocol_auth.c
b/src/protocol_auth.c
index
4c88562
..
4816610
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
9
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
@@
-68,9
+68,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);
@@
-130,8
+130,7
@@
bool send_metakey(connection_t *c)
buffer = alloca(2 * len + 1);
buffer = alloca(2 * len + 1);
- if(!c->outkey)
- c->outkey = xmalloc(len);
+ c->outkey = xrealloc(c->outkey, len);
if(!c->outctx)
c->outctx = xmalloc_and_zero(sizeof(*c->outctx));
if(!c->outctx)
c->outctx = xmalloc_and_zero(sizeof(*c->outctx));
@@
-227,8
+226,7
@@
bool metakey_h(connection_t *c)
/* Allocate buffers for the meta key */
/* Allocate buffers for the meta key */
- if(!c->inkey)
- c->inkey = xmalloc(len);
+ c->inkey = xrealloc(c->inkey, len);
if(!c->inctx)
c->inctx = xmalloc_and_zero(sizeof(*c->inctx));
if(!c->inctx)
c->inctx = xmalloc_and_zero(sizeof(*c->inctx));
@@
-240,7
+238,7
@@
bool metakey_h(connection_t *c)
/* Decrypt the meta key */
if(RSA_private_decrypt(len, (unsigned char *)buffer, (unsigned char *)c->inkey, myself->connection->rsa_key, RSA_NO_PADDING) != len) { /* See challenge() */
/* Decrypt the meta key */
if(RSA_private_decrypt(len, (unsigned char *)buffer, (unsigned char *)c->inkey, myself->connection->rsa_key, RSA_NO_PADDING) != len) { /* See challenge() */
- logger(LOG_ERR, _("Error during
en
cryption of meta key for %s (%s)"),
+ logger(LOG_ERR, _("Error during
de
cryption of meta key for %s (%s)"),
c->name, c->hostname);
return false;
}
c->name, c->hostname);
return false;
}
@@
-317,8
+315,7
@@
bool send_challenge(connection_t *c)
buffer = alloca(2 * len + 1);
buffer = alloca(2 * len + 1);
- if(!c->hischallenge)
- c->hischallenge = xmalloc(len);
+ c->hischallenge = xrealloc(c->hischallenge, len);
/* Copy random data to the buffer */
/* Copy random data to the buffer */
@@
-359,8
+356,7
@@
bool challenge_h(connection_t *c)
/* Allocate buffers for the challenge */
/* Allocate buffers for the challenge */
- if(!c->mychallenge)
- c->mychallenge = xmalloc(len);
+ c->mychallenge = xrealloc(c->mychallenge, len);
/* Convert the challenge from hexadecimal back to binary */
/* Convert the challenge from hexadecimal back to binary */
@@
-483,7
+479,7
@@
bool send_ack(connection_t *c)
if((get_config_bool(lookup_config(c->config_tree, "TCPOnly"), &choice) && choice) || myself->options & OPTION_TCPONLY)
c->options |= OPTION_TCPONLY | OPTION_INDIRECT;
if((get_config_bool(lookup_config(c->config_tree, "TCPOnly"), &choice) && choice) || myself->options & OPTION_TCPONLY)
c->options |= OPTION_TCPONLY | OPTION_INDIRECT;
- if(
(get_config_bool(lookup_config(c->config_tree, "PMTUDiscovery"), &choice) && choice) ||
myself->options & OPTION_PMTU_DISCOVERY)
+ if(myself->options & OPTION_PMTU_DISCOVERY)
c->options |= OPTION_PMTU_DISCOVERY;
get_config_int(lookup_config(c->config_tree, "Weight"), &c->estimated_weight);
c->options |= OPTION_PMTU_DISCOVERY;
get_config_int(lookup_config(c->config_tree, "Weight"), &c->estimated_weight);
@@
-561,6
+557,10
@@
bool ack_h(connection_t *c)
n->connection = c;
c->node = n;
n->connection = c;
c->node = n;
+ if(!(c->options & options & OPTION_PMTU_DISCOVERY)) {
+ c->options &= ~OPTION_PMTU_DISCOVERY;
+ options &= ~OPTION_PMTU_DISCOVERY;
+ }
c->options |= options;
if(get_config_int(lookup_config(c->config_tree, "PMTU"), &mtu) && mtu < n->mtu)
c->options |= options;
if(get_config_int(lookup_config(c->config_tree, "PMTU"), &mtu) && mtu < n->mtu)