summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMohit Agrawal <moagrawal@redhat.com>2019-09-02 10:46:10 +0530
committerMOHIT AGRAWAL <moagrawa@redhat.com>2019-09-06 08:05:10 +0000
commit056d8d65397129c7a580a9fa6e76c2b9f1ca22ff (patch)
tree9f473ecbc7a4bc324493f03b2497c409a93b041a
parentf4e38c060bdf561af1d6eaee83aa664f1f14e8a8 (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#1749664 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 4624fe1c8d0..fda6d7fb99d 100644
--- a/xlators/mgmt/glusterd/src/glusterd-volume-ops.c
+++ b/xlators/mgmt/glusterd/src/glusterd-volume-ops.c
@@ -91,6 +91,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 "
@@ -178,15 +182,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));