[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
IPv6 Netowrk Device Numbering BP
On Nov 1, 2012, at 10:43 , Chip Marshall <chip at 2bithacker.net> wrote:
> On 01-Nov-2012, Owen DeLong <owen at delong.com> sent:
>> The only exceptions to this parsing would be if someone handed
>> you a textual representation of an IPv4 mapped address
>> (::ffff:192.0.2.50), which essentially represents the partial
>> decimal format Masataka is requesting.
> I might be missing something here, but isn't that format already
> valid for any IPv6 address, not just the special v4-in-v6
>>>> import socket
>>>> p = '2001:abcd::22.214.171.124'
>>>> n = socket.inet_pton(socket.AF_INET6, p)
>>>> socket.inet_ntop(socket.AF_INET6, n)
> Or is the issue just the ntop part not giving you back the
> decimalized string?
That's not a problem and I certainly wouldn't expect it to do so.
I guess the silly notation is more widely supported than I thought, but, IMHO, it's a kind of poor choice of syntax outside of the limited use of displaying IPv4-mapped addresses for dual-stack socket connections displaying IPv4 connections in IPv6 format.