Remove checkpoint tracing.
[tinc] / src / net_setup.c
index 4eef68e..12b09a9 100644 (file)
     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
     GNU General Public License for more details.
 
-    You should have received a copy of the GNU General Public License
-    along with this program; if not, write to the Free Software
-    Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
-
-    $Id$
+    You should have received a copy of the GNU General Public License along
+    with this program; if not, write to the Free Software Foundation, Inc.,
+    51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
 */
 
 #include "system.h"
 
 char *myport;
 
-bool read_rsa_public_key(connection_t *c)
-{
+bool read_rsa_public_key(connection_t *c) {
        FILE *fp;
        char *fname;
        char *key;
 
-       cp();
-
        if(!c->rsa_key) {
                c->rsa_key = RSA_new();
 //             RSA_blinding_on(c->rsa_key, NULL);
@@ -147,14 +142,11 @@ bool read_rsa_public_key(connection_t *c)
        return false;
 }
 
-bool read_rsa_private_key(void)
-{
+bool read_rsa_private_key(void) {
        FILE *fp;
        char *fname, *key, *pubkey;
        struct stat s;
 
-       cp();
-
        if(get_config_string(lookup_config(config_tree, "PrivateKey"), &key)) {
                if(!get_config_string(lookup_config(myself->connection->config_tree, "PublicKey"), &pubkey)) {
                        logger(LOG_ERR, _("PrivateKey used but no PublicKey found!"));
@@ -211,8 +203,7 @@ bool read_rsa_private_key(void)
 /*
   Configure node_t myself and set up the local sockets (listen only)
 */
-bool setup_myself(void)
-{
+bool setup_myself(void) {
        config_t *cfg;
        subnet_t *subnet;
        char *name, *hostname, *mode, *afname, *cipher, *digest;
@@ -222,8 +213,6 @@ bool setup_myself(void)
        bool choice;
        int i, err;
 
-       cp();
-
        myself = new_node();
        myself->connection = new_connection();
        init_configuration(&myself->connection->config_tree);
@@ -306,9 +295,12 @@ bool setup_myself(void)
        } else
                routing_mode = RMODE_ROUTER;
 
-       if(routing_mode == RMODE_ROUTER)
-               if(!get_config_bool(lookup_config(myself->connection->config_tree, "PMTUDiscovery"), &choice) || choice)
-                       myself->options |= OPTION_PMTU_DISCOVERY;
+       // Enable PMTUDiscovery by default if we are in router mode.
+
+       choice = routing_mode == RMODE_ROUTER;
+       get_config_bool(lookup_config(myself->connection->config_tree, "PMTUDiscovery"), &choice);
+       if(choice)      
+               myself->options |= OPTION_PMTU_DISCOVERY;
 
        get_config_bool(lookup_config(config_tree, "PriorityInheritance"), &priorityinheritance);
 
@@ -359,14 +351,14 @@ bool setup_myself(void)
                        }
                }
        } else
-               myself->incipher = EVP_bf_cbc();
+               myself->incipher = EVP_aes_256_cbc();
 
        if(myself->incipher)
                myself->inkeylength = myself->incipher->key_len + myself->incipher->iv_len;
        else
                myself->inkeylength = 1;
 
-       myself->connection->outcipher = EVP_bf_ofb();
+       myself->connection->outcipher = EVP_aes_256_ofb();
 
        if(!get_config_int(lookup_config(config_tree, "KeyExpire"), &keylifetime))
                keylifetime = 3600;
@@ -387,9 +379,9 @@ bool setup_myself(void)
                        }
                }
        } else
-               myself->indigest = EVP_sha1();
+               myself->indigest = EVP_sha256();
 
-       myself->connection->outdigest = EVP_sha1();
+       myself->connection->outdigest = EVP_sha256();
 
        if(get_config_int(lookup_config(myself->connection->config_tree, "MACLength"), &myself->inmaclength)) {
                if(myself->indigest) {
@@ -505,10 +497,7 @@ bool setup_myself(void)
 /*
   initialize network
 */
-bool setup_network(void)
-{
-       cp();
-
+bool setup_network(void) {
        now = time(NULL);
 
        init_events();
@@ -542,15 +531,12 @@ bool setup_network(void)
 /*
   close all open network connections
 */
-void close_network_connections(void)
-{
+void close_network_connections(void) {
        avl_node_t *node, *next;
        connection_t *c;
        char *envp[5];
        int i;
 
-       cp();
-
        for(node = connection_tree->head; node; node = next) {
                next = node->next;
                c = node->data;