summaryrefslogtreecommitdiffstats
path: root/install
diff options
context:
space:
mode:
authorMartin Kosek <mkosek@redhat.com>2012-07-03 16:49:10 +0200
committerMartin Kosek <mkosek@redhat.com>2012-07-13 14:25:18 +0200
commit4879c68d68634715b9d08a08a4c7be882634409f (patch)
treef64ca647665df5b40fb5501735d7bb5a9776786c /install
parent5c54dd5b03681428040af51ef3e05c10bec91d3f (diff)
downloadfreeipa-4879c68d68634715b9d08a08a4c7be882634409f.tar.gz
freeipa-4879c68d68634715b9d08a08a4c7be882634409f.tar.xz
freeipa-4879c68d68634715b9d08a08a4c7be882634409f.zip
Improve address family handling in sockets
Many functions use low-level socket interface for connection or various checks. However, most of the time we don't respect automatic address family detection but rather try to force our values. This may cause either redundat connection tries when an address family is disabled on system tries or even crashes when socket exceptions are not properly caught. Instead of forcing address families to socket, rather use getaddrinfo interface to automatically retrieve a list of all relevant address families and other connection settings when connecting to remote/local machine or binding to a local port. Now, we will also fill correctly all connection parameters like flowinfo and scopeid for IPv6 connections which will for example prevent issues with scoped IPv6 addresses. bind_port_responder function was changed to at first try to bind to IPv6 wildcard address before IPv4 as IPv6 socket is able to accept both IPv4 and IPv6 connections (unlike IPv4 socket). nsslib connection was refactored to use nss.io.AddrInfo class to get all the available connections. Socket is now not created by default in NSSConnection class initializer, but rather when the actual connection is being made, becase we do not an address family where connection is successful. https://fedorahosted.org/freeipa/ticket/2913 https://fedorahosted.org/freeipa/ticket/2695
Diffstat (limited to 'install')
-rwxr-xr-xinstall/tools/ipa-replica-conncheck12
1 files changed, 6 insertions, 6 deletions
diff --git a/install/tools/ipa-replica-conncheck b/install/tools/ipa-replica-conncheck
index 6ec3be2a9..8e4536cf6 100755
--- a/install/tools/ipa-replica-conncheck
+++ b/install/tools/ipa-replica-conncheck
@@ -236,15 +236,15 @@ class PortResponder(threading.Thread):
self._stop_request = True
def port_check(host, port_list):
- ip = installutils.resolve_host(host)
-
- if not ip:
- raise RuntimeError("Port check failed! Unable to resolve host name '%s'" % host)
-
ports_failed = []
ports_udp_warning = [] # conncheck could not verify that port is open
for port in port_list:
- if ipautil.host_port_open(host, port.port, port.port_type, socket_timeout=CONNECT_TIMEOUT):
+ try:
+ port_open = ipautil.host_port_open(host, port.port,
+ port.port_type, socket_timeout=CONNECT_TIMEOUT)
+ except socket.gaierror:
+ raise RuntimeError("Port check failed! Unable to resolve host name '%s'" % host)
+ if port_open:
result = "OK"
else:
if port.port_type == socket.SOCK_DGRAM: