You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

72 lines
2.6 KiB

From 769263ad422e3c1069de0994ff2274044982b242 Mon Sep 17 00:00:00 2001
From: Mohit Agrawal <moagrawal@redhat.com>
Date: Sun, 1 Sep 2019 12:01:09 +0530
Subject: [PATCH 292/297] 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)
> (Reviewed on upstream link https://review.gluster.org/#/c/glusterfs/+/23340/)
Change-Id: Iaa3588cd87cebc45231bfd675745c1a457dc9b31
BUG: 1750241
Signed-off-by: Mohit Agrawal <moagrawal@redhat.com>
Reviewed-on: https://code.engineering.redhat.com/gerrit/181184
Tested-by: Mohit Agrawal <moagrawa@redhat.com>
Tested-by: RHGS Build Bot <nigelb@redhat.com>
Reviewed-by: Sunil Kumar Heggodu Gopala Acharya <sheggodu@redhat.com>
---
rpc/rpc-transport/socket/src/name.c | 13 ++++++++++++-
1 file changed, 12 insertions(+), 1 deletion(-)
diff --git a/rpc/rpc-transport/socket/src/name.c b/rpc/rpc-transport/socket/src/name.c
index 7f18cc4..b473f3b 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,
@@ -522,7 +530,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;
}
--
1.8.3.1