diff options
author | Mohit Agrawal <moagrawal@redhat.com> | 2019-09-01 12:01:09 +0530 |
---|---|---|
committer | hari gowtham <hari.gowtham005@gmail.com> | 2019-09-09 06:47:40 +0000 |
commit | 78dcb37405be16f529d2efaaebcedd461d4f987c (patch) | |
tree | 9a32d14e4f9e94091afa0f0ccd19663318788203 /rpc | |
parent | 0f76921e986aee27b9f60e3bcda9509b983214a0 (diff) |
rpc: Update address family if it is not provide in cmd-line arguments
Problem: After enabling transport-type to inet6 and passed ipv6
transport.socket.bind-address in glusterd.vol clients are
not started.
Solution: Need to update address-family based on remote-address for
all gluster client process
> Change-Id: Iaa3588cd87cebc45231bfd675745c1a457dc9b31
> Fixes: bz#1747746
> Credits: Amgad Saleh <amgad.saleh@nokia.com>
> Signed-off-by: Mohit Agrawal <moagrawal@redhat.com>
> (cherry picked from commit 80b8cfe3f1386606bada97a76a0cad7acdf6b877)
Change-Id: Iaa3588cd87cebc45231bfd675745c1a457dc9b31
Fixes: bz#1739320
Credits: Amgad Saleh <amgad.saleh@nokia.com>
Signed-off-by: Mohit Agrawal <moagrawal@redhat.com>
Diffstat (limited to 'rpc')
-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; } |