1 --- query.c 2011-04-07 16:32:17.247618922 -0400
2 +++ query.c.mjo 2011-04-07 16:39:52.326465569 -0400
7 - if (!typematch(DNS_T_ANY,dtype) && !typematch(DNS_T_AXFR,dtype) && !typematch(DNS_T_CNAME,dtype) && !typematch(DNS_T_NS,dtype) && !typematch(DNS_T_PTR,dtype) && !typematch(DNS_T_A,dtype) && !typematch(DNS_T_MX,dtype) && !typematch(DNS_T_SOA,dtype)) {
8 + if (typematch(DNS_T_AAAA,dtype)) {
9 + byte_copy(key,2,DNS_T_AAAA);
10 + cached = cache_get(key,dlen + 2,&cachedlen,&ttl);
11 + if (cached && (cachedlen || byte_diff(dtype,2,DNS_T_ANY))) {
13 + log_cachedanswer(d,DNS_T_AAAA);
14 + while (cachedlen >= 16) {
15 + for (k = 0;k < 256;k += 16)
16 + if (byte_equal(z->servers[z->level - 1] + k,16,V6any)) {
17 + byte_copy(z->servers[z->level - 1] + k,16,cached);
26 + log_cachedanswer(d,DNS_T_AAAA);
27 + if (!rqa(z)) goto DIE;
28 + while (cachedlen >= 16) {
29 + if (!response_rstart(d,DNS_T_AAAA,ttl)) goto DIE;
30 + if (!response_addbytes(cached,16)) goto DIE;
31 + response_rfinish(RESPONSE_ANSWER);
40 + if (!typematch(DNS_T_ANY,dtype) && !typematch(DNS_T_AXFR,dtype) && !typematch(DNS_T_CNAME,dtype) && !typematch(DNS_T_NS,dtype) && !typematch(DNS_T_PTR,dtype) && !typematch(DNS_T_A,dtype) && !typematch(DNS_T_MX,dtype) && !typematch(DNS_T_SOA,dtype) && !typematch(DNS_T_AAAA,dtype)) {
41 byte_copy(key,2,dtype);
42 cached = cache_get(key,dlen + 2,&cachedlen,&ttl);
43 if (cached && (cachedlen || byte_diff(dtype,2,DNS_T_ANY))) {
45 dns_domain_free(&z->ns[z->level][j]);
48 - for (j = 0;j < 64;j += 4)
49 - if (byte_diff(z->servers[z->level] + j,4,"\0\0\0\0"))
50 + for (j = 0;j < 256;j += 16)
51 + if (byte_diff(z->servers[z->level] + j,16,V6any))
53 - if (j == 64) goto SERVFAIL;
54 + if (j == 256) goto SERVFAIL;
56 - dns_sortip(z->servers[z->level],64);
57 + dns_sortip6(z->servers[z->level],256);
58 dtype = z->level ? DNS_T_A : z->type;
59 if (qmerge_start(&z->qm,z->servers[z->level],flagforwardonly,z->name[z->level],dtype,z->localip,z->control[z->level]) == -1) goto DIE;
62 buf = z->qm->dt.packet;
63 len = z->qm->dt.packetlen;
65 - whichserver = z->qm->dt.servers + 4 * z->qm->dt.curserver;
66 + whichserver = z->qm->dt.servers + 16 * z->qm->dt.curserver;
67 control = z->control[z->level];
68 d = z->name[z->level];
69 dtype = z->level ? DNS_T_A : z->type;