twisteroid ambassador <twisteroid.ambassa...@gmail.com> added the comment:

I don't have a Mac, so I have not tested Ronald's workaround. Assuming it 
works, we will have to either i) implement platform-specific behavior and only 
apply IPV6_V6ONLY on macOS for each AF_INET6 socket created, or ii) apply it to 
all AF_INET6 sockets on all platforms, ideally after testing the option on all 
these platforms to make sure it doesn't have any undesirable side effect.

Linux's man page of ipv6 (http://man7.org/linux/man-pages/man7/ipv6.7.html ) 
has this to say about IPV6_V6ONLY:


If this flag is set to true (nonzero), then the socket is re‐
stricted to sending and receiving IPv6 packets only.  In this
case, an IPv4 and an IPv6 application can bind to a single
port at the same time.

If this flag is set to false (zero), then the socket can be
used to send and receive packets to and from an IPv6 address
or an IPv4-mapped IPv6 address.


So setting IPV6_V6ONLY might break some use cases? I have no idea how prevalent 
that may be.

The upside of this solution, as well as the second suggestion in Neil's OP 
(filter out local addrinfos with mismatching family), is that they should not 
increase connect time for normal cases. My solution (for which I have already 
submitted a PR) probably has a negligible increase in connection time and 
resource usage, because a fresh socket object is created for each pair of 
remote and local addrinfo.

----------

_______________________________________
Python tracker <rep...@bugs.python.org>
<https://bugs.python.org/issue35302>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to