IPv6 fixes

This patch makes validate_ssh works for IPv6 addresses.Also file
transport via scp has been fixed to work via IPv6 address

Change-Id: I55c88d3fcaaa8decd647aa38404ac653d5f5dbba
This commit is contained in:
Martin Mágr
2015-01-23 13:08:32 +01:00
parent e95720f57b
commit 7f5af0708b
2 changed files with 4 additions and 4 deletions

View File

@@ -138,7 +138,7 @@ def validate_ip(param, options=None):
for family in (socket.AF_INET, socket.AF_INET6):
try:
socket.inet_pton(family, param)
break
return family
except socket.error:
continue
else:
@@ -213,7 +213,7 @@ def touch_port(host, port):
key = "%s:%d" % (host, port)
if key in _tested_ports:
return
s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
s = socket.socket(validate_ip(host), socket.SOCK_STREAM)
s.connect((host, port))
s.shutdown(socket.SHUT_RDWR)
s.close()