]> granicus.if.org Git - pdns/commitdiff
raise our socket buffer raise so it no longer generates a warning, move our checkFDs...
authorbert hubert <bert.hubert@netherlabs.nl>
Fri, 28 Feb 2014 10:22:31 +0000 (11:22 +0100)
committerbert hubert <bert.hubert@netherlabs.nl>
Fri, 28 Feb 2014 10:22:31 +0000 (11:22 +0100)
pdns/misc.cc
pdns/misc.hh
pdns/pdns_recursor.cc

index 02344c1fa6cc6d425d25a5a3a8ee82667bd45b2e..53e9802552d6fa2f68bd334266c896c4a453a549 100644 (file)
@@ -758,6 +758,17 @@ bool stringfgets(FILE* fp, std::string& line)
   return true;
 }
 
+bool readFileIfThere(const char* fname, std::string* line)
+{
+  line->clear();
+  FILE* fp = fopen(fname, "r");
+  if(!fp)
+    return false;
+  stringfgets(fp, *line);
+  fclose(fp);
+  return true;
+}
+
 Regex::Regex(const string &expr)
 {
   if(regcomp(&d_preg, expr.c_str(), REG_ICASE|REG_NOSUB|REG_EXTENDED))
index 9c71e228eae4830eaebdf821390de51364726016..60855138fb11e719bec1d39a7a315a1bace00c3e 100644 (file)
@@ -507,4 +507,5 @@ void addCMsgSrcAddr(struct msghdr* msgh, void* cmsgbuf, ComboAddress* source);
 
 unsigned int getFilenumLimit(bool hardOrSoft=0);
 void setFilenumLimit(unsigned int lim);
+bool readFileIfThere(const char* fname, std::string* line);
 #endif
index bead667525f705682617897d42d4313b08259e1e..3939448480f5489aad580855120e118f027300c7 100644 (file)
@@ -1,6 +1,6 @@
 /*
     PowerDNS Versatile Database Driven Nameserver
-    Copyright (C) 2003 - 2013  PowerDNS.COM BV
+    Copyright (C) 2003 - 2014  PowerDNS.COM BV
 
     This program is free software; you can redistribute it and/or modify
     it under the terms of the GNU General Public License version 2 
@@ -1056,7 +1056,7 @@ void makeUDPServerSockets()
       throw PDNSException("Making a UDP server socket for resolver: "+netstringerror());
     }
 
-    setSocketReceiveBuffer(fd, 200000);
+    setSocketReceiveBuffer(fd, 250000);
     sin.sin4.sin_port = htons(st.port);
 
     int socklen=sin.sin4.sin_family==AF_INET ? sizeof(sin.sin4) : sizeof(sin.sin6);
@@ -1607,6 +1607,28 @@ string doTraceRegex(vector<string>::const_iterator begin, vector<string>::const_
   return broadcastAccFunction<string>(boost::bind(pleaseUseNewTraceRegex, begin!=end ? *begin : ""));
 }
 
+static void checkLinuxIPv6Limits()
+{
+#ifdef __linux__
+  string line;
+  if(readFileIfThere("/proc/sys/net/ipv6/route/max_size", &line)) {
+    int lim=atoi(line.c_str());
+    if(lim < 16384) {
+      L<<Logger::Error<<"If using IPv6, please raise sysctl net.ipv6.route.max_size, currently set to "<<lim<<", which is too low"<<endl;
+    }
+  }
+#endif
+}
+
+static void warnAboutFDS()
+{
+#if 0
+  unsigned int maxFDs, curFDs;
+  getFDLimits(curFDs, maxFDs);
+  if(curFDs < 2048) 
+    L<<Logger::Warning<<"Only "<<curFDs<<" file descriptors available (out of: "<<maxFDs<<"), may not be suitable for high performance"<<endl;
+#endif
+}
 
 void* recursorThread(void*);
 
@@ -1698,8 +1720,6 @@ void parseACLs()
 
 int serviceMain(int argc, char*argv[])
 {
-
-
   L.setName(s_programname);
 
   L.setLoglevel((Logger::Urgency)(6)); // info and up
@@ -1713,14 +1733,8 @@ int serviceMain(int argc, char*argv[])
   }
 
   showProductVersion();
-  
-  #if 0
-  unsigned int maxFDs, curFDs;
-  getFDLimits(curFDs, maxFDs);
-  if(curFDs < 2048) 
-    L<<Logger::Warning<<"Only "<<curFDs<<" file descriptors available (out of: "<<maxFDs<<"), may not be suitable for high performance"<<endl;
-  #endif
-  
+  warnAboutFDS();
+
   seedRandom(::arg()["entropy-source"]);
 
   parseACLs();
@@ -1757,7 +1771,7 @@ int serviceMain(int argc, char*argv[])
     g_quiet=false;
   }
   
-  
+  checkLinuxIPv6Limits();
   try {
     vector<string> addrs;  
     if(!::arg()["query-local-address6"].empty()) {