summaryrefslogtreecommitdiff
path: root/sbin/unwind/resolver.c
AgeCommit message (Collapse)Author
2022-03-12Probe for DNS64 presence with an absolute name so that asr doesn't addFlorian Obser
search domains and retry.
2021-12-18Make sure we receive what we expect over imsg.Florian Obser
Instead of repairing potential garbage ensure that we receive proper C strings. Inspired by a similar diff by deraadt@ for ldapd.
2021-11-16Validate RTM_PROPOSAL in resolver not frontendKlemens Nanni
The resolver is the actual consumer and shouldn't trust the frontend. Fold the IPv4/IPv6 specific checks thanks to the previous commit. Idea from florian OK florian
2021-11-16Simplify address family handling, ditch inet_ntop(3)Klemens Nanni
Reduce duplicate code and use getnameinfo(3) for IPv4 as well. This commit is the equivalent of sbin/resolvd/resolvd.c revision 1.21 "Simplify address family handling, ditch inet_ntop(3)". OK florian
2021-11-16Install missing scope identifier for IPv6 link-local addressesKlemens Nanni
RTM_PROPOSAL's list of IP addresses does not contain scope IDs by design. This is not a problem as the proposal is always bound to an interface, as long as we use it... Fill in the scope ID for link-local IPs and replace inet_ntop(3) usage with getnameinfo(3) in the IPv6 case such that it actually turns up in the string representation. This is the unwind specific fix to ensure working IPv6LL; libunbound still requires another fix. This commit is the equivalent of sbin/resolvd/resolvd.c revision 1.20 "Install missing scope identifier for IPv6 link-local addresses". OK florian
2021-10-23unwind(8) gives the most preferred resolver strategy a bit more timeFlorian Obser
(200ms) to answer before trying the next strategy. However, we need to skip strategies that are not available. In the default configuration, without a config file unwind(8) would give DoT 200ms more time, but no DoT forwarders are known, so this is useless. OK kn
2021-08-31Say autoconf not dhcpKlemens Nanni
Do not abuse "dhcp" to say "DHCP and SLAAC". unwind.conf(5) does so but unwindctl(8) does not; in fact, the latter already has `status autoconf' to Show nameservers learned from dhclient(8), dhcpleased(8) or slaacd(8). Adjust unwind's config manual and internal code accordingly; still accept the old keyword but do not document it. hostname.if(5) already advises for `inet[6] autoconf' instead of `dhcp' and other related daemons don't abuse the word "dhcp" like unwind does. Feedback sthen OK florian
2021-08-30INADDR_LOOPBACK check needs htonl(3) to workKlemens Nanni
Found in resolvd(8) which uses the same code.
2021-08-14Use new val-max-restart: 0 option to stop unwind from trying differentFlorian Obser
authorities when encountering a validation error. This only helps one particular case of validation errors: When authorities are out of sync and some carry old zones. In all other cases this causes a huge amount of work that will just end in a SERVFAIL because the result will still be bogus. OK sthen
2021-07-25Do not doubt a secure (i.e. validated) NXDOMAIN response when we justFlorian Obser
switched networks. We validated it, we can't do better than that! While here reorder the long list of conditions to make it easier to understand when we doubt a response because we might be behind a captive portal. First list all conditions when we do not doubt the response and then the two conditions when we do doubt the response. OK benno
2021-07-25We store a list of resolver strategies in order of their preference inFlorian Obser
the configuration struct. This is also an implicit list of enabled resolver strategies. We have also stored an explict lookup array of enabled strategies outside of the configuration to be able to quickly answer "is this strategy enabled" without traversing the preferences list. Move this table into the configuration so that we don't need to "repair" it on config reload. This fixes a bug where on startup the preferences list and enabled lookup table were not in sync. It didn't matter in practice since we do a config reload and then pass in DNSSEC trustanchors on startup. Both actions combined repaired things. OK benno
2021-07-12Change the error reporting pattern throughout the tree when unveilBob Beck
fails to report the path that the failure occured on. Suggested by deraadt@ after some tech discussion. Work done and verified by Ashton Fagg <ashton@fagg.id.au> ok deraadt@ semarie@ claudio@
2021-02-07Only probe for DNS64 presence when we know that we can talk to the slaacdFlorian Obser
provided nameservers, i.e. the stub resolver check succeeded. Previously we would only probe DNS64 on network change but would not reschedule when it failed. Sometimes (most of the time?) this failes because our address is still tentative or a default route has not yet been installed. OK phessler
2021-02-06Revert delayed opening of trust anchor file. The code was somewhatFlorian Obser
ugly and the underlying problem (dhclient and unwind playing well together) should be solved differently. Final straw was jca reporting that it breaks his setup.
2021-01-31Make progress when stepping through rdns proposals even when skippingFlorian Obser
localhost.
2021-01-30Re-try to open DNSSEC trust anchor file if /var is not mounted yet.Florian Obser
This is a step towards starting unwind earlier, before the network is up and partitions are mounted. OK kn
2021-01-29Some libunbound configuration changes can change the quality of aFlorian Obser
resolver so we have to schedule a re-check. OK kn
2021-01-28A new resolver can be created while we currently run a check with theFlorian Obser
old configuration. We will then request another check that runs in parallel to the old check. If the new check finishes earlier, the current check result will be overwritten by an outdated check result which is likely wrong. While here fix some whitespace. OK phessler
2021-01-27Determine available address families (and monitor when this changes)Florian Obser
to configure libunbound accordingly. This way it no longer tries to talk to IPv6 nameservers when only IPv4 is available and vice versa. input deraadt OK kn
2021-01-26Some config changes require a restart of all resolvers even DEAD ones;Florian Obser
handle them like UNKNOWN. Found the hard way by kn.
2021-01-25Disable logging to syslog for libunbound. We are not getting anythingFlorian Obser
useful for us out of it and it can be quite noisy when we are missing IPv4 or IPv6 addresses. It is still available when logging to stderr when running with -d. OK phessler
2021-01-24Implement DNS64 synthesis.Florian Obser
When unwind(8) learns new autoconf resolvers (from dhcp or router advertisements) it checks if a DNS64 is present in this network location and tries to recover the IPv6 prefix used according to RFC7050. The learned autoconf resolvers are then prevented from upgrading to the validating state since DNS64 breaks DNSSEC. unwind(8) can now perform its own synthesis. If a query for a AAAA record results in no answer we re-send the query for A and if that leads to an answer we synthesize an AAAA answer using the learned prefixes. Testing & OK kn
2021-01-23Move resolv_conf string generation for ASR to function; makesFlorian Obser
upcomming DNS64 diff simpler.
2021-01-23Don't just blindly upgrade to VALIDATING if we see a SECURE answer.Florian Obser
Let's go through the check_resolver() / new_resolver() code path which will also hook up the resovler to the shared cache. This means also one less special case for upcomming DNS64 support.
2021-01-19Make imsg event structs static to fix -fno-common.Florian Obser
Follows claudio's lead in ospfd et al. Problem reported by mortimer.
2021-01-19No need for a global uw_process; unbreaks -fno-common.Florian Obser
Problem reported by mortimer
2020-12-26Otto hit an impossible situation: an answer bigger than 64k.Florian Obser
Log the query and answer SERVFAIL instead of exiting fataly. That way we can at least figure out where libunbound goes off the rail. OK otto
2020-12-11Introduce query_imsg2str() to simplify printing "qname class type".Florian Obser
OK kn some time ago
2020-12-11The recent fix to handle large answers in unwind (errata #5 for 6.8)Florian Obser
has the downside to always copy the maximum IMSG size (about 16k) between the resolver and frontend process for DNS answers because we had to keep it as simple as possible. We can now rearange things in -current to be less wasteful. This copies only the usually small DNS answer. In the unusual case that a DNS answer is larger than the maximum IMSG size fragment the message and send multiple IMSGs.
2020-11-05Handle DNS answers that are larger than the maximum imsg size (aboutFlorian Obser
16k) by splitting them up. Previously unwind would send meta-data about the finished query from the resolver process to the frontend process and then silently fail to send the actual answer because it was too big for imsg. When receiving the meta-data for the next query the frontend process would then exit via fatal() because it was still expecting an answer. This likely fixes rare crashes observed by Leo Unglaub. Note that even with DNSSEC signatures, answers this big are very rare. OK tb, benno
2020-09-12When an interface disapears we need to forget the learned autoconfFlorian Obser
resolvers. OK kn
2020-05-10sockaddr_rtdns does not guarantee alignment of the buffer. So firstOtto Moerbeek
memcpy the address into a local var before comparing it with code that reads ints using int *. at least sparc64 and landisk suffer from this. with and ok jca@
2020-03-19Return when create_solver() returns NULL to prevent null pointer dereferencetobhe
in 'resolvers[type]->state = state'. ok florian@
2020-01-28We are not correctly upgrading from "UNKNOWN" to "VALIDATING"Florian Obser
resulting in a "fatal in resolver: wrong unified cache set on resolver". I believe this happens because we are using an UNKNOWN resolving strategy to resolve queries. Disable the upgrade logic for now and always construct a fresh resolver context and set the unified context on it before any cache gets allocated. This causes a bit of memory churn on startup and when changing networks, but better than a crashing unwind. First observed by deraadt
2020-01-28sbin/unwind: replace TAILQ concatenation loop with TAILQ_CONCATbket
OK florian@. reads ok benno@
2020-01-20We can not share a cache between validating and resolving strategies.Florian Obser
The resolving only strategies mess up the negative cache by claiming DNSSEC related records do not exist which confuses the validating strategies. Found the hard way by kn@ and analysed by otto@ OK kn@
2019-12-23Ralph Dolmans from nlnetlabs points out that libunbound usesFlorian Obser
ub_event_pluggable.c instead of ub_event.c. ( https://github.com/NLnetLabs/unbound/issues/99 ) We have been the odd one out, so switch to ub_event_pluggable, too.
2019-12-18Workaround unbound github issue #99.Florian Obser
https://github.com/NLnetLabs/unbound/issues/99 ub_ctx_delete would free the passed in event_base leading to use-after-free since libunbound never allocated the memory and unwind expects to continue using the event_base.
2019-12-18Implement unwindctl status memory to show chache memory usage.Florian Obser
testing by otto & pamela as part of a larger diff
2019-12-18Rework unified cache handling to be able to unify key and neg caches.Florian Obser
testing by otto & pamela as part of a larger diff
2019-12-15Make this fit in 80 cols.Florian Obser
2019-12-15Allow more outgoing ports, the default 16 is pretty tight for theOtto Moerbeek
recursor. Also change strategy to not fetch addresses of nameservers pro-actively, it does not help a lot in typical unwind setups and consumes resources we would like to spend on actual resolving user queries. ok florian@
2019-12-14Be less aggressive pre-allocating memory; ok florian@Otto Moerbeek
2019-12-14Simplify resolve_done.Florian Obser
- check if this is an answer to a still running query up front, if not there is nothing more to do - get rid of the retry case, we can now just inline it - reduce indent by always calculating elapsed time for DOUBT_NXDOMAIN_SEC Triggered by, input and OK otto
2019-12-14No use to create resolvers we know are going to be dead; ok florian@Otto Moerbeek
2019-12-13Don't try dead resolvers; ok florian@Otto Moerbeek
2019-12-13print type as type and not as rcodeOtto Moerbeek
2019-12-13Avoid leaks by using the _buf versions of sldns_wire2str_* functions.Otto Moerbeek
Also add some consistentcy checking to detect logic errors. ok @florian
2019-12-12Only create (and check) resolvers listed in preferences.Florian Obser
Unfortunately this required a fair amount of deck chair shuffling. Input & OK otto
2019-12-11Plug leaks related to running queue maintenance. ok florian@Otto Moerbeek