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

serve_tcp() fails out-of-the-box on systems with disabled IPv6 #853

Closed
oremanj opened this issue Jan 11, 2019 · 1 comment
Closed

serve_tcp() fails out-of-the-box on systems with disabled IPv6 #853

oremanj opened this issue Jan 11, 2019 · 1 comment

Comments

@oremanj
Copy link
Member

oremanj commented Jan 11, 2019

I recently had occasion to run a Trio server on a Linux system that had ipv6.disable=1 in the kernel command line. I don't know why it was configured this way, but some Googling suggests that this is not such a very uncommon configuration. In this configuration, getaddrinfo(None, ...) still returns an IPv6 option, but socket(AF_INET6, ...) fails with [Errno 97] Address family not supported by protocol. This also affects several tests in trio's test suite.

I can work around this by explicitly serving on "0.0.0.0", but it feels like a rough edge. As an alternative, maybe trio could suppress EAFNOSUPPORT errors from IPv6 socket creation in open_tcp_listeners if the IPv4 socket was created OK. Thoughts?

@njsmith
Copy link
Member

njsmith commented Jan 11, 2019

Oh yeah, we should do that.

There are also increasing numbers of systems out there with only ipv6, no ipv4, so we should handle that too.

oremanj added a commit to oremanj/trio that referenced this issue Jan 14, 2019
Closes python-trio#853.

- Some such systems return both address families from `getaddrinfo` but fail with `EAFNOSUPPORT` in `socket`. Allow `open_tcp_listeners()` to ignore `EAFNOSUPPORT` as long as at least one listener is created successfully.
- Fix socket tests to be more careful about not even trying to create an IPv6 socket on systems that don't support IPv6.
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

No branches or pull requests

2 participants