rec: Generate EDE in more cases, specifically on unreachable auths or sythesized results. by omoerbeek · Pull Request #12334 · PowerDNS/pdns · GitHub
Skip to content

rec: Generate EDE in more cases, specifically on unreachable auths or sythesized results. - #12334

Merged
omoerbeek merged 5 commits into
PowerDNS:masterfrom
omoerbeek:rec-more-edns
Jan 3, 2023
Merged

rec: Generate EDE in more cases, specifically on unreachable auths or sythesized results.#12334
omoerbeek merged 5 commits into
PowerDNS:masterfrom
omoerbeek:rec-more-edns

Conversation

@omoerbeek

@omoerbeek omoerbeek commented Dec 16, 2022

Copy link
Copy Markdown
Member

Examples:

; EDE: 0 (Other): (Result synthesized from aggressive NSEC cache (RFC8198))
; EDE: 0 (Other): (Result synthesized by root-nx-trust)
; EDE: 22 (No Reachable Authority): (delegation timeout4.com)

As there is no specific EDE for synthesized, use noError with a text for now.

We have to be careful here: a single client query can lead to multiple beginResolve calls. Some of these are done after the main result has been looked up, for example to validate the result. These subsequent calls can generate EDE's but we do not want to copy the EDE to the main result in those cases. A typical example would be an absent DS for an Insecure domain. Nothing wrong with these but we do not want the potential absent DS EDE (which could be synthesized) to be returned with the main query,

Update: In the meantime, a EDE was requested and assigned: 29: "Synthesized" (https://www.iana.org/assignments/dns-parameters/dns-parameters.xhtml#extended-dns-error-codes).

This EDE is intended for cases where the recursor decided to synthesise (construct an answer without getting it verbatim from an authoritative server previously), based on e.g. the methods described in RFC8020 (NXDOMAIN: There Really Is Nothing Underneath https://www.rfc-editor.org/rfc/rfc8020) and RFC 8198 (Aggressive Use of DNSSEC-Validated Cache https://www.rfc-editor.org/rfc/rfc8198.html).

Short description

Checklist

I have:

  • read the CONTRIBUTING.md document
  • compiled this code
  • tested this code
  • included documentation (including possible behaviour changes)
  • documented the code
  • added or modified regression test(s)
  • added or modified unit test(s)

…hesized results.

As there is no specific EDE for synthesised, use noError with a text.

We have to be careful here: a single client query can lead to
multiple beginResolve calls. Some of these are done after the main
result has been looked up, for example to validate the result. These
subsequent calls can generate EDE's but we do not want to copy the
EDE to the main result in those cases. A typical example would be
an absent DS for an Insecure domain. Nothing wrong with these but
we do not want the potential absent DS EDE (which could be synthesize)
to be returned with the main query,

To solve this, mimic the processing of validation state and add
an extra argument to a few methods.

I am not terribly happy with the extra argument. Maybe we should
move to an object holding the parameters and result status of the
nested or subsequent calls.  This would also avoid some of the saveX,
setX, beginResolve, restore X sequences.

So marking this as Draft for now.
@omoerbeek
omoerbeek marked this pull request as draft December 16, 2022 09:56
@rgacogne

Copy link
Copy Markdown
Member

I am not terribly happy with the extra argument. Maybe we should move to an object holding the parameters and result status of the nested or subsequent calls. This would also avoid some of the saveX, setX, beginResolve, restore X sequences.

My rule of thumb is, when I'm pondering adding an object to group values it's pretty much always the right call :)

Later, more fields that apply to a specific beginResolve call
might be added.
if (giveNegative) {

state = cachedState;
context.state = cachedState;

Check failure

Code scanning / CodeQL

Potentially uninitialized local variable

The variable [cachedState](1) may not be initialized at this access.
@omoerbeek
omoerbeek marked this pull request as ready for review December 20, 2022 11:55
@rgacogne
rgacogne self-requested a review January 2, 2023 14:40

@rgacogne rgacogne left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me!

Comment thread pdns/recursordist/syncres.cc Outdated
}
if (s_addExtendedResolutionDNSErrors) {
// XXX Do we want this?
context.extendedError = EDNSExtendedError{0, "Result from negative cache"};

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That would make sense to me, at least when the entire name is negatively cached (and it would be nice to convey that in our EDE message).

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A push a commit making the distinction

@@ -2992,7 +3003,7 @@ bool SyncRes::doCacheCheck(const DNSName& qname, const DNSName& authname, bool w
if (!giveNegative)
res = 0;
LOG(prefix << qname << ": updating validation state with cache content for " << qname << " to " << cachedState << endl);

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Perhaps we might want to add an EDE status on positive hits as well? But that might be a bit too much?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

IMO that would be a bit too much

@omoerbeek
omoerbeek merged commit 39942da into PowerDNS:master Jan 3, 2023
@omoerbeek
omoerbeek deleted the rec-more-edns branch January 3, 2023 10:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants