chiark / gitweb /
src/: Pass the wanted query's type code to adns__internal_submit.
authorMark Wooding <mdw@distorted.org.uk>
Sat, 7 Jun 2014 18:38:01 +0000 (19:38 +0100)
committerIan Jackson <ijackson@chiark.greenend.org.uk>
Sun, 12 Oct 2014 19:39:46 +0000 (20:39 +0100)
This has two effects.  Firstly, we can propagate non-representation bits
(e.g., compatibility flags) from parent to child query.  Secondly, we
can have a single typeinfo handle several different low-level record
types.  The former is going to pay off very soon; the latter will take a
bit longer, but it'll be worth it.

Signed-off-by: Mark Wooding <mdw@distorted.org.uk>
src/internal.h
src/query.c
src/types.c

index 50733b5..29f4dd2 100644 (file)
@@ -459,8 +459,8 @@ void adns__query_send(adns_query qu, struct timeval now);
 /* From query.c: */
 
 adns_status adns__internal_submit(adns_state ads, adns_query *query_r,
-                                 const typeinfo *typei, vbuf *qumsg_vb,
-                                 int id,
+                                 const typeinfo *typei, adns_rrtype type,
+                                 vbuf *qumsg_vb, int id,
                                  adns_queryflags flags, struct timeval now,
                                  qcontext *ctx);
 /* Submits a query (for internal use, called during external submits).
index 26a4df0..541d8ac 100644 (file)
@@ -148,8 +148,8 @@ static adns_status check_domain_name(adns_state ads, adns_queryflags flags,
 }
 
 adns_status adns__internal_submit(adns_state ads, adns_query *query_r,
-                                 const typeinfo *typei, vbuf *qumsg_vb,
-                                 int id,
+                                 const typeinfo *typei, adns_rrtype type,
+                                 vbuf *qumsg_vb, int id,
                                  adns_queryflags flags, struct timeval now,
                                  qcontext *ctx) {
   adns_query qu;
@@ -157,7 +157,7 @@ adns_status adns__internal_submit(adns_state ads, adns_query *query_r,
 
   err= check_domain_name(ads, flags,ctx,typei, qumsg_vb->buf,qumsg_vb->used);
   if (err) goto x_err;
-  qu= query_alloc(ads,typei,typei->typekey,flags,now);
+  qu= query_alloc(ads,typei,type,flags,now);
   if (!qu) { err = adns_s_nomemory; goto x_err; }
   *query_r= qu;
 
index 83a5792..90413a0 100644 (file)
@@ -517,6 +517,8 @@ static adns_status pap_hostaddr(const parseinfo *pai, int *cbyte_io,
   if (!(pai->qu->flags & adns_qf_cname_loose)) nflags |= adns_qf_cname_forbid;
   
   st= adns__internal_submit(pai->ads, &nqu, adns__findtype(adns_r_addr),
+                           ((adns_r_addr & adns_rrt_reprmask) |
+                            (pai->qu->answer->type & ~adns_rrt_reprmask)),
                            &pai->qu->vb, id, nflags, pai->now, &ctx);
   if (st) return st;
 
@@ -791,8 +793,8 @@ static adns_status pa_ptr(const parseinfo *pai, int dmstart,
   memset(&ctx.pinfo,0,sizeof(ctx.pinfo));
   memset(&ctx.tinfo,0,sizeof(ctx.tinfo));
   st= adns__internal_submit(pai->ads, &nqu, adns__findtype(adns_r_a),
-                           &pai->qu->vb, id,
-                           adns_qf_quoteok_query, pai->now, &ctx);
+                           adns_r_a, &pai->qu->vb, id, adns_qf_quoteok_query,
+                           pai->now, &ctx);
   if (st) return st;
 
   nqu->parent= pai->qu;