Skip to content

Commit 9f99dd5

Browse files
authored
Fix tls port update not reflected in CLUSTER SLOTS (redis#13966)
### Problem A previous PR (redis#13932) fixed the TCP port issue in CLUSTER SLOTS, but it seems the handling of the TLS port was overlooked. There is this comment in the `addNodeToNodeReply` function in the `cluster.c` file: ```c /* Report TLS ports to TLS client, and report non-TLS port to non-TLS client. */ addReplyLongLong(c, clusterNodeClientPort(node, shouldReturnTlsInfo())); addReplyBulkCBuffer(c, clusterNodeGetName(node), CLUSTER_NAMELEN); ``` ### Fixed This PR fixes the TLS port issue and adds relevant tests.
1 parent 8468ded commit 9f99dd5

File tree

2 files changed

+13
-3
lines changed

2 files changed

+13
-3
lines changed

src/config.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2688,6 +2688,7 @@ static int applyTLSPort(const char **err) {
26882688
listener->bindaddr_count = server.bindaddr_count;
26892689
listener->port = server.tls_port;
26902690
listener->ct = connectionByType(CONN_TYPE_TLS);
2691+
clusterUpdateMyselfAnnouncedPorts();
26912692
if (changeListener(listener) == C_ERR) {
26922693
*err = "Unable to listen on this port. Check server logs.";
26932694
return 0;

tests/unit/cluster/announced-endpoints.tcl

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -49,12 +49,21 @@ start_cluster 2 2 {tags {external:skip cluster}} {
4949
}
5050

5151
test "CONFIG SET port updates cluster-announced port" {
52+
set count [expr [llength $::servers] + 1]
5253
# Get the original port and change to new_port
53-
set orig_port [lindex [R 0 config get port] 1]
54+
if {$::tls} {
55+
set orig_port [lindex [R 0 config get tls-port] 1]
56+
} else {
57+
set orig_port [lindex [R 0 config get port] 1]
58+
}
5459
assert {$orig_port != ""}
60+
set new_port [find_available_port $orig_port $count]
5561

56-
set new_port [find_available_port $baseport $count]
57-
R 0 config set port $new_port
62+
if {$::tls} {
63+
R 0 config set tls-port $new_port
64+
} else {
65+
R 0 config set port $new_port
66+
}
5867

5968
# Verify that the new port appears in the output of cluster slots
6069
wait_for_condition 50 100 {

0 commit comments

Comments
 (0)