|
|
f338ef |
From 8f89aef9691b0806d7487525c6a54a1a615c8bc1 Mon Sep 17 00:00:00 2001
|
|
|
f338ef |
From: Mohit Agrawal <moagrawal@redhat.com>
|
|
|
f338ef |
Date: Mon, 2 Sep 2019 10:46:10 +0530
|
|
|
f338ef |
Subject: [PATCH 293/297] glusterd: IPV6 hostname address is not parsed
|
|
|
f338ef |
correctly
|
|
|
f338ef |
|
|
|
f338ef |
Problem: IPV6 hostname address is not parsed correctly in function
|
|
|
f338ef |
glusterd_check_brick_order
|
|
|
f338ef |
|
|
|
f338ef |
Solution: Update the code to parse hostname address
|
|
|
f338ef |
|
|
|
f338ef |
> Change-Id: Ifb2f83f9c6e987b2292070e048e97eeb51b728ab
|
|
|
f338ef |
> Fixes: bz#1747746
|
|
|
f338ef |
> Credits: Amgad Saleh <amgad.saleh@nokia.com>
|
|
|
f338ef |
> Signed-off-by: Mohit Agrawal <moagrawal@redhat.com>
|
|
|
f338ef |
> (Cherry picked from commit 6563ffb04d7ba51a89726e7c5bbb85c7dbc685b5)
|
|
|
f338ef |
> (Reviewed on upstream link https://review.gluster.org/#/c/glusterfs/+/23341/)
|
|
|
f338ef |
|
|
|
f338ef |
Change-Id: Ifb2f83f9c6e987b2292070e048e97eeb51b728ab
|
|
|
f338ef |
BUG: 1750241
|
|
|
f338ef |
Signed-off-by: Mohit Agrawal <moagrawa@redhat.com>
|
|
|
f338ef |
Reviewed-on: https://code.engineering.redhat.com/gerrit/181185
|
|
|
f338ef |
Tested-by: RHGS Build Bot <nigelb@redhat.com>
|
|
|
f338ef |
Reviewed-by: Sunil Kumar Heggodu Gopala Acharya <sheggodu@redhat.com>
|
|
|
f338ef |
---
|
|
|
f338ef |
xlators/mgmt/glusterd/src/glusterd-volume-ops.c | 16 +++++++++++-----
|
|
|
f338ef |
1 file changed, 11 insertions(+), 5 deletions(-)
|
|
|
f338ef |
|
|
|
f338ef |
diff --git a/xlators/mgmt/glusterd/src/glusterd-volume-ops.c b/xlators/mgmt/glusterd/src/glusterd-volume-ops.c
|
|
|
f338ef |
index 1ea8ba6..076bc80 100644
|
|
|
f338ef |
--- a/xlators/mgmt/glusterd/src/glusterd-volume-ops.c
|
|
|
f338ef |
+++ b/xlators/mgmt/glusterd/src/glusterd-volume-ops.c
|
|
|
f338ef |
@@ -95,6 +95,10 @@ glusterd_check_brick_order(dict_t *dict, char *err_str)
|
|
|
f338ef |
int32_t type = GF_CLUSTER_TYPE_NONE;
|
|
|
f338ef |
int32_t sub_count = 0;
|
|
|
f338ef |
struct addrinfo *ai_info = NULL;
|
|
|
f338ef |
+ char brick_addr[128] = {
|
|
|
f338ef |
+ 0,
|
|
|
f338ef |
+ };
|
|
|
f338ef |
+ int addrlen = 0;
|
|
|
f338ef |
|
|
|
f338ef |
const char failed_string[2048] =
|
|
|
f338ef |
"Failed to perform brick order "
|
|
|
f338ef |
@@ -182,15 +186,17 @@ glusterd_check_brick_order(dict_t *dict, char *err_str)
|
|
|
f338ef |
brick_list_dup = tmpptr;
|
|
|
f338ef |
if (brick == NULL)
|
|
|
f338ef |
goto check_failed;
|
|
|
f338ef |
- brick = strtok_r(brick, ":", &tmpptr);
|
|
|
f338ef |
- if (brick == NULL)
|
|
|
f338ef |
+ tmpptr = strrchr(brick, ':');
|
|
|
f338ef |
+ if (tmpptr == NULL)
|
|
|
f338ef |
goto check_failed;
|
|
|
f338ef |
- ret = getaddrinfo(brick, NULL, NULL, &ai_info);
|
|
|
f338ef |
+ addrlen = strlen(brick) - strlen(tmpptr);
|
|
|
f338ef |
+ strncpy(brick_addr, brick, addrlen);
|
|
|
f338ef |
+ brick_addr[addrlen] = '\0';
|
|
|
f338ef |
+ ret = getaddrinfo(brick_addr, NULL, NULL, &ai_info);
|
|
|
f338ef |
if (ret != 0) {
|
|
|
f338ef |
ret = 0;
|
|
|
f338ef |
gf_msg(this->name, GF_LOG_ERROR, 0, GD_MSG_HOSTNAME_RESOLVE_FAIL,
|
|
|
f338ef |
- "unable to resolve "
|
|
|
f338ef |
- "host name");
|
|
|
f338ef |
+ "unable to resolve host name for addr %s", brick_addr);
|
|
|
f338ef |
goto out;
|
|
|
f338ef |
}
|
|
|
f338ef |
ai_list_tmp1 = MALLOC(sizeof(addrinfo_list_t));
|
|
|
f338ef |
--
|
|
|
f338ef |
1.8.3.1
|
|
|
f338ef |
|