Author twisteroid ambassador
Recipients asvetlov, kyuupichan, ronaldoussoren, twisteroid ambassador, yselivanov
Date 2018-12-20.13:02:23
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1545310943.78.0.788709270274.issue35302@psf.upfronthosting.co.za>
In-reply-to
Content
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.
History
Date User Action Args
2018-12-20 13:02:23twisteroid ambassadorsetrecipients: + twisteroid ambassador, ronaldoussoren, asvetlov, yselivanov, kyuupichan
2018-12-20 13:02:23twisteroid ambassadorsetmessageid: <1545310943.78.0.788709270274.issue35302@psf.upfronthosting.co.za>
2018-12-20 13:02:23twisteroid ambassadorlinkissue35302 messages
2018-12-20 13:02:23twisteroid ambassadorcreate