projects
/
tinc
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Merge branch 'master' of black:tinc
[tinc]
/
src
/
protocol_auth.c
diff --git
a/src/protocol_auth.c
b/src/protocol_auth.c
index
24f591a
..
cde7ead
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
@@
-109,15
+109,13
@@
bool id_h(connection_t *c) {
}
bool send_metakey(connection_t *c) {
}
bool send_metakey(connection_t *c) {
- char *buffer;
- int len;
bool x;
bool x;
- len = RSA_size(c->rsa_key);
+
int
len = RSA_size(c->rsa_key);
/* Allocate buffers for the meta key */
/* Allocate buffers for the meta key */
-
buffer = alloca(2 * len + 1)
;
+
char buffer[2 * len + 1]
;
c->outkey = xrealloc(c->outkey, len);
c->outkey = xrealloc(c->outkey, len);
@@
-287,16
+285,13
@@
bool metakey_h(connection_t *c) {
}
bool send_challenge(connection_t *c) {
}
bool send_challenge(connection_t *c) {
- char *buffer;
- int len;
-
/* CHECKME: what is most reasonable value for len? */
/* CHECKME: what is most reasonable value for len? */
- len = RSA_size(c->rsa_key);
+
int
len = RSA_size(c->rsa_key);
/* Allocate buffers for the challenge */
/* Allocate buffers for the challenge */
-
buffer = alloca(2 * len + 1)
;
+
char buffer[2 * len + 1]
;
c->hischallenge = xrealloc(c->hischallenge, len);
c->hischallenge = xrealloc(c->hischallenge, len);
@@
-453,9
+448,14
@@
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);
get_config_int(lookup_config(c->config_tree, "Weight"), &c->estimated_weight);
- return send_request(c, "%d %s %d %
l
x", ACK, myport, c->estimated_weight, c->options);
+ return send_request(c, "%d %s %d %x", ACK, myport, c->estimated_weight, c->options);
}
static void send_everything(connection_t *c) {
}
static void send_everything(connection_t *c) {
@@
-492,12
+492,13
@@
static void send_everything(connection_t *c) {
bool ack_h(connection_t *c) {
char hisport[MAX_STRING_SIZE];
bool ack_h(connection_t *c) {
char hisport[MAX_STRING_SIZE];
- char *hisaddress
, *dummy
;
+ char *hisaddress;
int weight, mtu;
int weight, mtu;
-
long in
t options;
+
uint32_
t options;
node_t *n;
node_t *n;
+ bool choice;
- if(sscanf(c->buffer, "%*d " MAX_STRING " %d %
l
x", hisport, &weight, &options) != 3) {
+ if(sscanf(c->buffer, "%*d " MAX_STRING " %d %x", hisport, &weight, &options) != 3) {
logger(LOG_ERR, "Got bad %s from %s (%s)", "ACK", c->name,
c->hostname);
return false;
logger(LOG_ERR, "Got bad %s from %s (%s)", "ACK", c->name,
c->hostname);
return false;
@@
-533,9
+534,16
@@
bool ack_h(connection_t *c) {
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;
+ }
+
/* Activate this connection */
c->allow_request = ALL;
/* Activate this connection */
c->allow_request = ALL;
@@
-553,10
+561,9
@@
bool ack_h(connection_t *c) {
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;