summaryrefslogtreecommitdiffstats
path: root/rpc
diff options
context:
space:
mode:
authorMohit Agrawal <moagrawal@redhat.com>2019-09-01 12:01:09 +0530
committerMohit Agrawal <moagrawal@redhat.com>2019-09-02 17:04:32 +0530
commit80b8cfe3f1386606bada97a76a0cad7acdf6b877 (patch)
tree8164df69fa8fd76dd3e9f4dff5d3e9581c136f77 /rpc
parenta498c478109395e7baa9b029c81d5587254bdd89 (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>
Diffstat (limited to 'rpc')
-rw-r--r--rpc/rpc-transport/socket/src/name.c13
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 3f498e5..6dd4d23 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,
@@ -527,7 +535,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;
}