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

ADD support for ipv6-console access #10

Merged
merged 2 commits into from
Sep 10, 2024

Conversation

Shirkanesi
Copy link
Contributor

The current implementation does not allow to connect to a dnsdist-console listening only on v6.
This Patch checks whether the given address is a v4 or v6 address and creates the correct socket.

Feel free to add any suggestions for further changes :)

@dmachard
Copy link
Owner

Thanks for this PR.
All tests are failed but perhaps because the IPv6 protocol is not available in github runner.

Run python -m unittest tests.test_console
.E/opt/hostedtoolcache/Python/3.10.14/x64/lib/python3.10/unittest/case.py:613: ResourceWarning: unclosed <socket.socket fd=3, family=AddressFamily.AF_INET6, type=SocketKind.SOCK_STREAM, proto=0, laddr=('::1', 51026, 0, 0)>
  outcome.errors.clear()
ResourceWarning: Enable tracemalloc to get the object allocation traceback

======================================================================
ERROR: test_show_version (tests.test_console.TestConnectV6)
connect and get version
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/home/runner/work/python-dnsdist-console/python-dnsdist-console/tests/test_console.py", line 21, in setUp
    self.console = Console(host="::1", port=5199,
  File "/home/runner/work/python-dnsdist-console/python-dnsdist-console/dnsdist_console/console.py", line 26, in __init__
    self.connect_to()
  File "/home/runner/work/python-dnsdist-console/python-dnsdist-console/dnsdist_console/console.py", line 60, in connect_to
    self.sock.connect((self.console_host, self.console_port))
ConnectionRefusedError: [Errno 111] Connection refused

----------------------------------------------------------------------
Ran 2 tests in 0.064s

FAILED (errors=1)
Error: Process completed with ex

@Shirkanesi
Copy link
Contributor Author

Oh, this seems to be an interesting quirk of dnsdists config... Apparently [::] causes a bind on ipv4 and ipv6 but fails if 0.0.0.0 was specified before.
The new version works for me.

@dmachard dmachard merged commit 4564165 into dmachard:master Sep 10, 2024
20 checks passed
@Shirkanesi Shirkanesi deleted the ipv6_support branch September 10, 2024 19:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants