resolved: filter stub listeners in manager_get_dns_server()
authorTom Yan <tom.ty89@gmail.com>
Wed, 8 Dec 2021 02:53:07 +0000 (10:53 +0800)
committerTom Yan <tom.ty89@gmail.com>
Mon, 13 Dec 2021 15:08:40 +0000 (23:08 +0800)
commitaf45251e4ce2ff48eb86769cccf48ffd51f49ce0
treed211530f6cf305a0984d7088f13a1b618a0f6a1e
parentfdae4504c78861e7c628b64055dea59a77e2641f
resolved: filter stub listeners in manager_get_dns_server()

Commit 49ef064c8dcd8ed12d98e6c705e676babade0897 attempts to handle
"stub loop" by switching to the next server *after the query has
been made*.

The approach may be good enough for link scopes. However, for the
manager / global scope, it is not. First of all, there are more than
one types (SYSTEM and FALLBACK) of servers it can use. Also, whether
those of type FALLBACK should be used depends.

Besides, dns_scope_good_domain() determines whether things should
be routed to a scope by checking whether the scope has a server.
The decision made would be incorrect if stubs were not filtered
beforehand.

Therefore, to avoid failing query unnecessarily, and to make sure
that extra stub listeners will not trigger unexpected and/or
inconsistent behavior, make manager_get_dns_server() do what it
should have done.
src/resolve/resolved-dns-server.c