diff options
Diffstat (limited to 'rpc/rpc-transport/socket/src/name.c')
-rw-r--r-- | rpc/rpc-transport/socket/src/name.c | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/rpc/rpc-transport/socket/src/name.c b/rpc/rpc-transport/socket/src/name.c index 14c11cb835f..6336d7d25c4 100644 --- a/rpc/rpc-transport/socket/src/name.c +++ b/rpc/rpc-transport/socket/src/name.c @@ -214,6 +214,7 @@ af_inet_client_get_remote_sockaddr(rpc_transport_t *this, uint16_t remote_port = 0; struct addrinfo *addr_info = NULL; int32_t ret = 0; + struct in6_addr serveraddr; remote_host_data = dict_get(options, "remote-host"); if (remote_host_data == NULL) { @@ -249,6 +250,13 @@ af_inet_client_get_remote_sockaddr(rpc_transport_t *this, goto err; } + /* Need to update transport-address family if address-family is not provide + to command-line arguments + */ + if (inet_pton(AF_INET6, remote_host, &serveraddr)) { + sockaddr->sa_family = AF_INET6; + } + /* TODO: gf_resolve is a blocking call. kick in some non blocking dns techniques */ ret = gf_resolve_ip6(remote_host, remote_port, sockaddr->sa_family, @@ -525,7 +533,10 @@ socket_client_get_remote_sockaddr(rpc_transport_t *this, ret = -1; } - if (*sa_family == AF_UNSPEC) { + /* Address-family is updated based on remote_host in + af_inet_client_get_remote_sockaddr + */ + if (*sa_family != sockaddr->sa_family) { *sa_family = sockaddr->sa_family; } |