[GH-ISSUE #56] Listen on all addresses #335

Closed
opened 2026-03-15 22:02:18 +03:00 by kerem · 4 comments
Owner

Originally created by @rbmj on GitHub (Oct 25, 2016).
Original GitHub issue: https://github.com/hickory-dns/hickory-dns/issues/56

Currently, named doesn't actually listen on all specified addresses. It takes the first address (both v4 and v6), or a default of 0.0.0.0 and ::0. In addition, there's no way to disable IPv4 or IPv6 as even if an IPv4 address is specified the system still will use the default IPv6 address - even if no IPv6 address is set or even if it is explicitly set to the empty list.

This breaks some dual-stack systems as well where IPV6_V6ONLY is by default false, because the v6 socket cannot bind as it conflicts with the v4 socket.

The attached patch is my attempt to fix the issue - I haven't tested every edge case, but it works on my system (debian) with the default configuration (example.toml) under simple tests, and seems sane to me.
0001-Listen-on-all-available-IP-addresses.txt

Originally created by @rbmj on GitHub (Oct 25, 2016). Original GitHub issue: https://github.com/hickory-dns/hickory-dns/issues/56 Currently, named doesn't actually listen on all specified addresses. It takes the first address (both v4 and v6), or a default of `0.0.0.0` and `::0`. In addition, there's no way to disable IPv4 or IPv6 as even if an IPv4 address is specified the system still will use the default IPv6 address - even if no IPv6 address is set _or_ even if it is explicitly set to the empty list. This breaks some dual-stack systems as well where `IPV6_V6ONLY` is by default false, because the v6 socket cannot bind as it conflicts with the v4 socket. The attached patch is my attempt to fix the issue - I haven't tested every edge case, but it works on my system (debian) with the default configuration (example.toml) under simple tests, and seems sane to me. [0001-Listen-on-all-available-IP-addresses.txt](https://github.com/bluejekyll/trust-dns/files/551371/0001-Listen-on-all-available-IP-addresses.txt)
kerem 2026-03-15 22:02:18 +03:00
  • closed this issue
  • added the
    bug
    label
Author
Owner

@bluejekyll commented on GitHub (Oct 25, 2016):

Thanks for submitting this. I'll try and apply the patch you submitted and put up a PR as soon as I can. This might not be for a few days though.

<!-- gh-comment-id:256162425 --> @bluejekyll commented on GitHub (Oct 25, 2016): Thanks for submitting this. I'll try and apply the patch you submitted and put up a PR as soon as I can. This might not be for a few days though.
Author
Owner

@rbmj commented on GitHub (Oct 26, 2016):

That sounds fine - next time I'll be less lazy and get github to do a proper fork for me.

<!-- gh-comment-id:256243332 --> @rbmj commented on GitHub (Oct 26, 2016): That sounds fine - next time I'll be less lazy and get github to do a proper fork for me.
Author
Owner

@bluejekyll commented on GitHub (Oct 29, 2016):

See the commit I just pushed. That incorporates your fix (mostly verbatum, though I made it fail a little nicer).

I wrote a new test harness for the named bin, which I had been planning on doing for a while, this gave me a good reason to. Anyway, you can run these tests with cargo test or more specifically cargo test --test z_named_test to test just ipv4 listeners, and both ipv4 and ipv6. I found at least on my mac that an ipv6 only listener is still routable from ipv4 via the standard ipv4 address mapping to ipv6, not sure if that is true on other OS'

edit: travis still has a bad ipv6 config, so I had to ignore the ipv6 test, you can test that with cargo test --test z_named_test -- --ignored

<!-- gh-comment-id:257113837 --> @bluejekyll commented on GitHub (Oct 29, 2016): See the commit I just pushed. That incorporates your fix (mostly verbatum, though I made it fail a little nicer). I wrote a new test harness for the `named` bin, which I had been planning on doing for a while, this gave me a good reason to. Anyway, you can run these tests with `cargo test` or more specifically `cargo test --test z_named_test` to test just ipv4 listeners, and both ipv4 and ipv6. I found at least on my mac that an ipv6 only listener is still routable from ipv4 via the standard ipv4 address mapping to ipv6, not sure if that is true on other OS' edit: travis still has a bad ipv6 config, so I had to ignore the ipv6 test, you can test that with `cargo test --test z_named_test -- --ignored`
Author
Owner

@bluejekyll commented on GitHub (Nov 1, 2016):

I believe that the patch I submitted fixes this. If not please reopen.

<!-- gh-comment-id:257499835 --> @bluejekyll commented on GitHub (Nov 1, 2016): I believe that the patch I submitted fixes this. If not please reopen.
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/hickory-dns#335
No description provided.