Re: wildcard domain serving

Matthew Dempsky <[email protected]> Wed, 14 Apr 2010 11:39:18 -0700
Newsgroups gmane.network.djbdns
Message-ID <[email protected]>
On Wed, Apr 14, 2010 at 10:58 AM, Jeremy Kister
<[email protected]> wrote:
> anyone know of a patch or where to start looking in the code to give answers
> for lame A queries ?

tdlookup.c and server.c are the two relevant files.

The return 0 on line 146 of tdlookup.c (with the comment "q is not
within our bailiwick") is where tinydns has decided normally to not
send any response.  If you wanted, you could change it to something
like:

   if (!*control) {
     if (!response_rstart(q,DNS_TYPE_A,86400)) return 0;
     if (!response_addbytes("\177\0\0\1",4)) return 0;
     if (!response_rfinish(RESPONSE_ANSWER)) return 0;
     return 1;
  }

If you'd like to additionally log it as a "B" line or something in
your logs (e.g., for bogus), then you'd want to change the 'return 1'
to something like 'return 2', and then appropriately update server.c
to something like:

  switch(respond(q,qtype,ip)) {
    case 0: qlog(ip,port,header,q,qtype," - "); return 0;
    case 2: qlog(ip,port,header,q,qtype," B "); return 1;
    default: qlog(ip,port,header,q,qtype," + "); return 1;
  }