This is an automated email from the git hooks/post-receive script.
mreynolds pushed a commit to branch 389-ds-base-1.4.1
in repository 389-ds-base.
The following commit(s) were added to refs/heads/389-ds-base-1.4.1 by this push:
new f4b777f Issue 51064 - Unable to install server where IPv6 is disabled
f4b777f is described below
commit f4b777f53bf5713f2d1c465e3b800431867a7109
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 9ef2a8c..67304ec 100644
--- a/src/lib389/lib389/utils.py
+++ b/src/lib389/lib389/utils.py
@@ -1134,11 +1134,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