timmerk / ipaddr-py

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

Enhanced support for 6to4 and Teredo addresses #72

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
It would be nice to be able to extract the IPv4 addresses embedded in 6to4 and 
Teredo IPv6 addresses.  6to4 has just one ipv4 address embedded, Teredo has 
both Server and Client ipv4 addresses.

Original issue reported on code.google.com by norm...@gmail.com on 1 Jan 2011 at 11:18

GoogleCodeExporter commented 9 years ago
should be added in r199. give trunk a looksee and tell me if it does what you 
need.

Original comment by pmo...@google.com on 13 Jan 2011 at 6:19

GoogleCodeExporter commented 9 years ago
[deleted comment]
GoogleCodeExporter commented 9 years ago

Original comment by pmo...@google.com on 13 Jan 2011 at 6:19

GoogleCodeExporter commented 9 years ago
looks great so far!

what about calling it ipv6_teredo like ipv4_mapped (and make it a property)

also add: ipv4_6to4 - format: 2002:xxxx:xxxx::, explode.split(':')[1:3] I think

and return None if the address isn't in the right range (like ipv4_mapped)

Original comment by norm...@google.com on 13 Jan 2011 at 6:57

GoogleCodeExporter commented 9 years ago
I've made them properties but i've left the names; hopefully not too confusing.

Original comment by pmo...@google.com on 13 Jan 2011 at 8:59

GoogleCodeExporter commented 9 years ago
Cool.  Some notes:

ipv4_mapped should check first 5 elements in bits == 0.
teredo is 2001:0::, so you should check for bits[1] == 0.

What about using in IPv6Network instead of doing this stuff by hand?

ipv4_mapped: self in IPv6Network('::ffff:0:0/96')
teredo: self in IPv6Network('2001::/32')
6to4: self in IPv6Network('2002::/16')

Original comment by norm...@gmail.com on 14 Jan 2011 at 11:54