summaryrefslogtreecommitdiff
path: root/src/socket.c
diff options
context:
space:
mode:
authorgx <xiamimoo@gmail.com>2023-04-04 15:45:09 +0800
committerGitHub <noreply@github.com>2023-04-04 10:45:09 +0300
commite1da724117bb842c383e227e57b9c45331f430db (patch)
tree2e60bf7825bb36e6e1b12c2c929503d08c4e6a29 /src/socket.c
parentaee8d1ff28a5939d28e13cf9ff92845bc965aba7 (diff)
downloadredis-e1da724117bb842c383e227e57b9c45331f430db.tar.gz
Fix local clients detection (#11664)
Match 127.0.0.0/8 instead of just `127.0.0.1` to detect the local clients.
Diffstat (limited to 'src/socket.c')
-rw-r--r--src/socket.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/socket.c b/src/socket.c
index e7f6a5125..cecbd4288 100644
--- a/src/socket.c
+++ b/src/socket.c
@@ -341,7 +341,7 @@ static int connSocketIsLocal(connection *conn) {
if (connSocketAddr(conn, cip, sizeof(cip) - 1, NULL, 1) == C_ERR)
return -1;
- return !strcmp(cip,"127.0.0.1") || !strcmp(cip,"::1");
+ return !strncmp(cip, "127.", 4) || !strcmp(cip, "::1");
}
static int connSocketListen(connListener *listener) {