diff options
| author | Dag-Erling Smørgrav <des@FreeBSD.org> | 2017-02-03 13:06:34 +0000 | 
|---|---|---|
| committer | Dag-Erling Smørgrav <des@FreeBSD.org> | 2017-02-03 13:06:34 +0000 | 
| commit | bd51c20871bac7a49ea0adc443050f2894cfd5f3 (patch) | |
| tree | c551994131aa8f3315a21aeaf4f9bc2a8b757e89 /cachedb/cachedb.c | |
| parent | 27c2fff0f2fef695b0599fc3931cacfc16376e88 (diff) | |
Diffstat (limited to 'cachedb/cachedb.c')
| -rw-r--r-- | cachedb/cachedb.c | 26 | 
1 files changed, 18 insertions, 8 deletions
| diff --git a/cachedb/cachedb.c b/cachedb/cachedb.c index 76d9afa47c8f..a326d6ef8dbc 100644 --- a/cachedb/cachedb.c +++ b/cachedb/cachedb.c @@ -547,8 +547,8 @@ cachedb_handle_query(struct module_qstate* qstate,  		return;  	} -	if(qstate->blacklist) { -		/* cache is blacklisted */ +	if(qstate->blacklist || qstate->no_cache_lookup) { +		/* cache is blacklisted or we are instructed from edns to not look */  		/* pass request to next module */  		qstate->ext_state[id] = module_wait_module;  		return; @@ -556,10 +556,15 @@ cachedb_handle_query(struct module_qstate* qstate,  	/* lookup inside unbound's internal cache */  	if(cachedb_intcache_lookup(qstate)) { -		if(verbosity >= VERB_ALGO) -			log_dns_msg("cachedb internal cache lookup", -				&qstate->return_msg->qinfo, -				qstate->return_msg->rep); +		if(verbosity >= VERB_ALGO) { +			if(qstate->return_msg->rep) +				log_dns_msg("cachedb internal cache lookup", +					&qstate->return_msg->qinfo, +					qstate->return_msg->rep); +			else log_info("cachedb internal cache lookup: rcode %s", +				sldns_lookup_by_id(sldns_rcodes, qstate->return_rcode)? +				sldns_lookup_by_id(sldns_rcodes, qstate->return_rcode)->name:"??"); +		}  		/* we are done with the query */  		qstate->ext_state[id] = module_finished;  		return; @@ -595,8 +600,8 @@ static void  cachedb_handle_response(struct module_qstate* qstate,  	struct cachedb_qstate* ATTR_UNUSED(iq), struct cachedb_env* ie, int id)  { -	/* check if we are enabled, and skip if not */ -	if(!ie->enabled) { +	/* check if we are not enabled or instructed to not cache, and skip */ +	if(!ie->enabled || qstate->no_cache_store) {  		/* we are done with the query */  		qstate->ext_state[id] = module_finished;  		return; @@ -649,6 +654,11 @@ cachedb_operate(struct module_qstate* qstate, enum module_ev event, int id,  		(void)error_response(qstate, id, LDNS_RCODE_SERVFAIL);  		return;  	} +	if(!iq && (event == module_event_moddone)) { +		/* during priming, module done but we never started */ +		qstate->ext_state[id] = module_finished; +		return; +	}  	log_err("bad event for cachedb");  	(void)error_response(qstate, id, LDNS_RCODE_SERVFAIL); | 
