Bug 1407 - Add ECS options check to unbound-checkconf
Add ECS options check to unbound-checkconf
Status: RESOLVED FIXED
Product: unbound
Classification: Unclassified
Component: server
1.6.4
x86_64 Linux
: P5 minor
Assigned To: unbound team
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2017-08-15 13:08 CEST by Uladzimir Trehubenka
Modified: 2017-08-22 09:43 CEST (History)
2 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Uladzimir Trehubenka 2017-08-15 13:08:11 CEST
Add to smallapp/unbound-checkconf.c

include "edns-subnet/subnet-whitelist.h"

/** check ECS configuration */
static void
ecs_conf_checks(struct config_file* cfg)
{
	struct ednssubnet_upstream* upstream = NULL;
	if(!(upstream = upstream_create()))
		fatal_exit("Could not create ednssubnet upstream: out of memory");
        if(!upstream_apply_cfg(upstream, cfg))
		fatal_exit("Could not setup ednssubnet upstream");
	upstream_delete(upstream);
}

/** check configuration for errors */
static void
morechecks(struct config_file* cfg, const char* fname)
{
	...
	localzonechecks(cfg);
	view_and_respipchecks(cfg);
	ecs_conf_checks(cfg); // <------ new added function
}
Comment 1 Wouter Wijngaards 2017-08-22 09:43:44 CEST
Hi Uladzimir,

Thanks for the code, I have adjust it like below and committed it!

Best regards, Wouter


#ifdef CLIENT_SUBNET
/** check ECS configuration */
static void
ecs_conf_checks(struct config_file* cfg)
{
        struct ecs_whitelist* whitelist = NULL;
        if(!(whitelist = ecs_whitelist_create()))
                fatal_exit("Could not create ednssubnet whitelist: out of memory");
        if(!ecs_whitelist_apply_cfg(whitelist, cfg))
                fatal_exit("Could not setup ednssubnet whitelist");
        ecs_whitelist_delete(whitelist);
}
#endif /* CLIENT_SUBNET */