AuthWebServer webserver;
Utility::dropUserPrivs(newuid);
- // We need to start the Recursor Proxy before doing secpoll, see issue #2453
if(::arg().mustDo("resolver")){
DP=new DNSProxy(::arg()["resolver"]);
DP->go();
pthread_create(&tid,0,&launchhelper,this);
}
-/** returns false if p->remote is not allowed to recurse via us */
-bool DNSProxy::sendPacket(DNSPacket *p)
-{
- uint16_t id;
- {
- Lock l(&d_lock);
- id=getID_locked();
-
- ConntrackEntry ce;
- ce.id = p->d.id;
- ce.remote = p->d_remote;
- ce.outsock = p->getSocket();
- ce.created = time( NULL );
- ce.qtype = p->qtype.getCode();
- ce.qname = p->qdomain;
- ce.anyLocal = p->d_anyLocal;
- ce.complete=0;
- d_conntrack[id]=ce;
- }
- p->d.id=id^d_xor;
- p->commitD();
-
- const string& buffer = p->getString();
-
- if(send(d_sock,buffer.c_str(), buffer.length() , 0)<0) { // zoom
- L<<Logger::Error<<"Unable to send a packet to our recursing backend: "<<stringerror()<<endl;
- }
- (*d_resquestions)++;
- return true;
-
-}
-
//! look up qname aname with r->qtype, plonk it in the answer section of 'r' with name target
bool DNSProxy::completePacket(DNSPacket *r, const DNSName& target,const DNSName& aname)
{
DNSProxy(const string &ip); //!< creates socket
~DNSProxy(); //<! dtor for DNSProxy
void go(); //!< launches the actual thread
- bool sendPacket(DNSPacket *p); //!< send out a packet and make a conntrack entry to we can send back the answer
bool completePacket(DNSPacket *r, const DNSName& target,const DNSName& aname);
void mainloop(); //!< this is the main loop that receives reply packets and sends them out again