[Python-3000] IPv6 address tuple

Erno Kuusela erno at iki.fi
Fri Mar 23 10:57:11 CET 2007


hello,

On Thu, 22 Mar 2007, "Martin v. Löwis" wrote:

| >Would it be out of the question to change the IPv6 address 4-tuple to
| >a 2-tuple (as used with IPv4) in Python 2.0? This is a source of many
| >compatibility problems, and the additional flowinfo and scope elements
| >from the IPv6 tuple are practically never used by normal applications.
| 
| As a starting point of any discussion, you should get into contact with
| the author of the IPv6 support in Python, Jun-ichiro "itojun" Hagino.

Attached is a reply I got from itojun when asking about this.

For those that don't know about IPv6 scoped addresses: there are
1. global addresses, which are the ones you normally use for everything
2. link-local addresses, which work on just one L2 layer, they are used
   for things like neighbour advertisements which replaces ARP, and DHCP
3. site-local addresses, which were deprecated some time ago and
   were an abandoned attempt to replace IPv4 RFC1918 addressing
   (the current way is randomly generated prefixes used with
   global scope, RFC4193)

I first suggested just chopping off the flowid and scopeid parts of the
tuple. Itojun's reply seems to indicate we could potentially get away
with merging the scopeid to the IP address part in a standard fashion,
and discarding the flowid part.

In the below mail to itojun I suggested also an alternative way of
accepting both the 2-tuple and 4-tuple kinds of objects for IPv6. The
socket api would return 2-tuples for scope=global flowid=0 addresses,
and 4-tuples for others.

Another option that came to my mind is changing the address object from
tuple to an object with named fields. This way IPv4 and IPv6 address
compatibility could be taken care of with duck typing. This would
also require changing the way IPv4 addresses work, but now feels
to me like the most clean solution.

   -- erno

-------------- next part --------------
An embedded message was scrubbed...
From: itojun at itojun.org (Jun-ichiro itojun Hagino)
Subject: Re: (fwd) Re: [Python-3000] IPv6 address tuple
Date: Fri, 23 Mar 2007 18:36:28 +0900 (JST)
Size: 2678
Url: http://mail.python.org/pipermail/python-3000/attachments/20070323/e7632372/attachment-0001.mht 


More information about the Python-3000 mailing list