summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChris Lamb <lamby@debian.org>2018-11-23 17:43:01 +0100
committerantirez <antirez@gmail.com>2018-12-21 12:40:28 +0100
commitafc4b36c1026a4fab0e6c50af09c6bd18adc17d5 (patch)
treedaae8c71165cc9cde17e99796d22f7a49831eab7
parentcbcc76ac5b148df369756a7bffd4c8769a3fe92b (diff)
downloadredis-afc4b36c1026a4fab0e6c50af09c6bd18adc17d5.tar.gz
Don't treat unsupported protocols as fatal errors
If we encounter an unsupported protocol in the "bind" list, don't ipso-facto consider it a fatal error. We continue to abort startup if there are no listening sockets at all. This ensures that the lack of IPv6 support does not prevent Redis from starting on Debian where we try to bind to the ::1 interface by default (via "bind 127.0.0.1 ::1"). A machine with IPv6 disabled (such as some container systems) would simply fail to start Redis after the initiall call to apt(8). This is similar to the case for where "bind" is not specified: https://github.com/antirez/redis/issues/3894 ... and was based on the corresponding PR: https://github.com/antirez/redis/pull/4108 ... but also adds EADDRNOTAVAIL to the list of errors to catch which I believe is missing from there. This issue was raised in Debian as both <https://bugs.debian.org/900284> & <https://bugs.debian.org/914354>.
-rw-r--r--src/server.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/src/server.c b/src/server.c
index 279b4e557..d0e381ac9 100644
--- a/src/server.c
+++ b/src/server.c
@@ -1765,6 +1765,10 @@ int listenToPort(int port, int *fds, int *count) {
"Creating Server TCP listening socket %s:%d: %s",
server.bindaddr[j] ? server.bindaddr[j] : "*",
port, server.neterr);
+ if (errno == ENOPROTOOPT || errno == EPROTONOSUPPORT ||
+ errno == ESOCKTNOSUPPORT || errno == EPFNOSUPPORT ||
+ errno == EAFNOSUPPORT || errno == EADDRNOTAVAIL)
+ continue;
return C_ERR;
}
anetNonBlock(NULL,fds[*count]);