summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorYossi Gottlieb <yossigo@gmail.com>2022-03-08 13:10:24 +0200
committerGitHub <noreply@github.com>2022-03-08 13:10:24 +0200
commit38052fd702e6925a3354e0927ff813fc16f67b08 (patch)
treedf308eca837d7be3f77678917fa0de2b61869066
parent7ef68cd5ec23f1d03657cb43a0966d4e7ff877d1 (diff)
downloadredis-38052fd702e6925a3354e0927ff813fc16f67b08.tar.gz
Fix redis-benchmark --cluster with IPv6. (#10393)
Currently, CLUSTER NODES is parsed and was not done correctly for IPv6 addresses.
-rw-r--r--src/redis-benchmark.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/src/redis-benchmark.c b/src/redis-benchmark.c
index 64893ac37..9b183559d 100644
--- a/src/redis-benchmark.c
+++ b/src/redis-benchmark.c
@@ -1118,6 +1118,9 @@ static clusterNode **addClusterNode(clusterNode *node) {
return config.cluster_nodes;
}
+/* TODO: This should be refactored to use CLUSTER SLOTS, the migrating/importing
+ * information is anyway not used.
+ */
static int fetchClusterConfiguration() {
int success = 1;
redisContext *ctx = NULL;
@@ -1179,7 +1182,7 @@ static int fetchClusterConfiguration() {
clusterNode *node = NULL;
char *ip = NULL;
int port = 0;
- char *paddr = strchr(addr, ':');
+ char *paddr = strrchr(addr, ':');
if (paddr != NULL) {
*paddr = '\0';
ip = addr;