summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMohit Agrawal <moagrawal@redhat.com>2019-09-02 10:46:10 +0530
committerhari gowtham <hari.gowtham005@gmail.com>2019-09-09 06:44:59 +0000
commit0f76921e986aee27b9f60e3bcda9509b983214a0 (patch)
tree92908397a14a806877d1285bfd15fecdd4aa5840
parent3f0658b54c92131ec468a66b9fe0c3ac86e42061 (diff)
glusterd: IPV6 hostname address is not parsed correctly
Problem: IPV6 hostname address is not parsed correctly in function glusterd_check_brick_order Solution: Update the code to parse hostname address > Change-Id: Ifb2f83f9c6e987b2292070e048e97eeb51b728ab > Fixes: bz#1747746 > Credits: Amgad Saleh <amgad.saleh@nokia.com> > Signed-off-by: Mohit Agrawal <moagrawal@redhat.com> > (cherry picked from commit 6563ffb04d7ba51a89726e7c5bbb85c7dbc685b5) Change-Id: Ifb2f83f9c6e987b2292070e048e97eeb51b728ab Fixes: bz#1739320 Credits: Amgad Saleh <amgad.saleh@nokia.com> Signed-off-by: Mohit Agrawal <moagrawal@redhat.com>
-rw-r--r--xlators/mgmt/glusterd/src/glusterd-volume-ops.c16
1 files changed, 11 insertions, 5 deletions
diff --git a/xlators/mgmt/glusterd/src/glusterd-volume-ops.c b/xlators/mgmt/glusterd/src/glusterd-volume-ops.c
index 7cfba3d..530bdab 100644
--- a/xlators/mgmt/glusterd/src/glusterd-volume-ops.c
+++ b/xlators/mgmt/glusterd/src/glusterd-volume-ops.c
@@ -95,6 +95,10 @@ glusterd_check_brick_order(dict_t *dict, char *err_str)
int32_t type = GF_CLUSTER_TYPE_NONE;
int32_t sub_count = 0;
struct addrinfo *ai_info = NULL;
+ char brick_addr[128] = {
+ 0,
+ };
+ int addrlen = 0;
const char failed_string[2048] =
"Failed to perform brick order "
@@ -182,15 +186,17 @@ glusterd_check_brick_order(dict_t *dict, char *err_str)
brick_list_dup = tmpptr;
if (brick == NULL)
goto check_failed;
- brick = strtok_r(brick, ":", &tmpptr);
- if (brick == NULL)
+ tmpptr = strrchr(brick, ':');
+ if (tmpptr == NULL)
goto check_failed;
- ret = getaddrinfo(brick, NULL, NULL, &ai_info);
+ addrlen = strlen(brick) - strlen(tmpptr);
+ strncpy(brick_addr, brick, addrlen);
+ brick_addr[addrlen] = '\0';
+ ret = getaddrinfo(brick_addr, NULL, NULL, &ai_info);
if (ret != 0) {
ret = 0;
gf_msg(this->name, GF_LOG_ERROR, 0, GD_MSG_HOSTNAME_RESOLVE_FAIL,
- "unable to resolve "
- "host name");
+ "unable to resolve host name for addr %s", brick_addr);
goto out;
}
ai_list_tmp1 = MALLOC(sizeof(addrinfo_list_t));