Permalink
Browse files

Support command line and include-dir properly in reload-zones

  • Loading branch information...
1 parent 242b90e commit 302df819590ab360a479fe94312082d7968301dc @cmouse cmouse committed Feb 7, 2014
Showing with 23 additions and 1 deletion.
  1. +23 −1 pdns/reczones.cc
View
@@ -25,6 +25,10 @@
#include "zoneparser-tng.hh"
#include "logger.hh"
#include "dnsrecords.hh"
+#include <boost/foreach.hpp>
+
+extern int g_argc;
+extern char** g_argv;
void primeHints(void)
{
@@ -250,11 +254,29 @@ string reloadAuthAndForwards()
if(!::arg().preParseFile(configname.c_str(), "forward-zones"))
L<<Logger::Warning<<"Unable to re-parse configuration file '"<<configname<<"'"<<endl;
-
+ ::arg().preParse(g_argc, g_argv, "forward-zones");
::arg().preParseFile(configname.c_str(), "forward-zones-file");
+ ::arg().preParse(g_argc, g_argv, "forward-zones-file");
::arg().preParseFile(configname.c_str(), "auth-zones");
+ ::arg().preParse(g_argc, g_argv, "auth-zones");
::arg().preParseFile(configname.c_str(), "export-etc-hosts", "off");
+ ::arg().preParse(g_argc, g_argv, "export-etc-hosts");
::arg().preParseFile(configname.c_str(), "serve-rfc1918");
+ ::arg().preParse(g_argc, g_argv, "serve-rfc1918");
+ ::arg().preParseFile(configname.c_str(), "include-dir");
+ ::arg().preParse(g_argc, g_argv, "include-dir");
+
+ // then process includes
+ std::vector<std::string> extraConfigs;
+ ::arg().gatherIncludes(extraConfigs);
+
+ BOOST_FOREACH(const std::string& fn, extraConfigs) {
+ ::arg().preParseFile(fn.c_str(), "forward-zones", ::arg()["forward-zones"]);
+ ::arg().preParseFile(fn.c_str(), "forward-zones-file", ::arg()["forward-zones-file"]);
+ ::arg().preParseFile(fn.c_str(), "auth-zones",::arg()["auth-zones"]);
+ ::arg().preParseFile(fn.c_str(), "export-etc-hosts",::arg()["export-etc-hosts"]);
+ ::arg().preParseFile(fn.c_str(), "serve-rfc1918",::arg()["serve-rfc1918"]);
+ }
SyncRes::domainmap_t* newDomainMap = parseAuthAndForwards();

0 comments on commit 302df81

Please sign in to comment.