Thanks Ruben,<br><br>Also if I am serving only A records from my backend, and if my backend is a bit slow, then is there some place I can set a timeout before PowerDNS calls my lookup.<br><br>As from the example in Writer's guide, suppose I am only serving A records, but if my backend is slow, PDNS queries again for the A record, that means my else part will hit again if my backend is slow,<br>
so is there any timeout I can set before PDNS queries back to my backend.<br><br>Thanks,<br>Nikhil<br><br><pre class="programlisting">void lookup(const QType &type, const string &qdomain, DNSPacket *p, int zoneId)
  {
    if(type.getCode()!=QType::A || qdomain!="<a href="http://random.powerdns.com">random.powerdns.com</a>")  // we only know about <a href="http://random.powerdns.com">random.powerdns.com</a> A
      d_answer="";                                                  // no answer
    else {
      ostringstream os;
      os<<random()%256<<"."<<random()%256<<"."<<random()%256<<"."<<random()%256;
      d_answer=os.str();                                           // our random ip address
    }
  }<br><br></pre><br><br><div class="gmail_quote">On Fri, Nov 16, 2012 at 4:29 PM, Ruben d'Arco <span dir="ltr"><<a href="mailto:cyclops@prof-x.net" target="_blank">cyclops@prof-x.net</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0pt 0pt 0pt 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
Hi Nikhil,<br>
<br>
This is by design. PowerDNS will try to get the soa record to see if it is authorative for the domain. It will also try to move up to the root to see if a backend is authorative for that. If it is, it will continue with the actual records it needs.<br>

Also, for things like CNAME and MX, it will try to resolve those as well.<br>
<br>
So, it is normal and canot be avoided. Just implement the fuctions as described in the backend writers guide and powerdns does the rest for you!<br>
<br>
Regards,<br>
     Ruben<br>
<div><div class="h5"><br>
Nikhil Bose <<a href="mailto:nikhilbose11@gmail.com">nikhilbose11@gmail.com</a>> wrote:<br>
<br>
>Hi All,<br>
><br>
>First of all thanks for the help provided. As Peter in one of my<br>
>earlier<br>
>queries gave me a pointer and following that it is quite trivial to<br>
>create<br>
>our own Backend in PowerDNS and using getRemote(), I was able to<br>
>retrieve<br>
>the Client's resolver IP.<br>
><br>
>PowerDNS is indeed quite simple to extend. Thanks for this<br>
>architecture.<br>
><br>
>I have one problem though. My backend is getting called multiple times.<br>
>Even though I just send a single query using the host command.<br>
>Just to show I put some output statements and these are printed after I<br>
>sent the client query<br>
><br>
>Here's the console output:<br>
><br>
>***************************************************************************************<br>
>Nov 16 11:20:26 Creating backend connection for TCP<br>
>Constructor called<br>
>% Nov 16 11:20:26 [bindbackend] Parsing 1 domain(s), will report when<br>
>done<br>
>Nov 16 11:20:26 [bindbackend] parsing '<a href="http://example.com" target="_blank">example.com</a>' from file<br>
>'/etc/bind/example.com.zone'<br>
>Nov 16 11:20:26 [bindbackend] Done parsing domains, 0 rejected, 1 new,<br>
>0<br>
>removed<br>
>Constructor called<br>
>Nov 16 11:20:26 About to create 3 backend threads for UDP<br>
>Constructor called<br>
>Constructor called<br>
>Constructor called<br>
>Constructor called<br>
>Constructor called<br>
>Constructor called<br>
>Nov 16 11:20:26 Done launching threads, ready to distribute questions<br>
>Nov 16 11:20:35 Distributor misses a thread (4<5), spawning new one<br>
>looked up<br>
>looked up<br>
>looked up<br>
>looked up<br>
>Constructor called<br>
>Constructor called<br>
>***************************************************************************************<br>
><br>
>How I can reduce this to a single lookup() call from the PowerDNS to my<br>
>Backend?. Even constructor is called many times. Can this be configured<br>
>anywhere?<br>
><br>
>Thanks,<br>
>Nikhil.<br>
><br>
><br>
</div></div>>------------------------------------------------------------------------<br>
><br>
>_______________________________________________<br>
>Pdns-dev mailing list<br>
><a href="mailto:Pdns-dev@mailman.powerdns.com">Pdns-dev@mailman.powerdns.com</a><br>
><a href="http://mailman.powerdns.com/mailman/listinfo/pdns-dev" target="_blank">http://mailman.powerdns.com/mailman/listinfo/pdns-dev</a><br>
<br>
--<br>
Regards,<br>
          Ruben<br>
</blockquote></div><br>