Skip to content
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

More resolv.conf features #89

Merged
merged 24 commits into from
Jul 30, 2019
Merged

Conversation

brzuchal
Copy link
Contributor

@brzuchal brzuchal commented Jul 25, 2019

This PR resolves #47
All added features works the same way as glibc implementation of resolv.conf
Changes:

  • added search setting support
  • added domain setting support
  • added options ndots:X support, where X is positive integer, silently capped to 15
  • added options rotate support, which balance using round robin between nameservers
  • fixed options timeout X now works with with : delimiter in format options timeout:X
  • fixed options attempts X now works with with : delimiter in format options attempts:X
  • env LOCALDOMAIN which overrides search and domain
  • env RES_OPTIONS which overrides default options like ndots, timeout, attempts, rotate
  • when no search list provided and no env LOCALDOMAIN given gethostname() is used

Valid resolv.conf format (from Travis CI):

# Dynamic resolv.conf(5) file for glibc resolver(3) generated by resolvconf(8)
#     DO NOT EDIT THIS FILE BY HAND -- YOUR CHANGES WILL BE OVERWRITTEN
nameserver 169.254.169.254
search c.travis-ci-prod-2.internal google.internal
options timeout:1
options attempts:3
options ndots:3
options rotate

All max and default values are taken from resolv/res_init.c and from man

@brzuchal
Copy link
Contributor Author

brzuchal commented Jul 25, 2019

Tests not passing on Travis using 169.254.169.254 nameserver.
The issue was in options timeout:1 cause its unit is seconds, not milliseconds.

lib/UnixConfigLoader.php Outdated Show resolved Hide resolved
lib/Config.php Outdated Show resolved Hide resolved
lib/Rfc1035StubResolver.php Outdated Show resolved Hide resolved
lib/Rfc1035StubResolver.php Show resolved Hide resolved
lib/UnixConfigLoader.php Outdated Show resolved Hide resolved
lib/Rfc1035StubResolver.php Outdated Show resolved Hide resolved
lib/Rfc1035StubResolver.php Outdated Show resolved Hide resolved
lib/Config.php Outdated Show resolved Hide resolved
lib/Config.php Outdated Show resolved Hide resolved
lib/Rfc1035StubResolver.php Outdated Show resolved Hide resolved
lib/Rfc1035StubResolver.php Outdated Show resolved Hide resolved
lib/Rfc1035StubResolver.php Outdated Show resolved Hide resolved
lib/UnixConfigLoader.php Show resolved Hide resolved
lib/UnixConfigLoader.php Outdated Show resolved Hide resolved
lib/UnixConfigLoader.php Outdated Show resolved Hide resolved
lib/UnixConfigLoader.php Outdated Show resolved Hide resolved
lib/UnixConfigLoader.php Outdated Show resolved Hide resolved
test/IntegrationTest.php Show resolved Hide resolved
test/IntegrationTest.php Show resolved Hide resolved
@brzuchal
Copy link
Contributor Author

Integration test fails on x64 platform on AppVeyor randomly.

1) Amp\Dns\Test\IntegrationTest::testResolve with data set #2 ('stackoverflow.com')
Amp\Dns\DnsException: All query attempts failed for stackoverflow.com: No response for 'stackoverflow.com' (A) from any nameserver after 2 attempts, tried udp://8.8.8.8:53, udp://8.8.4.4:53, No response for 'stackoverflow.com' (AAAA) from any nameserver after 2 attempts, tried udp://8.8.8.8:53, udp://8.8.4.4:53

@kelunik shouldn't we use default OS settings there?

@kelunik kelunik merged commit 493d014 into amphp:master Jul 30, 2019
@kelunik
Copy link
Member

kelunik commented Jul 30, 2019

@brzuchal Probably, yes.

Merged, thanks! 🎉

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

Successfully merging this pull request may close these issues.

Support for LOCALDOMAIN and search
2 participants