summaryrefslogtreecommitdiffstats
path: root/network.py
diff options
context:
space:
mode:
authorDavid Cantrell <dcantrell@redhat.com>2006-08-11 19:31:11 +0000
committerDavid Cantrell <dcantrell@redhat.com>2006-08-11 19:31:11 +0000
commit00fc43aee2af4e178a55d7205927aac81125de6d (patch)
treee391c6ef635f9009bd250279fea311ec47b92b8b /network.py
parentcafc115e07a9f78850bd5a568102e04645e0208b (diff)
downloadanaconda-00fc43aee2af4e178a55d7205927aac81125de6d.tar.gz
anaconda-00fc43aee2af4e178a55d7205927aac81125de6d.tar.xz
anaconda-00fc43aee2af4e178a55d7205927aac81125de6d.zip
* network.py (Network.lookupHostname): Use socket.getaddrinfo() so
we can support IPv4 and IPv6.
Diffstat (limited to 'network.py')
-rw-r--r--network.py13
1 files changed, 10 insertions, 3 deletions
diff --git a/network.py b/network.py
index 3b27ec063..570e4f334 100644
--- a/network.py
+++ b/network.py
@@ -198,7 +198,7 @@ class Network:
self.firstnetdevice = info["DEVICE"]
for key in ("IPADDR", "NETMASK", "BOOTPROTO", "ONBOOT", "MTU",
"NETTYPE", "SUBCHANNELS", "PORTNAME", "CTCPROT",
- "PEERID", "ESSID", "KEY"):
+ "PEERID", "ESSID", "KEY", "IPV6ADDR"):
if info.has_key(key):
self.netdevices [info["DEVICE"]].set((key, info[key]))
if info.has_key("GATEWAY"):
@@ -354,9 +354,16 @@ class Network:
return None
try:
- ip = socket.gethostbyname(self.hostname)
+ (family, socktype, proto, canonname, sockaddr) = \
+ socket.getaddrinfo(self.hostname, None, socket.AF_INET)
+ (ip, port) = sockaddr
except:
- return None
+ try:
+ (family, socktype, proto, canonname, sockaddr) = \
+ socket.getaddrinfo(self.hostname, None, socket.AF_INET6)
+ (ip, port, flowinfo, scopeid) = sockaddr
+ except:
+ return None
return ip