From 5124de27a39e1ae6f143abdf146dff609880de0e Mon Sep 17 00:00:00 2001 From: Ruben d'Arco Date: Fri, 16 Aug 2013 20:41:25 +0200 Subject: [PATCH] Add --config-name to recursor This adds --config-name to pdns_recursor and rec_control. Changed s_programname to recursor as that makes the logic more like pdns_server and is useful. The rec_control has been updated as well so we can still query the correct recursor --- pdns/pdns_recursor.cc | 15 +++++++++++---- pdns/rec_control.cc | 11 ++++++++++- pdns/win32_pdns_recursor.cc | 2 +- 3 files changed, 22 insertions(+), 6 deletions(-) diff --git a/pdns/pdns_recursor.cc b/pdns/pdns_recursor.cc index f489004866..fb95f7bb80 100644 --- a/pdns/pdns_recursor.cc +++ b/pdns/pdns_recursor.cc @@ -109,7 +109,7 @@ static __thread NetmaskGroup* t_allowFrom; 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 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 @@ -695,7 +695,7 @@ void startDoResolve(void *p) 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(processNum); sockname+=".controlsocket"; @@ -1669,7 +1669,9 @@ void parseACLs() int serviceMain(int argc, char*argv[]) { - L.setName("pdns_recursor"); + + + L.setName(s_programname); L.setLoglevel((Logger::Urgency)(6)); // info and up @@ -2027,6 +2029,7 @@ int main(int argc, char **argv) ::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"; @@ -2092,13 +2095,17 @@ int main(int argc, char **argv) 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()< #include "recursorservice.hh" -string s_programname="pdns_recursor"; +string s_programname="recursor"; #ifndef WIN32 extern "C" { -- 2.47.3