static NetmaskGroup* g_initialAllowFrom; // new thread needs to be setup with this
NetmaskGroup* g_dontQuery;
-string s_programname="pdns_recursor";
+string s_programname="recursor";
typedef vector<int> tcpListenSockets_t;
tcpListenSockets_t g_tcpListenSockets; // shared across threads, but this is fine, never written to from a thread. All threads listen on all sockets
void makeControlChannelSocket(int processNum=-1)
{
- string sockname=::arg()["socket-dir"]+"/pdns_recursor";
+ string sockname=::arg()["socket-dir"]+"/"+s_programname;
if(processNum >= 0)
sockname += "."+lexical_cast<string>(processNum);
sockname+=".controlsocket";
int serviceMain(int argc, char*argv[])
{
- L.setName("pdns_recursor");
+
+
+ L.setName(s_programname);
L.setLoglevel((Logger::Urgency)(6)); // info and up
::arg().set("network-timeout", "Wait this nummer of milliseconds for network i/o")="1500";
::arg().set("threads", "Launch this number of threads")="2";
::arg().set("processes", "Launch this number of processes (EXPERIMENTAL, DO NOT CHANGE)")="1";
+ ::arg().set("config-name","Name of this virtual configuration - will rename the binary image")="";
#ifdef WIN32
::arg().set("quiet","Suppress logging of questions and answers")="off";
::arg().setSwitch( "register-service", "Register the service" )= "no";
L.toConsole(Logger::Info);
::arg().laxParse(argc,argv); // do a lax parse
+ if(::arg()["config-name"]!="")
+ s_programname+="-"+::arg()["config-name"];
+
+
if(::arg().mustDo("config")) {
cout<<::arg().configstring()<<endl;
exit(0);
}
- string configname=::arg()["config-dir"]+"/recursor.conf";
+ string configname=::arg()["config-dir"]+"/"+s_programname+".conf";
cleanSlashes(configname);
if(!::arg().file(configname.c_str()))
arg().set("socket-dir","Where the controlsocket will live")=LOCALSTATEDIR;
arg().set("process","When controlling multiple recursors, the target process number")="";
arg().set("timeout", "Number of seconds to wait for the recursor to respond")="5";
+ arg().set("config-name","Name of this virtual configuration - will rename the binary image")="";
arg().setCmd("help","Provide this helpful message");
arg().laxParse(argc,argv);
cerr<<arg().helpstring(arg()["help"])<<endl;
exit(99);
}
+
string configname=::arg()["config-dir"]+"/recursor.conf";
+ if (::arg()["config-name"] != "")
+ configname=::arg()["config-dir"]+"/recursor-"+::arg()["config-name"]+".conf";
+
cleanSlashes(configname);
if(!::arg().preParseFile(configname.c_str(), "socket-dir", LOCALSTATEDIR))
{
initArguments(argc, argv);
RecursorControlChannel rccS;
- string sockname="pdns_recursor";
+ string sockname="recursor";
+
+ if (arg()["config-name"] != "")
+ sockname+="-"+arg()["config-name"];
+
if(!arg()["process"].empty())
sockname+="."+arg()["process"];