-/* $OpenBSD: parse.y,v 1.25 2021/02/27 10:32:28 florian Exp $ */
+/* $OpenBSD: parse.y,v 1.26 2021/07/25 08:34:43 florian Exp $ */
/*
* Copyright (c) 2018 Florian Obser <florian@openbsd.org>
}
;
-uw_pref : PREFERENCE { conf->res_pref.len = 0; } pref_block
+uw_pref : PREFERENCE {
+ conf->res_pref.len = 0;
+ memset(conf->enabled_resolvers, 0,
+ sizeof(conf->enabled_resolvers));
+ } pref_block
;
pref_block : '{' optnl prefopts_l '}'
YYERROR;
}
conf->res_pref.types[conf->res_pref.len++] = $1;
+ conf->enabled_resolvers[$1] = 1;
}
;
-/* $OpenBSD: resolver.c,v 1.144 2021/07/12 15:09:19 beck Exp $ */
+/* $OpenBSD: resolver.c,v 1.145 2021/07/25 08:34:43 florian Exp $ */
/*
* Copyright (c) 2018 Florian Obser <florian@openbsd.org>
static struct imsgev *iev_main;
struct uw_forwarder_head autoconf_forwarder_list;
struct uw_resolver *resolvers[UW_RES_NONE];
-int enabled_resolvers[UW_RES_NONE];
struct timespec last_network_change;
struct event trust_anchor_timer;
"IMSG_RECONF_CONF", __func__);
restart = resolvers_to_restart(resolver_conf, nconf);
merge_config(resolver_conf, nconf);
- memset(enabled_resolvers, 0, sizeof(enabled_resolvers));
- for (i = 0; i < resolver_conf->res_pref.len; i++)
- enabled_resolvers[
- resolver_conf->res_pref.types[i]] = 1;
nconf = NULL;
for (i = 0; i < UW_RES_NONE; i++)
if (restart[i])
free_resolver(resolvers[type]);
resolvers[type] = NULL;
- if (!enabled_resolvers[type])
+ if (!resolver_conf->enabled_resolvers[type])
return;
switch (type) {
resolvers_to_restart(struct uw_conf *oconf, struct uw_conf *nconf)
{
static int restart[UW_RES_NONE];
- int o_enabled[UW_RES_NONE];
- int n_enabled[UW_RES_NONE];
int i;
memset(&restart, 0, sizeof(restart));
&nconf->uw_dot_forwarder_list)) {
restart[UW_RES_DOT] = 1;
}
- memset(o_enabled, 0, sizeof(o_enabled));
- memset(n_enabled, 0, sizeof(n_enabled));
- for (i = 0; i < oconf->res_pref.len; i++)
- o_enabled[oconf->res_pref.types[i]] = 1;
-
- for (i = 0; i < nconf->res_pref.len; i++)
- n_enabled[nconf->res_pref.types[i]] = 1;
for (i = 0; i < UW_RES_NONE; i++) {
- if (n_enabled[i] != o_enabled[i])
+ if (oconf->enabled_resolvers[i] != nconf->enabled_resolvers[i])
restart[i] = 1;
}
return restart;
-/* $OpenBSD: unwind.c,v 1.61 2021/02/27 10:32:28 florian Exp $ */
+/* $OpenBSD: unwind.c,v 1.62 2021/07/25 08:34:43 florian Exp $ */
/*
* Copyright (c) 2018 Florian Obser <florian@openbsd.org>
UW_RES_DHCP,
UW_RES_ASR};
struct uw_conf *xconf;
+ int i;
xconf = calloc(1, sizeof(*xconf));
if (xconf == NULL)
memcpy(&xconf->res_pref.types, &default_res_pref,
sizeof(default_res_pref));
xconf->res_pref.len = nitems(default_res_pref);
+ for (i = 0; i < xconf->res_pref.len; i++)
+ xconf->enabled_resolvers[xconf->res_pref.types[i]] = 1;
TAILQ_INIT(&xconf->uw_forwarder_list);
TAILQ_INIT(&xconf->uw_dot_forwarder_list);
-/* $OpenBSD: unwind.h,v 1.54 2021/02/27 10:32:28 florian Exp $ */
+/* $OpenBSD: unwind.h,v 1.55 2021/07/25 08:34:43 florian Exp $ */
/*
* Copyright (c) 2018 Florian Obser <florian@openbsd.org>
struct uw_forwarder_head uw_dot_forwarder_list;
struct force_tree force;
struct resolver_preference res_pref;
+ int enabled_resolvers[UW_RES_NONE];
char *blocklist_file;
int blocklist_log;
};