timmerk / ipaddr-py

Automatically exported from code.google.com/p/ipaddr-py
0 stars 0 forks source link

Incorrect byte order calculation for IPv4 mapped/compatible IPv6 addresses #13

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?

In [1]: from ipaddr import IP

In [2]: IP('192.168.0.1')
Out[2]: IPv4('192.168.0.1/32')

In [3]: IP('::192.168.0.1')
Out[3]: IPv6('::1:c0a8/128') # incorrect byte order.

In [4]: IP('::ffff:192.168.0.1')
Out[4]: IPv6('::ffff:1:c0a8/128') # incorrect byte order.

In [5]: IP('192.168.0.1').ip
Out[5]: 3232235521L

In [6]: IP('::192.168.0.1').ip
Out[6]: 114856 # incorrect integer value.

What is the expected output?

...

In [3]: IP('::192.168.0.1')
Out[3]: IPv6('::c0a8:1/128')

In [4]: IP('::ffff:192.168.0.1')
Out[4]: IPv6('::ffff:c0a8:1/128')

In [5]: IP('192.168.0.1').ip
Out[5]: 3232235521L

In [6]: IP('::192.168.0.1').ip
Out[6]: 3232235521L

What version of the product are you using?

rev 39

On what operating system?

- Linux Intel x86 (little endian)
- Solaris SPARC (big endian)

Original issue reported on code.google.com by drk...@gmail.com on 6 Jan 2009 at 5:25

GoogleCodeExporter commented 9 years ago
Great find.  I have a diff coming out right now.

Original comment by sm...@google.com on 6 Jan 2009 at 6:18

GoogleCodeExporter commented 9 years ago
http://codereview.appspot.com/11872/

Original comment by sm...@google.com on 6 Jan 2009 at 6:23

GoogleCodeExporter commented 9 years ago
Corrected URL: http://codereview.appspot.com/11872/show

Original comment by sm...@google.com on 22 Jan 2009 at 9:39

GoogleCodeExporter commented 9 years ago
Fixed in revision 43.

Original comment by sm...@google.com on 22 Jan 2009 at 9:55