X-Git-Url: https://tinc-vpn.org/git/browse?p=tinc;a=blobdiff_plain;f=src%2Fnet_setup.c;h=765a9ebf37a1ea0bd11b01c49b84247b6e76d87c;hp=60335fd08df50955cc243f54217de043a6143d05;hb=c72e237caa22525ab36a8286758e47544db3d496;hpb=5eb72b73d3cd842e71e525413a46a55644ac3583 diff --git a/src/net_setup.c b/src/net_setup.c index 60335fd0..765a9ebf 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-2013 Guus Sliepen + 2000-2014 Guus Sliepen 2006 Scott Lamb 2010 Brandon Black @@ -404,6 +404,7 @@ static bool setup_myself(void) { proxytype = PROXY_EXEC; } else { logger(LOG_ERR, "Unknown proxy type %s!", proxy); + free(proxy); return false; } @@ -415,6 +416,7 @@ static bool setup_myself(void) { case PROXY_EXEC: if(!space || !*space) { logger(LOG_ERR, "Argument expected for proxy type exec!"); + free(proxy); return false; } proxyhost = xstrdup(space); @@ -433,6 +435,7 @@ static bool setup_myself(void) { *space++ = 0, proxypass = space; if(!proxyhost || !*proxyhost || !proxyport || !*proxyport) { logger(LOG_ERR, "Host and port argument expected for proxy!"); + free(proxy); return false; } proxyhost = xstrdup(proxyhost); @@ -486,6 +489,7 @@ static bool setup_myself(void) { routing_mode = RMODE_HUB; else { logger(LOG_ERR, "Invalid routing mode!"); + free(mode); return false; } free(mode); @@ -500,6 +504,7 @@ static bool setup_myself(void) { forwarding_mode = FMODE_KERNEL; else { logger(LOG_ERR, "Invalid forwarding mode!"); + free(mode); return false; } free(mode); @@ -526,6 +531,7 @@ static bool setup_myself(void) { broadcast_mode = BMODE_DIRECT; else { logger(LOG_ERR, "Invalid broadcast mode!"); + free(mode); return false; } free(mode); @@ -533,7 +539,12 @@ static bool setup_myself(void) { #if !defined(SOL_IP) || !defined(IP_TOS) if(priorityinheritance) - logger(LOG_WARNING, "%s not supported on this platform", "PriorityInheritance"); + logger(LOG_WARNING, "%s not supported on this platform for IPv4 connection", "PriorityInheritance"); +#endif + +#if !defined(IPPROTO_IPV6) || !defined(IPV6_TCLASS) + if(priorityinheritance) + logger(LOG_WARNING, "%s not supported on this platform for IPv6 connection", "PriorityInheritance"); #endif if(!get_config_int(lookup_config(config_tree, "MACExpire"), &macexpire)) @@ -547,6 +558,18 @@ static bool setup_myself(void) { } else maxtimeout = 900; + if(get_config_int(lookup_config(config_tree, "MinTimeout"), &mintimeout)) { + if(mintimeout < 0) { + logger(LOG_ERR, "Bogus minimum timeout!"); + return false; + } + if(mintimeout > maxtimeout) { + logger(LOG_WARNING, "Minimum timeout (%d s) cannot be larger than maximum timeout (%d s). Correcting !", mintimeout, maxtimeout ); + mintimeout=maxtimeout; + } + } else + mintimeout = 0; + if(get_config_int(lookup_config(config_tree, "UDPRcvBuf"), &udp_rcvbuf)) { if(udp_rcvbuf <= 0) { logger(LOG_ERR, "UDPRcvBuf cannot be negative!"); @@ -707,6 +730,12 @@ static bool setup_myself(void) { xasprintf(&envp[2], "INTERFACE=%s", iface ? : ""); xasprintf(&envp[3], "NAME=%s", myself->name); +#ifdef HAVE_MINGW + Sleep(1000); +#endif +#ifdef HAVE_CYGWIN + sleep(1); +#endif execute_script("tinc-up", envp); for(i = 0; i < 4; i++)