From 74e06cc4b3fbe3dcea08eb93fcfca8f4359a9fb5 Mon Sep 17 00:00:00 2001 From: "W.C.A. Wijngaards" Date: Mon, 15 Feb 2021 14:40:48 +0100 Subject: [PATCH 1/3] - Fix #422: IPv6 fallback issues when IPv6 is not properly enabled/configured. --- daemon/worker.c | 3 +++ doc/Changelog | 4 ++++ iterator/iter_utils.c | 15 +++++++++++++++ iterator/iter_utils.h | 14 ++++++++++++++ 4 files changed, 36 insertions(+) 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 */ From 5943c6f2e3165eb8ac3ed90a0639884885379fb0 Mon Sep 17 00:00:00 2001 From: "W.C.A. Wijngaards" Date: Mon, 15 Feb 2021 14:57:29 +0100 Subject: [PATCH 2/3] - Fix to make tests work with support indicators set for iterator. --- doc/Changelog | 1 + iterator/iter_utils.c | 2 ++ 2 files changed, 3 insertions(+) diff --git a/doc/Changelog b/doc/Changelog index b5dbba8a9..9ad100145 100644 --- a/doc/Changelog +++ b/doc/Changelog @@ -1,6 +1,7 @@ 15 February 2021: Wouter - Fix #422: IPv6 fallback issues when IPv6 is not properly enabled/configured. + - Fix to make tests work with support indicators set for iterator. 10 February 2021: Wouter - Merge PR #420 from dyunwei: DOH not responsing with diff --git a/iterator/iter_utils.c b/iterator/iter_utils.c index 4edb1cfe6..94fa18f63 100644 --- a/iterator/iter_utils.c +++ b/iterator/iter_utils.c @@ -1445,6 +1445,8 @@ void iterator_set_ip46_support(struct module_stack* mods, if(m == -1) return; ie = (struct iter_env*)env->modinfo[m]; + if(outnet->pending == NULL) + return; /* we are in testbound, no rbtree for UDP */ if(outnet->num_ip4 == 0) ie->supports_ipv4 = 0; if(outnet->num_ip6 == 0) From 92d01d82658ffc3992e4468472d3c8c080f8b16c Mon Sep 17 00:00:00 2001 From: Victor Stinner Date: Tue, 16 Feb 2021 11:11:06 +0100 Subject: [PATCH 3/3] Fix #426: Replace _Py_fopen() with fopen() in pythonmod.c The private _Py_fopen() function has been removed in Python 3.10. Fix build on Python 3.10. --- doc/Changelog | 1 + pythonmod/pythonmod.c | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/doc/Changelog b/doc/Changelog index 9ad100145..f855e5a9a 100644 --- a/doc/Changelog +++ b/doc/Changelog @@ -2,6 +2,7 @@ - Fix #422: IPv6 fallback issues when IPv6 is not properly enabled/configured. - Fix to make tests work with support indicators set for iterator. + - Fix build on Python 3.10. 10 February 2021: Wouter - Merge PR #420 from dyunwei: DOH not responsing with diff --git a/pythonmod/pythonmod.c b/pythonmod/pythonmod.c index 040ff7051..6e60d02fe 100644 --- a/pythonmod/pythonmod.c +++ b/pythonmod/pythonmod.c @@ -338,7 +338,7 @@ int pythonmod_init(struct module_env* env, int id) PyFileObject = PyFile_FromString((char*)pe->fname, "r"); script_py = PyFile_AsFile(PyFileObject); #else - script_py = _Py_fopen(pe->fname, "r"); + script_py = fopen(pe->fname, "r"); #endif if (script_py == NULL) {