From dc4ba2e18b4c86d23e08a664bd7a86fa02c15624 Mon Sep 17 00:00:00 2001 From: YOKOTA Hiroshi Date: Mon, 20 Nov 2023 20:43:56 +0900 Subject: [PATCH] Check '::' really supports both IPv6 and IPv4 socket.has_dualstack_ipv6() checks current runtime environment really works with both IPv6 and IPv4. --- src/calibre/srv/opts.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/calibre/srv/opts.py b/src/calibre/srv/opts.py index 811e624c2a..afc27afa39 100644 --- a/src/calibre/srv/opts.py +++ b/src/calibre/srv/opts.py @@ -11,6 +11,7 @@ from collections import OrderedDict, namedtuple from functools import partial from itertools import zip_longest from operator import attrgetter +from socket import has_dualstack_ipv6 from calibre.constants import config_dir from calibre.utils.localization import _ @@ -110,7 +111,7 @@ raw_options = ( ' there are more than this number of items. Set to zero to disable.'), _('The interface on which to listen for connections'), - 'listen_on', '::', + 'listen_on', '::' if has_dualstack_ipv6() else '0.0.0.0', _('The default is to listen on all available IPv6 and IPv4 interfaces. You can change this to, for' ' example, "127.0.0.1" to only listen for connections from the local machine, or' ' to "::" to listen to all incoming IPv6 and IPv4 connections.'),