Bug: TCP client only accepts IPv4 addresses, not hostnames #194
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Severity: low
Category: bug
Location:
src/shared/transport_tcp.c:134-148,src/shared/transport_tls.c:134-140Description:
client_connect()andclient_connect_tls()useinet_pton(AF_INET, host, ...). This only accepts IPv4 dotted-quad addresses. Hostnames and IPv6 literals cause an immediate connection failure withCould not convert host address!.Suggested fix:
Replace
inet_pton(AF_INET, ...)withgetaddrinfo(). UseAI_NUMERICHOSTonly when a numeric address is required, otherwise allow DNS resolution. UpdateClient/Serverstructs to usestruct sockaddr_storagefor IPv6 support (see also IPv6 feature issue).Labels: bug, quality