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