swift-object-builder can not connect to an IPv6 address

Bug #1244399 reported by Tim Spriggs
10
This bug affects 2 people
Affects Status Importance Assigned to Milestone
OpenStack Object Storage (swift)
Fix Released
Undecided
Unassigned

Bug Description

Using swift 1.10.0-0ubuntu1~cloud0 packages, I am unable to make IPv6 connections for two reasons:

1) swift has a bug in address handling:

https://github.com/openstack/swift/blob/master/swift/common/bufferedhttp.py#L179

Instead of combining the hostname/port, simply passing each as a parameter (also on line 181) is supported. The issue with combining the two with a string as "%s:%s" % (ipaddr, port) is that IPv6 addresses also use : as a separator.

2) eventlet does not support IPv6 (yet) but there are patches in progress to add IPv6 support.

https://bitbucket.org/eventlet/eventlet/issue/105/name-resolution-needs-to-support-ipv6
https://bitbucket.org/flub/eventlet-ipv6

Please fix the swift code so that the upstream eventlet patches will eventually fix IPv6 support.

Revision history for this message
Zhou Yuan (yuan-zhou) wrote :

Hi Tim,

I've tried a bit and it looks like passing the host:port is OK on IPv6? I'm testing with conn = HTTPConnection('::1:80') with the ipv6 eventlet

Revision history for this message
Tim Spriggs (tims-t) wrote :

Hi Zhou,

Thanks for testing!

If that worked, then there is another bug... tell me, what does ::1:80 mean? Is that the IP ::1 with port 80 or is that ::1:80 (a valid IPv6 address on its own)

This is why IPv6 addresses can commonly be found inside of square brackets:

[::1]:80 (which unambiguously means IP ::1 with port 80)

However, to pass that correctly, you would need to detect an IPv6 address in swift. This is already done by IPv6 eventlet and so it would be redundant (and probably incorrect) code. Finally, the underlaying framework will need to separate the string into ip (or hostname) and port anyway. Might as well just pass both values on unless I am missing something?

Finally, I had three working ring files with IPv6 addresses correctly embedded (pre-swift 1.10) and the upgrade to 1.10 breaks horribly with these ring files. By the point in the code that we are calling for an httpconnection, the IPv6 address has been decapsulated from the square brackets. If you are truly keen on keeping "%s:%s" % (host, ip) then we need to find a way to either re-encapsulate the IPv6 address or comb through the code to not un-encapsulate it to begin with. It's possible not changing [IPv6::address] to IPv6::address is the better fix for the sake of global consistency... I'll let someone (you?) with more experience in the swift code base make that choice though.

Revision history for this message
Tim Burke (1-tim-z) wrote :
Changed in swift:
status: New → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.