From bd5d9f08ecc3c1fade6dce809ee9edef1c226e54 Mon Sep 17 00:00:00 2001 From: Davanum Srinivas Date: Wed, 16 Jan 2013 12:12:04 -0500 Subject: Support for ipv6 in wsgi.Service Enable wsgi.Service to listen on ipv6 address by checking if the host specified is ipv6. Based on that set the appropriate family in the eventlet.listen api More tests for just the ipv6, ipv6 with app, ipv6+ssl with app to make sure everything is working fine Change-Id: I2772905128bdbc69dd0fafe4ced848f5c477d7c8 --- openstack/common/wsgi.py | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) (limited to 'openstack') diff --git a/openstack/common/wsgi.py b/openstack/common/wsgi.py index 550ea4d..f97d24e 100644 --- a/openstack/common/wsgi.py +++ b/openstack/common/wsgi.py @@ -81,15 +81,23 @@ class Service(service.Service): super(Service, self).__init__(threads) def _get_socket(self, host, port, backlog): - - bind_addr = (host, port) + # TODO(dims): eventlet's green dns/socket module does not actually + # support IPv6 in getaddrinfo(). We need to get around this in the + # future or monitor upstream for a fix + info = socket.getaddrinfo(host, + port, + socket.AF_UNSPEC, + socket.SOCK_STREAM)[0] + family = info[0] + bind_addr = info[-1] sock = None retry_until = time.time() + 30 while not sock and time.time() < retry_until: try: sock = eventlet.listen(bind_addr, - backlog=backlog) + backlog=backlog, + family=family) if sslutils.is_enabled(): sock = sslutils.wrap(sock) -- cgit