X-Git-Url: https://www.tinc-vpn.org/git/browse?a=blobdiff_plain;f=src%2Ftincd.c;h=b62c8c1903a7cf30002b2a1a0ba57efd1f9ce2fa;hb=11868b890d1a7f4cfbfb37099393b32019010f66;hp=d497bccc063132bb10b3f03070f4b2a615ae1207;hpb=6568cffd52d4803effaf52a9bb9c98d69cf7922a;p=tinc diff --git a/src/tincd.c b/src/tincd.c index d497bccc..b62c8c19 100644 --- a/src/tincd.c +++ b/src/tincd.c @@ -1,7 +1,7 @@ /* tincd.c -- the main file for tincd Copyright (C) 1998-2005 Ivo Timmermans - 2000-2014 Guus Sliepen + 2000-2015 Guus Sliepen 2008 Max Rijevski 2009 Michael Tokarev 2010 Julien Muchembled @@ -339,11 +339,11 @@ int main(int argc, char **argv) { if(!parse_options(argc, argv)) return 1; - make_names(); + make_names(true); if(show_version) { printf("%s version %s (built %s %s, protocol %d.%d)\n", PACKAGE, - VERSION, BUILD_DATE, BUILD_TIME, PROT_MAJOR, PROT_MINOR); + BUILD_VERSION, BUILD_DATE, BUILD_TIME, PROT_MAJOR, PROT_MINOR); printf("Copyright (C) 1998-2014 Ivo Timmermans, Guus Sliepen and others.\n" "See the AUTHORS file for a complete list.\n\n" "tinc comes with ABSOLUTELY NO WARRANTY. This is free software,\n" @@ -363,6 +363,14 @@ int main(int argc, char **argv) { logger(DEBUG_ALWAYS, LOG_ERR, "System call `%s' failed: %s", "WSAStartup", winerror(GetLastError())); return 1; } +#else + // Check if we got an umbilical fd from the process that started us + char *umbstr = getenv("TINC_UMBILICAL"); + if(umbstr) { + umbilical = atoi(umbstr); + if(fcntl(umbilical, F_GETFL) < 0) + umbilical = 0; + } #endif openlogger("tinc", use_logfile?LOGMODE_FILE:LOGMODE_STDERR); @@ -466,6 +474,12 @@ int main2(int argc, char **argv) { logger(DEBUG_ALWAYS, LOG_NOTICE, "Ready"); + if(umbilical) { // snip! + write(umbilical, "", 1); + close(umbilical); + umbilical = 0; + } + try_outgoing_connections(); status = main_loop();