From: bert hubert Date: Fri, 28 Feb 2014 10:22:31 +0000 (+0100) Subject: raise our socket buffer raise so it no longer generates a warning, move our checkFDs... X-Git-Tag: rec-3.6.0-rc1~157 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=4e9a20e65388fe341f9f454a88090f8993eb8ed0;p=pdns raise our socket buffer raise so it no longer generates a warning, move our checkFDs to separate function (still #ifdeffed out), add automated failsafe checking of Linux IPv6 limits & warning. We warn all the time, even if you don't yet use IPv6. Hoping people will see it! --- diff --git a/pdns/misc.cc b/pdns/misc.cc index 02344c1fa..53e980255 100644 --- a/pdns/misc.cc +++ b/pdns/misc.cc @@ -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)) diff --git a/pdns/misc.hh b/pdns/misc.hh index 9c71e228e..60855138f 100644 --- a/pdns/misc.hh +++ b/pdns/misc.hh @@ -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 diff --git a/pdns/pdns_recursor.cc b/pdns/pdns_recursor.cc index bead66752..393944848 100644 --- a/pdns/pdns_recursor.cc +++ b/pdns/pdns_recursor.cc @@ -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::const_iterator begin, vector::const_ return broadcastAccFunction(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< addrs; if(!::arg()["query-local-address6"].empty()) {