along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
-
+#include "packetcache.hh"
#include "utility.hh"
#include <errno.h>
#include "communicator.hh"
void CommunicatorClass::masterUpdateCheck(PacketHandler *P)
{
- if(!arg().mustDo("master"))
+ if(!::arg().mustDo("master"))
return;
UeberBackend *B=dynamic_cast<UeberBackend *>(P->getBackend());
sin.sin_family = AF_INET;
// Bind to a specific IP (query-local-address) if specified
- string querylocaladdress(arg()["query-local-address"]);
+ string querylocaladdress(::arg()["query-local-address"]);
if (querylocaladdress=="") {
sin.sin_addr.s_addr = INADDR_ANY;
}
for(;n<10;n++) {
sin.sin_port = htons(10000+(Utility::random()%50000));
- if(bind(d_nsock, (struct sockaddr *)&sin, sizeof(sin)) >= 0)
+ if(::bind(d_nsock, (struct sockaddr *)&sin, sizeof(sin)) >= 0)
break;
}
if(n==10) {
#endif // WIN32
L<<Logger::Error<<"Master/slave communicator launching"<<endl;
PacketHandler P;
- d_tickinterval=arg().asNum("slave-cycle-interval");
+ d_tickinterval=::arg().asNum("slave-cycle-interval");
makeNotifySocket();
int rc;
// this is so gross
#ifndef SMTPREDIR
- int queuetimeout=arg().asNum("queue-limit");
+ int queuetimeout=::arg().asNum("queue-limit");
#endif
// ick ick ick!
if(!(nextid%50)) {
int val;
numquestions.getValue( &val );
- if(val>arg().asNum("max-queue-length")) {
- L<<Logger::Error<<val<<" questions waiting for database attention. Limit is "<<arg().asNum("max-queue-length")<<", respawning"<<endl;
+ if(val>::arg().asNum("max-queue-length")) {
+ L<<Logger::Error<<val<<" questions waiting for database attention. Limit is "<<::arg().asNum("max-queue-length")<<", respawning"<<endl;
exit(1);
}
}
/*
PowerDNS Versatile Database Driven Nameserver
- Copyright (C) 2004 PowerDNS.COM BV
+ Copyright (C) 2004 - 2008 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
along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
+#include "packetcache.hh"
#include "utility.hh"
#include "dnsproxy.hh"
#include "ahuexception.hh"
#include "dns.hh"
#include "logger.hh"
#include "statbag.hh"
-#include "packetcache.hh"
+
extern StatBag S;
extern PacketCache PC;
for(;n<10;n++) {
sin.sin_port = htons(10000+( Utility::random()%50000));
- if(bind(d_sock, (struct sockaddr *)&sin, sizeof(sin)) >= 0)
+ if(::bind(d_sock, (struct sockaddr *)&sin, sizeof(sin)) >= 0)
break;
}
if(n==10) {
/*
PowerDNS Versatile Database Driven Nameserver
- Copyright (C) 2002 - 2005 PowerDNS.COM BV
+ Copyright (C) 2002 - 2008 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
along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
+#include "packetcache.hh"
#include "utility.hh"
#include "dynhandler.hh"
#include "statbag.hh"
if(*p==parts[1])
break;
if(*p) {
- arg().set(parts[1])=parts[2];
+ ::arg().set(parts[1])=parts[2];
return "done";
}
else
along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
+#include "packetcache.hh"
#include "utility.hh"
#include "resolver.hh"
#include <pthread.h>
memset((char *)&sin,0, sizeof(sin));
sin.sin_family = AF_INET;
- if(!IpToU32(arg()["query-local-address"], &sin.sin_addr.s_addr))
- throw AhuException("Unable to resolve local address '"+ arg()["query-local-address"] +"'");
+ if(!IpToU32(::arg()["query-local-address"], &sin.sin_addr.s_addr))
+ throw AhuException("Unable to resolve local address '"+ ::arg()["query-local-address"] +"'");
int tries=10;
while(--tries) {
sin.sin_port = htons(10000+(dns_random(10000)));
- if (bind(d_sock, (struct sockaddr *)&sin, sizeof(sin)) >= 0)
+ if (::bind(d_sock, (struct sockaddr *)&sin, sizeof(sin)) >= 0)
break;
}
throw ResolverException("Unable to make a TCP socket for resolver: "+stringerror());
// Use query-local-address as source IP for queries, if specified.
- string querylocaladdress(arg()["query-local-address"]);
+ string querylocaladdress(::arg()["query-local-address"]);
if (!querylocaladdress.empty()) {
ComboAddress fromaddr(querylocaladdress, 0);
- if (bind(d_sock, (struct sockaddr *)&fromaddr, fromaddr.getSocklen()) < 0) {
+ if (::bind(d_sock, (struct sockaddr *)&fromaddr, fromaddr.getSocklen()) < 0) {
Utility::closesocket(d_sock);
d_sock=-1;
throw ResolverException("Binding to query-local-address: "+stringerror());
/*
PowerDNS Versatile Database Driven Nameserver
- Copyright (C) 2002-2007 PowerDNS.COM BV
+ Copyright (C) 2002-2008 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
along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
+#include "packetcache.hh"
#include "utility.hh"
#include <cstdio>
#include <cstring>
#include "lock.hh"
#include "logger.hh"
#include "arguments.hh"
-#include "packetcache.hh"
+
#include "packethandler.hh"
#include "statbag.hh"
#include "resolver.hh"
Utility::setNonBlocking(sock);
ServiceTuple st;
st.port=53;
- parseService(arg()["recursor"],st);
+ parseService(::arg()["recursor"],st);
try {
ComboAddress recursor(st.host, st.port);
bool TCPNameserver::canDoAXFR(shared_ptr<DNSPacket> q)
{
- if(arg().mustDo("disable-axfr"))
+ if(::arg().mustDo("disable-axfr"))
return false;
- if( arg()["allow-axfr-ips"].empty() || d_ng.match( (ComboAddress *) &q->remote ) )
+ if( ::arg()["allow-axfr-ips"].empty() || d_ng.match( (ComboAddress *) &q->remote ) )
return true;
extern CommunicatorClass Communicator;
int count=0;
int chunk=100; // FIXME: this should probably be autosizing
- if(arg().mustDo("strict-rfc-axfrs"))
+ if(::arg().mustDo("strict-rfc-axfrs"))
chunk=1;
outpacket=shared_ptr<DNSPacket>(q->replyPacket());
TCPNameserver::TCPNameserver()
{
-// sem_init(&d_connectionroom_sem,0,arg().asNum("max-tcp-connections"));
- d_connectionroom_sem = new Semaphore( arg().asNum( "max-tcp-connections" ));
+// sem_init(&d_connectionroom_sem,0,::arg().asNum("max-tcp-connections"));
+ d_connectionroom_sem = new Semaphore( ::arg().asNum( "max-tcp-connections" ));
s_timeout=10;
vector<string>locals;
- stringtok(locals,arg()["local-address"]," ,");
+ stringtok(locals,::arg()["local-address"]," ,");
vector<string>locals6;
- stringtok(locals6,arg()["local-ipv6"]," ,");
+ stringtok(locals6,::arg()["local-ipv6"]," ,");
if(locals.empty() && locals6.empty())
throw AhuException("No local address specified");
d_highfd=0;
vector<string> parts;
- stringtok( parts, arg()["allow-axfr-ips"], ", \t" ); // is this IP on the guestlist?
+ stringtok( parts, ::arg()["allow-axfr-ips"], ", \t" ); // is this IP on the guestlist?
for( vector<string>::const_iterator i = parts.begin(); i != parts.end(); ++i ) {
d_ng.addMask( *i );
}
if(s<0)
throw AhuException("Unable to acquire TCP socket: "+stringerror());
- ComboAddress local(*laddr, arg().asNum("local-port"));
+ ComboAddress local(*laddr, ::arg().asNum("local-port"));
int tmp=1;
if(setsockopt(s,SOL_SOCKET,SO_REUSEADDR,(char*)&tmp,sizeof tmp)<0) {
exit(1);
}
- if(bind(s, (sockaddr*)&local, local.getSocklen())<0) {
+ if(::bind(s, (sockaddr*)&local, local.getSocklen())<0) {
L<<Logger::Error<<"binding to TCP socket: "<<strerror(errno)<<endl;
throw AhuException("Unable to bind to TCP socket");
}
if(s<0)
throw AhuException("Unable to acquire TCPv6 socket: "+stringerror());
- ComboAddress local(*laddr, arg().asNum("local-port"));
+ ComboAddress local(*laddr, ::arg().asNum("local-port"));
int tmp=1;
if(setsockopt(s,SOL_SOCKET,SO_REUSEADDR,(char*)&tmp,sizeof tmp)<0) {