This is an automated email from the git hooks/post-receive script.
mreynolds pushed a commit to branch 389-ds-base-1.4.2
in repository 389-ds-base.
The following commit(s) were added to refs/heads/389-ds-base-1.4.2 by this push:
new bc871b6 Issue 51064 - Unable to install server where IPv6 is disabled
bc871b6 is described below
commit bc871b6c2a6b7bed28af2778566cecf959a7266c
Author: Mark Reynolds <mreynolds@redhat.com>
AuthorDate: Thu Apr 30 14:02:13 2020 -0400
Issue 51064 - Unable to install server where IPv6 is disabled
Description: When checking if a port is available, first attempt to
create a socket using AF_INET6, if that fails then use
AF_INET
relates: https://pagure.io/389-ds-base/issue/51064
Reviewed by: firstyear(Thanks!)
---
src/lib389/lib389/utils.py | 27 ++++++++++++++++++++++-----
1 file changed, 22 insertions(+), 5 deletions(-)
diff --git a/src/lib389/lib389/utils.py b/src/lib389/lib389/utils.py
index 2b01712..0d0d50b 100644
--- a/src/lib389/lib389/utils.py
+++ b/src/lib389/lib389/utils.py
@@ -1140,11 +1140,28 @@ def getDateTime():
def socket_check_open(host, port):
- with closing(socket.socket(socket.AF_INET6, socket.SOCK_STREAM)) as sock:
- if sock.connect_ex((host, port)) == 0:
- return True
- else:
- return False
+ """
+ Check if a socket can be opened. Need to handle cases where IPv6 is completely
+ disabled.
+ """
+ try:
+ # Trying IPv6 first ...
+ family = socket.AF_INET6
+ with closing(socket.socket(family, socket.SOCK_STREAM)) as sock:
+ if sock.connect_ex((host, port)) == 0:
+ return True
+ else:
+ return False
+ except OSError:
+ # No IPv6, adjust hostname, and try IPv4 ...
+ family = socket.AF_INET
+ if host == "::1":
+ host = "127.0.0.1"
+ with closing(socket.socket(family, socket.SOCK_STREAM)) as sock:
+ if sock.connect_ex((host, port)) == 0:
+ return True
+ else:
+ return False
def ensure_bytes(val):
--
To stop receiving notification emails like this one, please contact
the administrator of this repository.
_______________________________________________
389-commits mailing list -- 389-commits@lists.fedoraproject.org
To unsubscribe send an email to 389-commits-leave@lists.fedoraproject.org
Fedora Code of Conduct: https://docs.fedoraproject.org/en-US/project/code-of-conduct/
List Guidelines: https://fedoraproject.org/wiki/Mailing_list_guidelines
List Archives: https://lists.fedoraproject.org/archives/list/389-commits@lists.fedoraproject.org
No comments:
Post a Comment