This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author neologix
Recipients giampaolo.rodola, gvanrossum, neologix, pitrou
Date 2013-03-27.20:32:16
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <CAH_1eM3-VKgDpOAyf+T4h5g8GVd+5pD+ZdU99+hsxXJniBoWXw@mail.gmail.com>
In-reply-to <1364413810.77.0.360910455707.issue17561@psf.upfronthosting.co.za>
Content
> What you say is right but whether the kernel supports an hybrid IPv4/6 stack
> or not there's not much we can do about it anyway.
> Exactly what are you suggesting with the ServerSocket class you mentioned?
> What do you expect it to do?

There's a confusion.
Dual-stack merely means that the host supports both IPv4 and IPv6 natively.
The IPV6_V6ONLY tunable is just a way to enable or not IPv4-mapped
addresses (i.e. ::ffff::<IPv4 address>) so that an IPv4 client can
connect to this socket. It can be set system-wide, or on a socket
basis.

> Note that platforms supporting the dual-stack are already supported. This:
>
>>>> socket.create_server_socket(("::", 0))
>
> ...on Linux will create a socket which is reachable both as "::1" and
> "127.0.0.1".

Try the same thing after:
# echo 1 > /proc/sys/net/ipv6/bindv6only

It won't accept IPv4 connections anymore.

And that's the default on many (most) platforms, e.g. FreeBSD and
OpenBSD (I think it's also true for Windows).

So the bottom line is that with the current code, on some - most -
platforms, we'll only accept IPv6 connections (and since you iterate
over getaddrinfo() in an unspecified order you may very well bind to
IPv4 only first, in which case you'll only accept IPv4 clients).

The proper way to procedd, on platforms which don't support unsetting
IPV6_V6ONLY, is to use two sockets, one in IPv4, and one IPv6, and use
select() to accept connections.

This would propably belong to an overriden accept() method in a
ServerSocket class, since it's far from trivial.
History
Date User Action Args
2013-03-27 20:32:17neologixsetrecipients: + neologix, gvanrossum, pitrou, giampaolo.rodola
2013-03-27 20:32:17neologixlinkissue17561 messages
2013-03-27 20:32:16neologixcreate