projects
/
oweals
/
tinc.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Make MSS clamping configurable, but enabled by default.
[oweals/tinc.git]
/
src
/
net_setup.c
diff --git
a/src/net_setup.c
b/src/net_setup.c
index 2b177c1398bdd175c3d1966f9c70f66a4eebec3e..7d20803d28f755843d5ed2dbb6b7acce4c784f6d 100644
(file)
--- a/
src/net_setup.c
+++ b/
src/net_setup.c
@@
-2,6
+2,7
@@
net_setup.c -- Setup.
Copyright (C) 1998-2005 Ivo Timmermans,
2000-2009 Guus Sliepen <guus@tinc-vpn.org>
net_setup.c -- Setup.
Copyright (C) 1998-2005 Ivo Timmermans,
2000-2009 Guus Sliepen <guus@tinc-vpn.org>
+ 2006 Scott Lamb <slamb@slamb.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
@@
-217,8
+218,8
@@
bool setup_myself(void) {
myself->connection = new_connection();
init_configuration(&myself->connection->config_tree);
myself->connection = new_connection();
init_configuration(&myself->connection->config_tree);
-
xasprintf(&myself->hostname,
"MYSELF");
-
xasprintf(&myself->connection->hostname,
"MYSELF");
+
myself->hostname = xstrdup(
"MYSELF");
+
myself->connection->hostname = xstrdup(
"MYSELF");
myself->connection->options = 0;
myself->connection->protocol_version = PROT_CURRENT;
myself->connection->options = 0;
myself->connection->protocol_version = PROT_CURRENT;
@@
-245,8
+246,9
@@
bool setup_myself(void) {
if(!read_rsa_private_key())
return false;
if(!read_rsa_private_key())
return false;
- if(!get_config_string(lookup_config(myself->connection->config_tree, "Port"), &myport))
- xasprintf(&myport, "655");
+ if(!get_config_string(lookup_config(config_tree, "Port"), &myport)
+ && !get_config_string(lookup_config(myself->connection->config_tree, "Port"), &myport))
+ myport = xstrdup("655");
/* Read in all the subnets specified in the host configuration file */
/* Read in all the subnets specified in the host configuration file */
@@
-295,13
+297,18
@@
bool setup_myself(void) {
} else
routing_mode = RMODE_ROUTER;
} else
routing_mode = RMODE_ROUTER;
- // Enable PMTUDiscovery by default if we are in router mode.
-
- choice = routing_mode == RMODE_ROUTER;
+ choice = true;
get_config_bool(lookup_config(myself->connection->config_tree, "PMTUDiscovery"), &choice);
get_config_bool(lookup_config(myself->connection->config_tree, "PMTUDiscovery"), &choice);
- if(choice)
+ get_config_bool(lookup_config(config_tree, "PMTUDiscovery"), &choice);
+ if(choice)
myself->options |= OPTION_PMTU_DISCOVERY;
myself->options |= OPTION_PMTU_DISCOVERY;
+ choice = true;
+ get_config_bool(lookup_config(config_tree, "ClampMSS"), &choice);
+ get_config_bool(lookup_config(myself->connection->config_tree, "ClampMSS"), &choice);
+ if(choice)
+ myself->options |= OPTION_CLAMP_MSS;
+
get_config_bool(lookup_config(config_tree, "PriorityInheritance"), &priorityinheritance);
#if !defined(SOL_IP) || !defined(IP_TOS)
get_config_bool(lookup_config(config_tree, "PriorityInheritance"), &priorityinheritance);
#if !defined(SOL_IP) || !defined(IP_TOS)
@@
-351,14
+358,14
@@
bool setup_myself(void) {
}
}
} else
}
}
} else
- myself->incipher = EVP_
aes_256
_cbc();
+ myself->incipher = EVP_
bf
_cbc();
if(myself->incipher)
myself->inkeylength = myself->incipher->key_len + myself->incipher->iv_len;
else
myself->inkeylength = 1;
if(myself->incipher)
myself->inkeylength = myself->incipher->key_len + myself->incipher->iv_len;
else
myself->inkeylength = 1;
- myself->connection->outcipher = EVP_
aes_256
_ofb();
+ myself->connection->outcipher = EVP_
bf
_ofb();
if(!get_config_int(lookup_config(config_tree, "KeyExpire"), &keylifetime))
keylifetime = 3600;
if(!get_config_int(lookup_config(config_tree, "KeyExpire"), &keylifetime))
keylifetime = 3600;
@@
-379,9
+386,9
@@
bool setup_myself(void) {
}
}
} else
}
}
} else
- myself->indigest = EVP_sha
256
();
+ myself->indigest = EVP_sha
1
();
- myself->connection->outdigest = EVP_sha
256
();
+ myself->connection->outdigest = EVP_sha
1
();
if(get_config_int(lookup_config(myself->connection->config_tree, "MACLength"), &myself->inmaclength)) {
if(myself->indigest) {
if(get_config_int(lookup_config(myself->connection->config_tree, "MACLength"), &myself->inmaclength)) {
if(myself->indigest) {
@@
-540,10
+547,17
@@
void close_network_connections(void) {
for(node = connection_tree->head; node; node = next) {
next = node->next;
c = node->data;
for(node = connection_tree->head; node; node = next) {
next = node->next;
c = node->data;
- c->outgoing =
false
;
+ c->outgoing =
NULL
;
terminate_connection(c, false);
}
terminate_connection(c, false);
}
+ for(list_node_t *node = outgoing_list->head; node; node = node->next) {
+ outgoing_t *outgoing = node->data;
+
+ if(outgoing->event)
+ event_del(outgoing->event);
+ }
+
list_delete_list(outgoing_list);
if(myself && myself->connection) {
list_delete_list(outgoing_list);
if(myself && myself->connection) {