Skip to content

rec: implement DNS cookie support for outgoing requests #15412

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 22 commits into
base: master
Choose a base branch
from

Conversation

omoerbeek
Copy link
Member

Short description

Draft, as I need to do some bulk tests.

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)

@omoerbeek omoerbeek added this to the rec-5.3.0 milestone Apr 9, 2025
@coveralls
Copy link

coveralls commented Apr 9, 2025

Pull Request Test Coverage Report for Build 14754294555

Warning: This coverage report may be inaccurate.

This pull request's base commit is no longer the HEAD commit of its target branch. This means it includes changes from outside the original pull request, including, potentially, unrelated coverage changes.

Details

  • 256 of 315 (81.27%) changed or added relevant lines in 10 files are covered.
  • 72 unchanged lines in 12 files lost coverage.
  • Overall coverage increased (+0.1%) to 63.685%

Changes Missing Coverage Covered Lines Changed/Added Lines %
pdns/ednscookies.cc 17 19 89.47%
pdns/recursordist/syncres.cc 17 21 80.95%
pdns/recursordist/rec-cookiestore.cc 22 27 81.48%
pdns/recursordist/rec-cookiestore.hh 16 21 76.19%
pdns/recursordist/rec_channel_rec.cc 7 17 41.18%
pdns/recursordist/lwres.cc 156 189 82.54%
Files with Coverage Reduction New Missed Lines %
pdns/signingpipe.cc 1 86.06%
pdns/validate.cc 1 68.42%
pdns/query-local-address.cc 2 91.49%
pdns/recursordist/syncres.cc 2 80.63%
pdns/iputils.cc 3 58.32%
pdns/rcpgenerator.cc 3 90.73%
pdns/recursordist/test-syncres_cc2.cc 3 88.85%
pdns/dnsdistdist/dnsdist-tcp.cc 5 77.15%
pdns/recursordist/test-syncres_cc1.cc 5 90.08%
modules/lmdbbackend/lmdbbackend.cc 14 73.2%
Totals Coverage Status
Change from base Build 14753779081: 0.1%
Covered Lines: 130006
Relevant Lines: 169348

💛 - Coveralls

contacted again, it should use the same bound IP.

- Although it is perfectly fine for a client cookie to live for a long time, this design will
flush entries older that a certain period of time, to avoid an ever growing CookieStore.
Copy link
Contributor

Choose a reason for hiding this comment

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

Avoid an ever-growing cookie store? I'm not sure the cookie monster will like this.
war-and-peas-accept-cookies-1

@omoerbeek
Copy link
Member Author

Rebased to fix conflicts

@omoerbeek
Copy link
Member Author

omoerbeek commented Apr 30, 2025

Did a few bulk tests both with cookie enabled and disabled and saw no issues. So ready for review.

@omoerbeek omoerbeek marked this pull request as ready for review April 30, 2025 13:26
Copy link
Member

@Habbie Habbie left a comment

Choose a reason for hiding this comment

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

not a full review, just some comments

@@ -15,12 +15,15 @@ IMPORTS
FROM SNMPv2-CONF;

rec MODULE-IDENTITY
LAST-UPDATED "202408280000Z"
LAST-UPDATED "202504290000Z"
Copy link
Member

Choose a reason for hiding this comment

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

(not for this PR really)

should this .txt be in git at all? it is generated

Copy link
Member Author

Choose a reason for hiding this comment

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

We refer to it from docs, so it needs to be somewhere.

omoerbeek and others added 2 commits May 9, 2025 08:05
Co-authored-by: Peter van Dijk <[email protected]>
…mments why binding to a given local address is needed
Copy link
Member

@Habbie Habbie left a comment

Choose a reason for hiding this comment

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

This looks solid. I reviewed all code -except- the tests (which somebody should definitely still do, that's where the proof is).

I wonder about the case where an auth

  • responds normally to non-EDNS queries
  • responds correctly to EDNS queries
  • responds FORMERR to EDNS queries with a cookie, with the distinctive cases of (1) it tells you it hates the cookie opt [by having EDNS in the reply] (2) it tells you it has broken EDNS support [by not having EDNS in the reply]

{
'name': 'cookies-supported',
'lambda': '[] { return g_Counters.sum(rec::Counter::cookiesSupported); }',
'desc': 'Number of authoritative server IPs marked as supporting cookies',
Copy link
Member

Choose a reason for hiding this comment

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

given that entries eventually expire, this sentence is not completely accurate. I don't have better wording though (and I suspect this problem is not limited to this PR)

Copy link
Member Author

Choose a reason for hiding this comment

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

Number of of authoritative server IPs currently known to support cookies?

Copy link
Member

Choose a reason for hiding this comment

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

but a single IP might still be counted twice if we don't talk to it for a while, right?

Copy link
Member Author

Choose a reason for hiding this comment

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

Right... Number of cookies probes resulting in succes?

Copy link
Member

Choose a reason for hiding this comment

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

ah yes, I suppose so! in that case it goes with the cookie* stats, not the cookies* stats, and the same for Unsupported, so cookieProbeSupported and cookieProbeUnsupported

@omoerbeek
Copy link
Member Author

Thanks! I did all the trivial things. Will review the EDNS supported/FormErr etc logic soon.

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.

4 participants