> Thanks, this finally looks like what I need.  Two points though:
> 1.  Is 64 bytes sufficient for the domain name?  Searching the ’net
> I’ve found other numbers — according to <http://tinyurl.com/ykyths> it
> should be 1005; <http://tinyurl.com/xdp4> links to a name about 140
> bytes long and firefox handles it just fine.

this was throwaway code.  i didn't think very hard about that number.
ndb does have a maximum value length of 64 bytes.

; g -i max /sys/src/cmd/ndb/dns.h:
dns.h:68:       Domlen=         256,    /* max domain name length (with NULL) */

> 2. Why the second part of “if(l < 0 || l == sizeof buf)”?

room for the terminating null.

as pointed out, this doesn't quite work. you have to reverse the dots yourself 
and add in-addr.arpa.
the code is in /sys/src/cmd/ndb/dnsquery.c

- erik

Reply via email to