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

Connection fails with AAAA records on IPv4 only networks #35

Closed
far-blue opened this issue Sep 11, 2017 · 7 comments
Closed

Connection fails with AAAA records on IPv4 only networks #35

far-blue opened this issue Sep 11, 2017 · 7 comments
Labels

Comments

@far-blue
Copy link

Working on an IPv4 only network and trying to connect to whois.donuts.co I found I was getting Address family for hostname not supported errors. I tracked this down to the connection attempt using the AAAA record from the DNS lookup which was then not being caught because it's a (fatal) Error, not an Exception.

I've created a PR (#34) to allow limiting of the resolve type in the DNS request via a parameter in the ClientConnectionContext.

@kelunik
Copy link
Member

kelunik commented Sep 11, 2017

I think we can just ignore all AAAA records if hostname -I contains only IPv4 addresses.

@kelunik kelunik added the bug label Sep 11, 2017
@kelunik
Copy link
Member

kelunik commented Sep 12, 2017

Maybe we should just prefer IPv4 and only attempt IPv6 if there are either only IPv6 or all IPv4 entries failed?

@stephenreay
Copy link

As mentioned in R11, there is an RFC about this very problem: the solution basically is to try and connect to both, concurrently, and use the connection that succeeds first.

@kelunik
Copy link
Member

kelunik commented Sep 12, 2017

https://travis-ci.org/amphp/socket/jobs/274703751#L540 is probably related.

kelunik pushed a commit that referenced this issue Sep 12, 2017
Allows restricting to A or AAAA only via the ClientConnectContext.

Relates to #35, but doesn't fully fix it. Further work needs to be done
to avoid IPv6 automatically when IPv6 support is not available.
@kelunik
Copy link
Member

kelunik commented Sep 24, 2017

It's pretty strange that the related Travis failure only happens on PHP 7.2.

@kelunik
Copy link
Member

kelunik commented Sep 24, 2017

Currently we don't resolve to the first of A / AAAA, but wait for both. That means we could sort the array of records and just prefer A records if they're available.

@kelunik
Copy link
Member

kelunik commented Oct 13, 2017

How about adding a AMP_SOCKET_DISABLE_IPV6 environment variable for now until we have a reliable solution how to detect IPv6 ability?

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

No branches or pull requests

3 participants