/*
- PowerDNS Versatile Database Driven Nameserver
- Copyright (C) 2006 - 2015 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 as
- published by the Free Software Foundation
-
- Additionally, the license of this program contains a special
- exception which allows to distribute the program in binary form when
- it is linked against OpenSSL.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program; if not, write to the Free Software
- Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
-*/
+ * This file is part of PowerDNS or dnsdist.
+ * Copyright -- PowerDNS.COM B.V. and its contributors
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of version 2 of the GNU General Public License as
+ * published by the Free Software Foundation.
+ *
+ * In addition, for the avoidance of any doubt, permission is granted to
+ * link this program with OpenSSL and to (re)distribute the binaries
+ * produced as the result of such linking.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+ */
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
#include "namespaces.hh"
-#ifndef RECURSOR
-#include "statbag.hh"
-StatBag S;
-#endif
-
ArgvMap &arg()
{
static ArgvMap arg;
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().setCmd("version","Show the version of this program");
arg().laxParse(argc,argv);
if(arg().mustDo("help") || arg().getCommands().empty()) {
exit(arg().mustDo("help") ? 0 : 99);
}
+ if(arg().mustDo("version")) {
+ cout<<"rec_control version "<<VERSION<<endl;
+ exit(0);
+ }
+
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", ""))
- cerr<<"Warning: unable to parse configuration file '"<<configname<<"'"<<endl;
- if(!::arg().preParseFile(configname.c_str(), "chroot", ""))
- cerr<<"Warning: unable to parse configuration file '"<<configname<<"'"<<endl;
+ arg().laxFile(configname.c_str());
arg().laxParse(argc,argv); // make sure the commandline wins
command+=" ";
command+=commands[i];
}
- rccS.send(command);
+ rccS.send(command, nullptr, arg().asNum("timeout"));
string receive=rccS.recv(0, arg().asNum("timeout"));
if(receive.compare(0, 7, "Unknown") == 0) {
cerr<<receive<<endl;