Skip to content

dnsdist: add backend redirections (EDSR) - #17828

Open
esensar wants to merge 1 commit into
PowerDNS:masterfrom
esensar:feature/edsr
Open

dnsdist: add backend redirections (EDSR)#17828
esensar wants to merge 1 commit into
PowerDNS:masterfrom
esensar:feature/edsr

Conversation

@esensar

@esensar esensar commented Jul 31, 2026

Copy link
Copy Markdown
Contributor

Short description

This implements EDSR (draft) for backends. This applies both to encrypted backends and ones that were upgraded with autoUpgrade flag. This allows the backends to advertise preferable alternative backends, using the same mechanism as DDR (autoUpgrade), but only via encrypted channels.

Checklist

I have:

  • read the CONTRIBUTING.md document
  • read and accepted the Developer Certificate of Origin document, including the AI Policy, and added a "Signed-off-by" to my commits
  • 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)

Sponsored by Quad9

This implements [EDSR][EDSR] for backends. This applies both to encrypted
backends and ones that were upgraded with `autoUpgrade` flag.

[EDSR]: https://datatracker.ietf.org/doc/draft-ietf-add-encrypted-dns-server-redirection/00/

Signed-off-by: Ensar Sarajčić <dev@ensarsarajcic.com>
Comment on lines +106 to +124
bool d_enableRedirect;
std::string d_poolAfterRedirect;
uint32_t d_redirectInterval;
uint16_t d_redirectDohKey;
bool d_keepAfterRedirect;
uint32_t d_redirectMaxFollowCount;
};

static bool getDiscoveredConfig(const Logr::Logger& logger, const UpgradeableBackend& backend, DiscoveredResolverConfig& config);
static bool tryToUpgradeBackend(const Logr::Logger& logger, const UpgradeableBackend& backend);
struct RedirectableBackend
{
std::shared_ptr<DownstreamState> d_origDs;
std::shared_ptr<DownstreamState> d_currentDs;
std::string d_poolAfterRedirect;
time_t d_nextCheck;
uint32_t d_interval;
uint16_t d_dohKey;
bool d_keepAfterRedirect;
uint32_t d_maxFollowCount;
};

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

There are many duplicated fields here, because redirection pairs well with upgrade (starting off from unencrypted backend, upgrading to encrypted and then using that encrypted channel to choose a more suitable backend) - would it make more sense to combine these structs and just add a flag to mark backends picked for redirection?

@coveralls

Copy link
Copy Markdown

Coverage Report for CI Build 30616844269

Coverage increased (+11.7%) to 71.167%

Details

  • Coverage increased (+11.7%) from the base build.
  • Patch coverage: 110 uncovered changes across 4 files (214 of 324 lines covered, 66.05%).
  • 22355 coverage regressions across 299 files.

Uncovered Changes

File Changed Covered %
pdns/dnsdistdist/dnsdist-discovery.cc 253 177 69.96%
pdns/dnsdistdist/dnsdist-lua.cc 42 17 40.48%
pdns/dnsdistdist/dnsdist-discovery.hh 24 18 75.0%
pdns/dnsdistdist/dnsdist-configuration-yaml.cc 5 2 40.0%

Coverage Regressions

22355 previously-covered lines in 299 files lost coverage.

Top 10 Files by Coverage Loss Lines Losing Coverage Coverage
pdns/lua-record.cc 838 0.16%
pdns/recursordist/rec-main.cc 778 65.77%
pdns/dnsdistdist/dnsdist-lua.cc 759 51.79%
pdns/recursordist/syncres.cc 603 81.75%
pdns/recursordist/rec_channel_rec.cc 555 36.35%
modules/lmdbbackend/lmdbbackend.cc 533 72.28%
pdns/dnsdistdist/dnsdist.cc 518 68.8%
pdns/recursordist/ws-recursor.cc 495 22.03%
pdns/auth-main.cc 454 52.7%
pdns/tcpiohandler.cc 454 61.89%

Coverage Stats

Coverage Status
Relevant Lines: 173201
Covered Lines: 135135
Line Coverage: 78.02%
Relevant Branches: 82902
Covered Branches: 47125
Branch Coverage: 56.84%
Branches in Coverage %: Yes
Coverage Strength: 7784097.2 hits per line

💛 - Coveralls

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants