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

Handle bracketed IPv6 addresses without ports #6057

Merged
merged 2 commits into from Dec 8, 2017

Conversation

zeha
Copy link
Collaborator

@zeha zeha commented Dec 5, 2017

dnsdist's newServer source parameter is documented to take values
of those forms (plus some more):

  • v4 address ("192.0.2.1")
  • v6 address ("2001:DB8::1")

For consistency, bracketed addresses ("[2001:DB8::1]") should work too, and all of them
should have a test.

Example that would previously "fail":

newServer({name="pdns", address="[::1]:5300", source="[::1]"}):setUp()

Gives:

Dismissing source [::1] because '[::1]' is not a valid interface name
Added downstream server [::1]:5300

Checklist

I have:

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

dnsdist's newServer source parameter is documented to take values
of those forms (plus some more):
  - v4 address ("192.0.2.1")
  - v6 address ("2001:DB8::1")

For consistency, bracketed addresses should work too, and all of them
should have a test.
Copy link
Member

@rgacogne rgacogne left a comment

Choose a reason for hiding this comment

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

Looks good to me!

pdns/misc.cc Outdated
catch(std::out_of_range) {
return -1;
if (pos + 1 == addr.size()) {
port = 0;
Copy link
Member

Choose a reason for hiding this comment

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

It looks like setting port to 0 without setting portSet to true is useless?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Hmmm yes. Will change that if()...

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

@rgacogne fixed this!

@rgacogne rgacogne merged commit f50f10a into PowerDNS:master Dec 8, 2017
@zeha zeha deleted the combo-ipv6 branch January 29, 2018 17:40
rgacogne added a commit to rgacogne/pdns that referenced this pull request Feb 14, 2018
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.

None yet

2 participants