+30 May 2007: Wouter
+ - removed FLAG_CD from message and rrset caches. This was useful for
+ an agnostic forwarder, but not for a sophisticated (trust value per
+ rrset enabled) cache.
+
29 May 2007: Wouter
- routines to lock and unlock array of rrsets moved to cache/rrset.
- lookup message from msg cache (and copy to region).
return 0;
memset(iq, 0, sizeof(*iq));
outbound_list_init(&iq->outlist);
- if(qstate->qinfo.has_cd)
- flags |= BIT_CD;
e = (*env->send_query)(qstate->qinfo.qname, qstate->qinfo.qname_len,
qstate->qinfo.qtype, qstate->qinfo.qclass, flags, dnssec,
&ie->fwd_addr, ie->fwd_addrlen, qstate);
msg = dns_cache_lookup(qstate->env, qstate->qinfo.qname,
qstate->qinfo.qname_len, qstate->qinfo.qtype,
- qstate->qinfo.qclass, qstate->qinfo.has_cd,
- qstate->region, qstate->scratch);
+ qstate->qinfo.qclass, qstate->region, qstate->scratch);
if(msg) {
/* handle positive cache response */
/*
struct dns_msg*
dns_cache_lookup(struct module_env* env,
uint8_t* qname, size_t qnamelen, uint16_t qtype, uint16_t qclass,
- int has_cd, struct region* region, struct region* scratch)
+ struct region* region, struct region* scratch)
{
struct lruhash_entry* e;
struct query_info k;
k.qname_len = qnamelen;
k.qtype = qtype;
k.qclass = qclass;
- k.has_cd = has_cd;
h = query_info_hash(&k);
e = slabhash_lookup(env->msg_cache, h, &k, 0);
if(e) {
* @param qnamelen: length of qname.
* @param qtype: query type.
* @param qclass: query class.
- * @param has_cd: if true, CD flag is turned on for lookup.
* @param region: where to allocate result.
* @param scratch: where to allocate temporary data.
* @return new response message (alloced in region, rrsets do not have IDs).
*/
struct dns_msg* dns_cache_lookup(struct module_env* env,
uint8_t* qname, size_t qnamelen, uint16_t qtype, uint16_t qclass,
- int has_cd, struct region* region, struct region* scratch);
+ struct region* region, struct region* scratch);
/** Find covering DNAME */
/** Calculate rrset flags */
static uint32_t
-pkt_rrset_flags(struct msg_parse* msg, ldns_buffer* pkt, uint16_t type)
+pkt_rrset_flags(ldns_buffer* pkt, uint16_t type)
{
- uint32_t f;
- if(msg->flags & BIT_CD)
- f = PACKED_RRSET_CD;
- else f = 0;
+ uint32_t f = 0;
if(type == LDNS_RR_TYPE_NSEC && nsec_at_apex(pkt)) {
f |= PACKED_RRSET_NSEC_AT_APEX;
}
}
}
/* find by hashing and lookup in hashtable */
- *rrset_flags = pkt_rrset_flags(msg, pkt, type);
+ *rrset_flags = pkt_rrset_flags(pkt, type);
/* if rrsig - try to lookup matching data set first */
if(type == LDNS_RR_TYPE_RRSIG && pkt_rrsig_covered(pkt,
qinf->qname_len = msg->qname_len;
qinf->qtype = msg->qtype;
qinf->qclass = msg->qclass;
- qinf->has_cd = 0;
- if(msg->flags & BIT_CD)
- qinf->has_cd = 1;
return 1;
}
log_assert(LDNS_OPCODE_WIRE(q) == LDNS_PACKET_QUERY);
log_assert(LDNS_QDCOUNT(q) == 1);
log_assert(ldns_buffer_position(query) == 0);
- m->has_cd = LDNS_CD_WIRE(q)?1:0;
ldns_buffer_skip(query, LDNS_HEADER_SIZE);
m->qname = ldns_buffer_current(query);
if((m->qname_len = query_dname_len(query)) == 0)
if((mc = query_dname_compare(msg1->qname, msg2->qname)) != 0)
return mc;
log_assert(msg1->qname_len == msg2->qname_len);
- COMPARE_IT(msg1->has_cd, msg2->has_cd);
COMPARE_IT(msg1->qclass, msg2->qclass);
return 0;
#undef COMPARE_IT
hashvalue_t h = 0xab;
h = hashlittle(&q->qtype, sizeof(q->qtype), h);
h = hashlittle(&q->qclass, sizeof(q->qclass), h);
- h = hashlittle(&q->has_cd, sizeof(q->has_cd), h);
h = dname_query_hash(q->qname, h);
return h;
}
qinfo_query_encode(ldns_buffer* pkt, struct query_info* qinfo)
{
uint16_t flags = 0; /* QUERY, NOERROR */
- if(qinfo->has_cd)
- flags |= BIT_CD;
ldns_buffer_clear(pkt);
log_assert(ldns_buffer_remaining(pkt) >= 12+255+4/*max query*/);
ldns_buffer_skip(pkt, 2); /* id done later */
uint16_t qtype;
/** qclass, host byte order */
uint16_t qclass;
- /** does query have CD bit set */
- int has_cd;
};
/**
* clearing the cache. */
typedef uint64_t rrset_id_t;
-/** this rrset is NSEC/NSEC3 and is at zone apex (at child size of zonecut) */
+/** this rrset is NSEC and is at zone apex (at child side of zonecut) */
#define PACKED_RRSET_NSEC_AT_APEX 0x1
-/** this rrset was obtained and is used for checking-disabled replies. */
-#define PACKED_RRSET_CD 0x2
/**
* The identifying information for an RRset.
/**
* Flags. 32bit to be easy for hashing:
* o PACKED_RRSET_NSEC_AT_APEX
- * o PACKED_RRSET_CD
*/
uint32_t flags;
/** the rrset type in network format */