Join GitHub today
GitHub is home to over 40 million developers working together to host and review code, manage projects, and build software together.Sign up
Steps to reproduce
Pick up a domain which resolves both to IPv4 and IPv6:
can be fixed with
Tested with CentOS 7:
Results are the same.
Whenever a source IPv4 is specified cURL should auto add -4 flag, i.e.:
The same with IPv6, whenever a source IPv6 is specified cURL should auto add -6 flag, i.e.
No, I don't think that's even close. The problem with the current local bind code is that it works rather independently of the remote end which creates this weirdo problems with v4 vs v6 or problems with different v6 scopes.
It means that the issue has been reported and we know about it but nobody has yet fixed it. It is a bug and we'd like to have it fixed.
Will the code suggested here https://stackoverflow.com/questions/3736335/tell-whether-a-text-string-is-an-ipv6-address-or-ipv4-address-using-standard-c-s/3736377#3736377 help to solve the issue?
I don't think so. I believe this problem you see happens because curl first resolves the host name and tries to connect to it (over both IPv4 and IPv6), and also tries to bind that socket to the address you've asked - without properly caring for IP version mixes.
A proper fix would probably be something like:
And the code snippet shows how to detect which IP is specified in
Actually found the issue in Zabbix first, they use cURL library, and connections to monitored hosts over HTTP/HTTPs fails in mentioned here cases. Reported the issue to https://support.zabbix.com/browse/ZBX-16082