summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMohit Agrawal <moagrawal@redhat.com>2019-09-01 12:01:09 +0530
committerRinku Kothiya <rkothiya@redhat.com>2019-09-09 08:48:23 +0000
commit81780dba489c5b80063f0824a067ebff0a776241 (patch)
tree7511b768f9eb66203bd75b1ac1e27795bd84f000
parent056d8d65397129c7a580a9fa6e76c2b9f1ca22ff (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#1749664 Credits: Amgad Saleh <amgad.saleh@nokia.com> Signed-off-by: Mohit Agrawal <moagrawal@redhat.com>
-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 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;
}