howto know if a query was delegated to cache

harish badrinath harishbadrinath at gmail.com
Mon Jul 25 13:24:48 UTC 2011


Hello,
On Mon, Jul 25, 2011 at 6:03 PM, Feng He <shorttag at gmail.com> wrote:
> There is a "rr" flag in the response which indicates the answer is not
> from a cache.

Could you please elaborate. Is the flag passed to the client ??

Attached are two calls to bind, to resolve www.google.com
I have use the command dig www.google.com @BIND_LISTEN_IP all > /tmp/foo

The first attachment named nonCache, should be should be the
request/response of an query as soon as the bind server starts, hence
things like reading root hints file come into picture (and so the
large delay).

The second attachment one is named cache, and should be the
request/response from the bind's cache.

The next section is inline pasting of the diff of the two attachments.
<snip>
5c5
< ;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 38534
---
> ;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 24280
12,17c12,17
< www.google.com.               604800  IN      CNAME   www.l.google.com.
< www.l.google.com.     300     IN      A       74.125.236.51
< www.l.google.com.     300     IN      A       74.125.236.52
< www.l.google.com.     300     IN      A       74.125.236.48
< www.l.google.com.     300     IN      A       74.125.236.49
< www.l.google.com.     300     IN      A       74.125.236.50
---
> www.google.com.               604779  IN      CNAME   www.l.google.com.
> www.l.google.com.     279     IN      A       74.125.236.50
> www.l.google.com.     279     IN      A       74.125.236.51
> www.l.google.com.     279     IN      A       74.125.236.52
> www.l.google.com.     279     IN      A       74.125.236.48
> www.l.google.com.     279     IN      A       74.125.236.49
20,23c20,23
< google.com.           172800  IN      NS      ns4.google.com.
< google.com.           172800  IN      NS      ns3.google.com.
< google.com.           172800  IN      NS      ns2.google.com.
< google.com.           172800  IN      NS      ns1.google.com.
---
> google.com.           172779  IN      NS      ns3.google.com.
> google.com.           172779  IN      NS      ns1.google.com.
> google.com.           172779  IN      NS      ns4.google.com.
> google.com.           172779  IN      NS      ns2.google.com.
25c25
< ;; Query time: 1820 msec
---
> ;; Query time: 84 msec
27c27
< ;; WHEN: Mon Jul 25 21:18:45 2011
---
> ;; WHEN: Mon Jul 25 21:19:05 2011
31c31
< ;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 52479
---
> ;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 64054
40c40
< ;; Query time: 160 msec
---
> ;; Query time: 120 msec
42c42
< ;; WHEN: Mon Jul 25 21:18:51 2011
---
> ;; WHEN: Mon Jul 25 21:19:05 2011
</snip>

If you mean one of /something similar,
#define NS_QUERYATTR_RECURSIONOK        0x0001
#define NS_QUERYATTR_CACHEOK            0x0002
#define NS_QUERYATTR_PARTIALANSWER      0x0004
#define NS_QUERYATTR_NAMEBUFUSED        0x0008
#define NS_QUERYATTR_RECURSING          0x0010
#define NS_QUERYATTR_CACHEGLUEOK        0x0020
#define NS_QUERYATTR_QUERYOKVALID       0x0040
#define NS_QUERYATTR_QUERYOK            0x0080
#define NS_QUERYATTR_WANTRECURSION      0x0100
#define NS_QUERYATTR_SECURE             0x0200
#define NS_QUERYATTR_NOAUTHORITY        0x0400
#define NS_QUERYATTR_NOADDITIONAL       0x0800

could you please tell me which it is


Regards,
Harish
-------------- next part --------------
A non-text attachment was scrubbed...
Name: nonCache
Type: application/octet-stream
Size: 1209 bytes
Desc: not available
URL: <https://lists.isc.org/pipermail/bind-users/attachments/20110725/2340e03e/attachment.obj>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: Cache
Type: application/octet-stream
Size: 1207 bytes
Desc: not available
URL: <https://lists.isc.org/pipermail/bind-users/attachments/20110725/2340e03e/attachment-0001.obj>


More information about the bind-users mailing list