From: W.C.A. Wijngaards Date: Mon, 15 Feb 2021 13:40:48 +0000 (+0100) Subject: - Fix #422: IPv6 fallback issues when IPv6 is not properly X-Git-Tag: release-1.13.2rc1~272 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=74e06cc4b3fbe3dcea08eb93fcfca8f4359a9fb5;p=thirdparty%2Funbound.git - Fix #422: IPv6 fallback issues when IPv6 is not properly enabled/configured. --- diff --git a/daemon/worker.c b/daemon/worker.c index 57d58a90d..c56d7b469 100644 --- a/daemon/worker.c +++ b/daemon/worker.c @@ -70,6 +70,7 @@ #include "util/edns.h" #include "iterator/iter_fwd.h" #include "iterator/iter_hints.h" +#include "iterator/iter_utils.h" #include "validator/autotrust.h" #include "validator/val_anchor.h" #include "respip/respip.h" @@ -1821,6 +1822,8 @@ worker_init(struct worker* worker, struct config_file *cfg, worker_delete(worker); return 0; } + iterator_set_ip46_support(&worker->daemon->mods, worker->daemon->env, + worker->back); /* start listening to commands */ if(!tube_setup_bg_listen(worker->cmd, worker->base, &worker_handle_control_cmd, worker)) { diff --git a/doc/Changelog b/doc/Changelog index 5c7ac0c7d..b5dbba8a9 100644 --- a/doc/Changelog +++ b/doc/Changelog @@ -1,3 +1,7 @@ +15 February 2021: Wouter + - Fix #422: IPv6 fallback issues when IPv6 is not properly + enabled/configured. + 10 February 2021: Wouter - Merge PR #420 from dyunwei: DOH not responsing with "http2_query_read_done failure" logged. diff --git a/iterator/iter_utils.c b/iterator/iter_utils.c index 7bc67da69..4edb1cfe6 100644 --- a/iterator/iter_utils.c +++ b/iterator/iter_utils.c @@ -50,6 +50,7 @@ #include "services/cache/infra.h" #include "services/cache/dns.h" #include "services/cache/rrset.h" +#include "services/outside_network.h" #include "util/net_help.h" #include "util/module.h" #include "util/log.h" @@ -1435,3 +1436,17 @@ iter_stub_fwd_no_cache(struct module_qstate *qstate, struct query_info *qinf) } return 0; } + +void iterator_set_ip46_support(struct module_stack* mods, + struct module_env* env, struct outside_network* outnet) +{ + int m = modstack_find(mods, "iterator"); + struct iter_env* ie = NULL; + if(m == -1) + return; + ie = (struct iter_env*)env->modinfo[m]; + if(outnet->num_ip4 == 0) + ie->supports_ipv4 = 0; + if(outnet->num_ip6 == 0) + ie->supports_ipv6 = 0; +} diff --git a/iterator/iter_utils.h b/iterator/iter_utils.h index f771930bb..a56be95ae 100644 --- a/iterator/iter_utils.h +++ b/iterator/iter_utils.h @@ -59,6 +59,8 @@ struct reply_info; struct module_qstate; struct sock_list; struct ub_packed_rrset_key; +struct module_stack; +struct outside_network; /** * Process config options and set iterator module state. @@ -385,4 +387,16 @@ int iter_dp_cangodown(struct query_info* qinfo, struct delegpt* dp); int iter_stub_fwd_no_cache(struct module_qstate *qstate, struct query_info *qinf); +/** + * Set support for IP4 and IP6 depending on outgoing interfaces + * in the outside network. If none, no support, so no use to lookup + * the AAAA and then attempt to use it if there is no outgoing-interface + * for it. + * @param mods: modstack to find iterator module in. + * @param env: module env, find iterator module (if one) in there. + * @param outnet: outside network structure. + */ +void iterator_set_ip46_support(struct module_stack* mods, + struct module_env* env, struct outside_network* outnet); + #endif /* ITERATOR_ITER_UTILS_H */