Skip to content

tests/server/dnsd: basic DNS server for test suite #17015

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

Closed
wants to merge 3 commits into from
Closed

Conversation

bagder
Copy link
Member

@bagder bagder commented Apr 10, 2025

Currently the DNS server only responds to A and AAAA queries. It always responds with a fixed response: the localhost address. Three times.

It should work fine over either IPv4 or IPv6, but I don't think it matters much for curl testing.

The idea is to allow curl tests to use "normal" DNS hostnames (using the normal name resolving code paths) and still use the local test servers.

This setup currently only works if curl is built with c-ares.

This should be extended to respond to HTTPS queries as well to allow more testing there, as c-ares is always used for that.

Test 2102 is the first test using this.

@bagder bagder added the tests label Apr 10, 2025
@testclutch

This comment was marked as outdated.

@bagder

This comment was marked as resolved.

@bagder

This comment was marked as resolved.

Currently the DNS server only responds to A and AAAA queries. It always
responds with a fixed response: the localhost address. Three times.

It should work fine over either IPv4 or IPv6, but I don't think it
matters much for curl testing.

The idea is to allow curl tests to use "normal" DNS hostnames (using the
normal name resolving code paths) and still use the local test servers.

This setup currently only works if curl is built with c-ares because
redirecting DNS requests to our test server when using getaddrinfo() is
not easy.

This should be extended to respond to HTTPS queries as well to allow
more testing there, as c-ares is always used for that.

Test 2102 is the first test using this.
@bagder bagder force-pushed the bagder/dnsd branch 2 times, most recently from 0b14222 to df0cbaa Compare April 17, 2025 06:22
@bagder bagder marked this pull request as ready for review April 17, 2025 06:26
@bagder bagder added the name lookup DNS and related tech label Apr 17, 2025
@bagder
Copy link
Member Author

bagder commented Apr 17, 2025

There is lots more to do when it comes to testing with a DNS server present, but I want to land this initial work as a first shot and then we can keep on expanding on this:

  • add tests for every scenario in the code where we do name resolves
  • add tests with negative name resolves, failing them
  • add HTTPS response support, then expand HTTPS testing
  • add HTTPS+ECH response support, then do something to verify the ECH handling
  • add tests doing multiple parallel transfers doing slow name resolves (so that the subsequent ones could just queue up and wait for the first resolve)
  • and more things we will think of later

@bagder bagder closed this in 02e9690 Apr 17, 2025
@bagder bagder deleted the bagder/dnsd branch April 17, 2025 08:02
nbaws pushed a commit to nbaws/curl that referenced this pull request Apr 26, 2025
Currently the DNS server only responds to A and AAAA queries. It always
responds with a fixed response: the localhost address. Three times.

It should work fine over either IPv4 or IPv6, but I don't think it
matters much for curl testing.

The idea is to allow curl tests to use "normal" DNS hostnames (using the
normal name resolving code paths) and still use the local test servers.

This setup currently only works if curl is built with c-ares because
redirecting DNS requests to our test server when using getaddrinfo() is
not easy.

This should be extended to respond to HTTPS queries as well to allow
more testing there, as c-ares is always used for that.

Test 2102 is the first test using this.

Closes curl#17015
nbaws pushed a commit to nbaws/curl that referenced this pull request Apr 26, 2025
Currently the DNS server only responds to A and AAAA queries. It always
responds with a fixed response: the localhost address. Three times.

It should work fine over either IPv4 or IPv6, but I don't think it
matters much for curl testing.

The idea is to allow curl tests to use "normal" DNS hostnames (using the
normal name resolving code paths) and still use the local test servers.

This setup currently only works if curl is built with c-ares because
redirecting DNS requests to our test server when using getaddrinfo() is
not easy.

This should be extended to respond to HTTPS queries as well to allow
more testing there, as c-ares is always used for that.

Test 2102 is the first test using this.

Closes curl#17015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
name lookup DNS and related tech tests
Development

Successfully merging this pull request may close these issues.

2 participants