diff options
author | Daniel Harrison <harro@google.com> | 2010-10-06 04:20:57 +0000 |
---|---|---|
committer | Daniel Harrison <harro@google.com> | 2010-10-06 04:20:57 +0000 |
commit | 22ae78fec8e31533325203f6ce7982a4c528f91d (patch) | |
tree | 67b2084e9e086ff4efda913b6b69bbb93cae7f5f /ipaddr.py | |
parent | 83e7e09c37e0d1cd03bfe4147cd7bd1f21224056 (diff) | |
download | ipaddr-py-22ae78fec8e31533325203f6ce7982a4c528f91d.tar.gz |
IPv6 with embedded IPv4 address not recognized
git-svn-id: https://ipaddr-py.googlecode.com/svn/trunk@194 09200d28-7f98-11dd-ad27-0f66e57d2035
Diffstat (limited to 'ipaddr.py')
-rw-r--r-- | ipaddr.py | 5 |
1 files changed, 3 insertions, 2 deletions
@@ -1394,10 +1394,9 @@ class _BaseV6(object): ip_int = 0 - fields = self._explode_shorthand_ip_string(ip_str).split(':') - # Do we have an IPv4 mapped (::ffff:a.b.c.d) or compact (::a.b.c.d) # ip_str? + fields = ip_str.split(':') if fields[-1].count('.') == 3: ipv4_string = fields.pop() ipv4_int = IPv4Network(ipv4_string)._ip @@ -1406,7 +1405,9 @@ class _BaseV6(object): octets.append(hex(ipv4_int & 0xFFFF).lstrip('0x').rstrip('L')) ipv4_int >>= 16 fields.extend(reversed(octets)) + ip_str = ':'.join(fields) + fields = self._explode_shorthand_ip_string(ip_str).split(':') for field in fields: try: ip_int = (ip_int << 16) + int(field or '0', 16) |