mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2025-01-23 04:55:18 +00:00
rpc: getaddrinfo: also accept IPv4-mapped IPv6 addresses
If only IPv6 is configured on the host, getaddrinfo with AI_ADDRCONFIG in hints would return EAI_ADDRFAMILY for nodenames that resolve to IPv4. Also pass AI_V4MAPPED to accept IPv4-mapped addresses on IPv6-only systems. Signed-off-by: Zhimin Feng <fengzhimin1@huawei.com> [rewrote the commit message - jtomko] Signed-off-by: Ján Tomko <jtomko@redhat.com> Reviewed-by: Ján Tomko <jtomko@redhat.com> Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
This commit is contained in:
parent
02b6005063
commit
9e85e118ca
@ -575,7 +575,7 @@ int virNetSocketNewConnectTCP(const char *nodename,
|
||||
|
||||
memset(&hints, 0, sizeof(hints));
|
||||
hints.ai_family = family;
|
||||
hints.ai_flags = AI_PASSIVE | AI_ADDRCONFIG;
|
||||
hints.ai_flags = AI_PASSIVE | AI_ADDRCONFIG | AI_V4MAPPED;
|
||||
hints.ai_socktype = SOCK_STREAM;
|
||||
|
||||
int e = getaddrinfo(nodename, service, &hints, &ai);
|
||||
|
Loading…
x
Reference in New Issue
Block a user