X-Git-Url: http://tinc-vpn.org/git/browse?a=blobdiff_plain;f=src%2Fnet_setup.c;h=1ecb3c65f2cdf697ab111e946f7e8bedd5af5c1e;hb=cfe507c299935bd231be698b8a426cc730f52936;hp=7b4c741f0fe55ce1bd5daefcf39e2d990fa8867e;hpb=ddabda536acf33abbfef28bc199d2b3ae7219b46;p=tinc diff --git a/src/net_setup.c b/src/net_setup.c index 7b4c741f..1ecb3c65 100644 --- a/src/net_setup.c +++ b/src/net_setup.c @@ -1,7 +1,7 @@ /* net_setup.c -- Setup. Copyright (C) 1998-2005 Ivo Timmermans, - 2000-2017 Guus Sliepen + 2000-2021 Guus Sliepen 2006 Scott Lamb 2010 Brandon Black @@ -215,7 +215,7 @@ static bool read_ecdsa_private_key(void) { logger(DEBUG_ALWAYS, LOG_ERR, "Error reading Ed25519 private key file `%s': %s", fname, strerror(errno)); if(errno == ENOENT) { - logger(DEBUG_ALWAYS, LOG_INFO, "Create an Ed25519 keypair with `tinc -n %s generate-ed25519-keys'.", netname ? netname : "."); + logger(DEBUG_ALWAYS, LOG_INFO, "Create an Ed25519 key pair with `tinc -n %s generate-ed25519-keys'.", netname ? netname : "."); } free(fname); @@ -307,7 +307,7 @@ static bool read_rsa_private_key(void) { fname, strerror(errno)); if(errno == ENOENT) { - logger(DEBUG_ALWAYS, LOG_INFO, "Create an RSA keypair with `tinc -n %s generate-rsa-keys'.", netname ? netname : "."); + logger(DEBUG_ALWAYS, LOG_INFO, "Create an RSA key pair with `tinc -n %s generate-rsa-keys'.", netname ? netname : "."); } free(fname); @@ -1019,8 +1019,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 { @@ -1053,10 +1094,14 @@ static bool setup_myself(void) { devops = raw_socket_devops; } else if(!strcasecmp(type, "multicast")) { devops = multicast_devops; - } else if(!strcasecmp(type, "fd")) { + } + +#ifdef HAVE_SYS_UN_H + else if(!strcasecmp(type, "fd")) { devops = fd_devops; } +#endif #ifdef ENABLE_UML else if(!strcasecmp(type, "uml")) { devops = uml_devops;