]> git.ipfire.org Git - thirdparty/pdns.git/blobdiff - pdns/nproxy.cc
Merge pull request #14182 from rgacogne/ddist-dynblock-tag
[thirdparty/pdns.git] / pdns / nproxy.cc
index 705a1fce1d719502d5bdcbc5993fafdf1345eb9d..167b15a405b135a53cf1565bb00d0b3a896cba3b 100644 (file)
@@ -25,7 +25,6 @@
 #include <bitset>
 #include "dnsparser.hh"
 #include "iputils.hh"
-#undef L
 #include <boost/program_options.hpp>
 
 #include <boost/format.hpp>
@@ -45,7 +44,6 @@
 
 #include "namespaces.hh"
 using namespace ::boost::multi_index;
-#include "namespaces.hh"
 
 namespace po = boost::program_options;
 po::variables_map g_vm;
@@ -68,13 +66,13 @@ struct NotificationInFlight
 typedef map<uint16_t, NotificationInFlight> nifs_t;
 nifs_t g_nifs;
 
-void syslogFmt(const boost::format& fmt)
+static void syslogFmt(const boost::format& fmt)
 {
   cerr<<"nproxy: "<<fmt<<endl;
   syslog(LOG_WARNING, "%s", str(fmt).c_str());
 }
 
-void handleOutsideUDPPacket(int fd, boost::any&)
+static void handleOutsideUDPPacket(int fd, boost::any&)
 try
 {
   char buffer[1500];
@@ -146,7 +144,7 @@ catch(std::exception &e)
 }
 
 
-void handleInsideUDPPacket(int fd, boost::any&)
+static void handleInsideUDPPacket(int fd, boost::any&)
 try
 {
   char buffer[1500];
@@ -192,7 +190,7 @@ catch(std::exception &e)
   syslogFmt(boost::format("Error parsing packet from internal nameserver: %s") % e.what());
 }
 
-void expireOldNotifications()
+static void expireOldNotifications()
 {
   time_t limit = time(0) - 10;
   for(nifs_t::iterator iter = g_nifs.begin(); iter != g_nifs.end(); ) {
@@ -205,9 +203,19 @@ void expireOldNotifications()
   }
 }
 
-void daemonize(int null_fd);
+static void daemonize(int null_fd)
+{
+  if(fork())
+    exit(0); // bye bye
+
+  setsid();
+
+  dup2(null_fd,0); /* stdin */
+  dup2(null_fd,1); /* stderr */
+  dup2(null_fd,2); /* stderr */
+}
 
-void usage(po::options_description &desc) {
+static void usage(po::options_description &desc) {
   cerr<<"nproxy"<<endl;
   cerr<<desc<<endl;
 }
@@ -354,15 +362,3 @@ catch(PDNSException& e)
 {
   syslogFmt(boost::format("Fatal: %s") % e.reason);
 }
-
-void daemonize(int null_fd)
-{
-  if(fork())
-    exit(0); // bye bye
-
-  setsid();
-
-  dup2(null_fd,0); /* stdin */
-  dup2(null_fd,1); /* stderr */
-  dup2(null_fd,2); /* stderr */
-}