mirror of
https://github.com/NLnetLabs/unbound.git
synced 2025-12-20 23:00:56 -05:00
Removed CD bit flags from cache.
git-svn-id: file:///svn/unbound/trunk@347 be551aaa-1e26-0410-a405-d3ace91eadb9
This commit is contained in:
parent
3e7a53c5ca
commit
95d4dc2eb8
8 changed files with 12 additions and 28 deletions
|
|
@ -1,3 +1,8 @@
|
||||||
|
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
|
29 May 2007: Wouter
|
||||||
- routines to lock and unlock array of rrsets moved to cache/rrset.
|
- routines to lock and unlock array of rrsets moved to cache/rrset.
|
||||||
- lookup message from msg cache (and copy to region).
|
- lookup message from msg cache (and copy to region).
|
||||||
|
|
|
||||||
|
|
@ -124,8 +124,6 @@ fwd_new(struct module_qstate* qstate, int id)
|
||||||
return 0;
|
return 0;
|
||||||
memset(iq, 0, sizeof(*iq));
|
memset(iq, 0, sizeof(*iq));
|
||||||
outbound_list_init(&iq->outlist);
|
outbound_list_init(&iq->outlist);
|
||||||
if(qstate->qinfo.has_cd)
|
|
||||||
flags |= BIT_CD;
|
|
||||||
e = (*env->send_query)(qstate->qinfo.qname, qstate->qinfo.qname_len,
|
e = (*env->send_query)(qstate->qinfo.qname, qstate->qinfo.qname_len,
|
||||||
qstate->qinfo.qtype, qstate->qinfo.qclass, flags, dnssec,
|
qstate->qinfo.qtype, qstate->qinfo.qclass, flags, dnssec,
|
||||||
&ie->fwd_addr, ie->fwd_addrlen, qstate);
|
&ie->fwd_addr, ie->fwd_addrlen, qstate);
|
||||||
|
|
@ -403,8 +401,7 @@ processInitRequest(struct module_qstate* qstate, struct iter_qstate* iq,
|
||||||
|
|
||||||
msg = dns_cache_lookup(qstate->env, qstate->qinfo.qname,
|
msg = dns_cache_lookup(qstate->env, qstate->qinfo.qname,
|
||||||
qstate->qinfo.qname_len, qstate->qinfo.qtype,
|
qstate->qinfo.qname_len, qstate->qinfo.qtype,
|
||||||
qstate->qinfo.qclass, qstate->qinfo.has_cd,
|
qstate->qinfo.qclass, qstate->region, qstate->scratch);
|
||||||
qstate->region, qstate->scratch);
|
|
||||||
if(msg) {
|
if(msg) {
|
||||||
/* handle positive cache response */
|
/* handle positive cache response */
|
||||||
/*
|
/*
|
||||||
|
|
|
||||||
3
services/cache/dns.c
vendored
3
services/cache/dns.c
vendored
|
|
@ -317,7 +317,7 @@ tomsg(struct module_env* env, struct msgreply_entry* e, struct reply_info* r,
|
||||||
struct dns_msg*
|
struct dns_msg*
|
||||||
dns_cache_lookup(struct module_env* env,
|
dns_cache_lookup(struct module_env* env,
|
||||||
uint8_t* qname, size_t qnamelen, uint16_t qtype, uint16_t qclass,
|
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 lruhash_entry* e;
|
||||||
struct query_info k;
|
struct query_info k;
|
||||||
|
|
@ -329,7 +329,6 @@ dns_cache_lookup(struct module_env* env,
|
||||||
k.qname_len = qnamelen;
|
k.qname_len = qnamelen;
|
||||||
k.qtype = qtype;
|
k.qtype = qtype;
|
||||||
k.qclass = qclass;
|
k.qclass = qclass;
|
||||||
k.has_cd = has_cd;
|
|
||||||
h = query_info_hash(&k);
|
h = query_info_hash(&k);
|
||||||
e = slabhash_lookup(env->msg_cache, h, &k, 0);
|
e = slabhash_lookup(env->msg_cache, h, &k, 0);
|
||||||
if(e) {
|
if(e) {
|
||||||
|
|
|
||||||
3
services/cache/dns.h
vendored
3
services/cache/dns.h
vendored
|
|
@ -94,7 +94,6 @@ struct delegpt* dns_cache_find_delegation(struct module_env* env,
|
||||||
* @param qnamelen: length of qname.
|
* @param qnamelen: length of qname.
|
||||||
* @param qtype: query type.
|
* @param qtype: query type.
|
||||||
* @param qclass: query class.
|
* @param qclass: query class.
|
||||||
* @param has_cd: if true, CD flag is turned on for lookup.
|
|
||||||
* @param region: where to allocate result.
|
* @param region: where to allocate result.
|
||||||
* @param scratch: where to allocate temporary data.
|
* @param scratch: where to allocate temporary data.
|
||||||
* @return new response message (alloced in region, rrsets do not have IDs).
|
* @return new response message (alloced in region, rrsets do not have IDs).
|
||||||
|
|
@ -103,7 +102,7 @@ struct delegpt* dns_cache_find_delegation(struct module_env* env,
|
||||||
*/
|
*/
|
||||||
struct dns_msg* dns_cache_lookup(struct module_env* env,
|
struct dns_msg* dns_cache_lookup(struct module_env* env,
|
||||||
uint8_t* qname, size_t qnamelen, uint16_t qtype, uint16_t qclass,
|
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 */
|
/** Find covering DNAME */
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -143,12 +143,9 @@ nsec_at_apex(ldns_buffer* pkt)
|
||||||
|
|
||||||
/** Calculate rrset flags */
|
/** Calculate rrset flags */
|
||||||
static uint32_t
|
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;
|
uint32_t f = 0;
|
||||||
if(msg->flags & BIT_CD)
|
|
||||||
f = PACKED_RRSET_CD;
|
|
||||||
else f = 0;
|
|
||||||
if(type == LDNS_RR_TYPE_NSEC && nsec_at_apex(pkt)) {
|
if(type == LDNS_RR_TYPE_NSEC && nsec_at_apex(pkt)) {
|
||||||
f |= PACKED_RRSET_NSEC_AT_APEX;
|
f |= PACKED_RRSET_NSEC_AT_APEX;
|
||||||
}
|
}
|
||||||
|
|
@ -450,7 +447,7 @@ find_rrset(struct msg_parse* msg, ldns_buffer* pkt, uint8_t* dname,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
/* find by hashing and lookup in hashtable */
|
/* 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 rrsig - try to lookup matching data set first */
|
||||||
if(type == LDNS_RR_TYPE_RRSIG && pkt_rrsig_covered(pkt,
|
if(type == LDNS_RR_TYPE_RRSIG && pkt_rrsig_covered(pkt,
|
||||||
|
|
|
||||||
|
|
@ -71,9 +71,6 @@ parse_create_qinfo(ldns_buffer* pkt, struct msg_parse* msg,
|
||||||
qinf->qname_len = msg->qname_len;
|
qinf->qname_len = msg->qname_len;
|
||||||
qinf->qtype = msg->qtype;
|
qinf->qtype = msg->qtype;
|
||||||
qinf->qclass = msg->qclass;
|
qinf->qclass = msg->qclass;
|
||||||
qinf->has_cd = 0;
|
|
||||||
if(msg->flags & BIT_CD)
|
|
||||||
qinf->has_cd = 1;
|
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -427,7 +424,6 @@ query_info_parse(struct query_info* m, ldns_buffer* query)
|
||||||
log_assert(LDNS_OPCODE_WIRE(q) == LDNS_PACKET_QUERY);
|
log_assert(LDNS_OPCODE_WIRE(q) == LDNS_PACKET_QUERY);
|
||||||
log_assert(LDNS_QDCOUNT(q) == 1);
|
log_assert(LDNS_QDCOUNT(q) == 1);
|
||||||
log_assert(ldns_buffer_position(query) == 0);
|
log_assert(ldns_buffer_position(query) == 0);
|
||||||
m->has_cd = LDNS_CD_WIRE(q)?1:0;
|
|
||||||
ldns_buffer_skip(query, LDNS_HEADER_SIZE);
|
ldns_buffer_skip(query, LDNS_HEADER_SIZE);
|
||||||
m->qname = ldns_buffer_current(query);
|
m->qname = ldns_buffer_current(query);
|
||||||
if((m->qname_len = query_dname_len(query)) == 0)
|
if((m->qname_len = query_dname_len(query)) == 0)
|
||||||
|
|
@ -468,7 +464,6 @@ query_info_compare(void* m1, void* m2)
|
||||||
if((mc = query_dname_compare(msg1->qname, msg2->qname)) != 0)
|
if((mc = query_dname_compare(msg1->qname, msg2->qname)) != 0)
|
||||||
return mc;
|
return mc;
|
||||||
log_assert(msg1->qname_len == msg2->qname_len);
|
log_assert(msg1->qname_len == msg2->qname_len);
|
||||||
COMPARE_IT(msg1->has_cd, msg2->has_cd);
|
|
||||||
COMPARE_IT(msg1->qclass, msg2->qclass);
|
COMPARE_IT(msg1->qclass, msg2->qclass);
|
||||||
return 0;
|
return 0;
|
||||||
#undef COMPARE_IT
|
#undef COMPARE_IT
|
||||||
|
|
@ -518,7 +513,6 @@ query_info_hash(struct query_info *q)
|
||||||
hashvalue_t h = 0xab;
|
hashvalue_t h = 0xab;
|
||||||
h = hashlittle(&q->qtype, sizeof(q->qtype), h);
|
h = hashlittle(&q->qtype, sizeof(q->qtype), h);
|
||||||
h = hashlittle(&q->qclass, sizeof(q->qclass), 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);
|
h = dname_query_hash(q->qname, h);
|
||||||
return h;
|
return h;
|
||||||
}
|
}
|
||||||
|
|
@ -1161,8 +1155,6 @@ void
|
||||||
qinfo_query_encode(ldns_buffer* pkt, struct query_info* qinfo)
|
qinfo_query_encode(ldns_buffer* pkt, struct query_info* qinfo)
|
||||||
{
|
{
|
||||||
uint16_t flags = 0; /* QUERY, NOERROR */
|
uint16_t flags = 0; /* QUERY, NOERROR */
|
||||||
if(qinfo->has_cd)
|
|
||||||
flags |= BIT_CD;
|
|
||||||
ldns_buffer_clear(pkt);
|
ldns_buffer_clear(pkt);
|
||||||
log_assert(ldns_buffer_remaining(pkt) >= 12+255+4/*max query*/);
|
log_assert(ldns_buffer_remaining(pkt) >= 12+255+4/*max query*/);
|
||||||
ldns_buffer_skip(pkt, 2); /* id done later */
|
ldns_buffer_skip(pkt, 2); /* id done later */
|
||||||
|
|
|
||||||
|
|
@ -66,8 +66,6 @@ struct query_info {
|
||||||
uint16_t qtype;
|
uint16_t qtype;
|
||||||
/** qclass, host byte order */
|
/** qclass, host byte order */
|
||||||
uint16_t qclass;
|
uint16_t qclass;
|
||||||
/** does query have CD bit set */
|
|
||||||
int has_cd;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
||||||
|
|
@ -48,10 +48,8 @@ struct alloc_cache;
|
||||||
* clearing the cache. */
|
* clearing the cache. */
|
||||||
typedef uint64_t rrset_id_t;
|
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
|
#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.
|
* The identifying information for an RRset.
|
||||||
|
|
@ -70,7 +68,6 @@ struct packed_rrset_key {
|
||||||
/**
|
/**
|
||||||
* Flags. 32bit to be easy for hashing:
|
* Flags. 32bit to be easy for hashing:
|
||||||
* o PACKED_RRSET_NSEC_AT_APEX
|
* o PACKED_RRSET_NSEC_AT_APEX
|
||||||
* o PACKED_RRSET_CD
|
|
||||||
*/
|
*/
|
||||||
uint32_t flags;
|
uint32_t flags;
|
||||||
/** the rrset type in network format */
|
/** the rrset type in network format */
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue