Skip to content

Commit

Permalink
Added IP address validation in node address update
Browse files Browse the repository at this point in the history
  • Loading branch information
stav bentov committed Jan 26, 2025
1 parent d80459a commit 3432401
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/cluster_legacy.c
Original file line number Diff line number Diff line change
Expand Up @@ -2456,6 +2456,10 @@ int nodeUpdateAddressIfNeeded(clusterNode *node, clusterLink *link, clusterMsg *
if (node->tcp_port == tcp_port && node->cport == cport && node->tls_port == tls_port && strcmp(ip, node->ip) == 0)
return 0;

/* We should not update the node address if we were not able to get a valid
* IP address. */
if (ip[0] == '\0' || strcmp(ip,"?") == 0) return 0;

/* IP / port is different, update it. */
memcpy(node->ip, ip, sizeof(ip));
node->tcp_port = tcp_port;
Expand Down

0 comments on commit 3432401

Please sign in to comment.