From f452009079b744ef896b5be4651e91a34c1a38c8 Mon Sep 17 00:00:00 2001 From: z3APA3A <3APA3A@3proxy.ru> Date: Mon, 14 Apr 2014 01:50:17 +0400 Subject: [PATCH] Some useful warnings added Checks for most common misconfigurations --- src/3proxy.c | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/src/3proxy.c b/src/3proxy.c index ba35112..af4e085 100644 --- a/src/3proxy.c +++ b/src/3proxy.c @@ -647,6 +647,9 @@ static int h_proxy(int argc, unsigned char ** argv){ childdef.isudp = 0; childdef.service = S_PROXY; childdef.helpmessage = " -n - no NTLM support\n"; + if(!resolvfunc || (resolvfunc == myresolver && !dns_table->hashsize)){ + fprintf(stderr, "[line %d] Warning: no nserver/nscache configured, proxy may run very slow\n", linenum); + } } else if(!strcmp((char *)argv[0], "pop3p")) { childdef.pf = pop3pchild; @@ -675,6 +678,9 @@ static int h_proxy(int argc, unsigned char ** argv){ childdef.isudp = 0; childdef.service = S_SOCKS; childdef.helpmessage = " -n - no NTLM support\n"; + if(!resolvfunc || (resolvfunc == myresolver && !dns_table->hashsize)){ + fprintf(stderr, "[line %d] Warning: no nserver/nscache configured, socks may run very slow\n", linenum); + } } else if(!strcmp((char *)argv[0], "tcppm")) { childdef.pf = tcppmchild; @@ -715,6 +721,9 @@ static int h_proxy(int argc, unsigned char ** argv){ childdef.port = 53; childdef.isudp = 1; childdef.service = S_DNSPR; + if(!resolvfunc || (resolvfunc == myresolver && !dns_table->hashsize) || resolvfunc == fake_resolver){ + fprintf(stderr, "[line %d] Warning: no nserver/nscache configured, dnspr will not work as expected\n", linenum); + } } return start_proxy_thread(&ch); } @@ -954,6 +963,18 @@ static int h_maxconn(int argc, unsigned char **argv){ if(!conf.maxchild) { return(1); } +#ifndef _WIN32 + { + struct rlimit rl; + if(!getrlimit(RLIMIT_NOFILE, &rl)){ + if((conf.maxchild<<1) > rl.rlim_cur) + fprintf(stderr, "[line %d] Warning: current open file ulimits are too low (cur: %d/max: %d)," + " maxconn requires at least %d for every running service." + " Configure ulimits according to system documentation\n", + linenum, (int)rl.rlim_cur, (int)rl.rlim_max, (conf.maxchild<<1)); + } + } +#endif return 0; }