Bug 1350

Summary: make cachedb backend configurable
Product: unbound Reporter: JINMEI Tatuya <jtatuya>
Component: serverAssignee: unbound team <unbound-team>
Status: RESOLVED FIXED    
Severity: enhancement CC: cathya, wouter
Priority: P5    
Version: unspecified   
Hardware: Other   
OS: All   
Attachments: proposed patch

Description JINMEI Tatuya 2017-07-14 23:05:54 CEST
Created attachment 425 [details]
proposed patch

I'd like to propose the attached patch.  It implements the following TODO of
the cachedb module:

cachedb_apply_cfg(struct cachedb_env* cachedb_env, struct config_file* cfg)
{
	const char* backend_str = "testframe"; /* TODO get from cfg */

I chose to implement it in a separate config section 'cachedb:' in case
it might be used other apps than the unbound server, but that's not a
strong opinion.  If this was a bad choice I'm happy to update the patch.

Basically it doesn't change the behavior - it still only recognizes the
'testframe' backend, which is the default.  But there are a couple of
minor modifications:

- an empty backend name is now refused.  again, not a strong opinion
  but I didn't think of any useful case of it (this is different from
  the default) and I thought it rather confusing to silently ignore
  such a case.
- it fixed a minor typo in the error log message: s/'%s/'%s'/

The patch cleanly applies to svn trunk revision 4274, the updated code
compiled and passed both 'make test' and 'make longtest'.

note: I intentionally excluded autogenerated files by lex and yacc
as they would just make it less readable and I guess you'll re-generate
them anyway.
Comment 1 Wouter Wijngaards 2017-07-17 10:21:53 CEST
Hi JINMEI,

Thank you for the patch!  I have applied it.

Best regards, Wouter