X-Git-Url: https://tinc-vpn.org/git/browse?a=blobdiff_plain;f=src%2Fnet_setup.c;h=a04f9535ae63746aaa97cf0c99aa5a2cc9f4d763;hb=4214794ce68b9456146a5bf35db9e58da836b728;hp=82f9bbcdfcd1eca64791fcd959ac5754549e70d5;hpb=0345a1468613e1ba4a4aa6dbbef44a26f1eb42d9;p=tinc diff --git a/src/net_setup.c b/src/net_setup.c index 82f9bbcd..a04f9535 100644 --- a/src/net_setup.c +++ b/src/net_setup.c @@ -231,7 +231,7 @@ static bool read_ecdsa_private_key(void) { return false; } - if(s.st_mode & ~0100700) { + if(s.st_mode & ~0100700u) { logger(DEBUG_ALWAYS, LOG_WARNING, "Warning: insecure file permissions for Ed25519 private key file `%s'!", fname); } @@ -323,7 +323,7 @@ static bool read_rsa_private_key(void) { return false; } - if(s.st_mode & ~0100700) { + if(s.st_mode & ~0100700u) { logger(DEBUG_ALWAYS, LOG_WARNING, "Warning: insecure file permissions for RSA private key file `%s'!", fname); } @@ -935,6 +935,8 @@ static bool setup_myself(void) { logger(DEBUG_ALWAYS, LOG_ERR, "UDPRcvBuf cannot be negative!"); return false; } + + udp_rcvbuf_warnings = true; } if(get_config_int(lookup_config(config_tree, "UDPSndBuf"), &udp_sndbuf)) { @@ -942,6 +944,8 @@ static bool setup_myself(void) { logger(DEBUG_ALWAYS, LOG_ERR, "UDPSndBuf cannot be negative!"); return false; } + + udp_sndbuf_warnings = true; } get_config_int(lookup_config(config_tree, "FWMark"), &fwmark); @@ -1019,8 +1023,49 @@ static bool setup_myself(void) { /* Compression */ if(get_config_int(lookup_config(config_tree, "Compression"), &myself->incompression)) { - if(myself->incompression < 0 || myself->incompression > 11) { + switch(myself->incompression) { + case 12: +#ifdef HAVE_LZ4 + break; +#else + logger(DEBUG_ALWAYS, LOG_ERR, "Bogus compression level!"); + logger(DEBUG_ALWAYS, LOG_ERR, "LZ4 compression is unavailable on this node."); + return false; +#endif + + case 11: + case 10: +#ifdef HAVE_LZO + break; +#else + logger(DEBUG_ALWAYS, LOG_ERR, "Bogus compression level!"); + logger(DEBUG_ALWAYS, LOG_ERR, "LZO compression is unavailable on this node."); + return false; +#endif + + case 9: + case 8: + case 7: + case 6: + case 5: + case 4: + case 3: + case 2: + case 1: +#ifdef HAVE_ZLIB + break; +#else + logger(DEBUG_ALWAYS, LOG_ERR, "Bogus compression level!"); + logger(DEBUG_ALWAYS, LOG_ERR, "ZLIB compression is unavailable on this node."); + return false; +#endif + + case 0: + break; + + default: logger(DEBUG_ALWAYS, LOG_ERR, "Bogus compression level!"); + logger(DEBUG_ALWAYS, LOG_ERR, "Compression level %i is unrecognized by this node.", myself->incompression); return false; } } else { @@ -1285,7 +1330,7 @@ void close_network_connections(void) { if(myself && myself->connection) { subnet_update(myself, NULL, false); - connection_del(myself->connection); + free_connection(myself->connection); } for(int i = 0; i < listen_sockets; i++) {