Opened 6 years ago

Last modified 6 years ago

#5997 enhancement new

IPv6-only binding

Reported by: scibi Owned by:
Priority: normal Milestone:
Component: core Keywords: ipv6
Cc: Tristan Seligmann Branch:


When you create IPv6 socket it can accept IPv4 connections (using mapped addresses) or not. Different operating systems behaves differently. AFAIK Windows XP doesn't support mapped addresses, Windows Vista+ supports mapped addresses when you explicitly enable it on socket. Linux supports mapped addresses by default but it can be disabled system wide using net.ipv6.bindv6only sysctl (some distributions do this and some don't). It would be nice to have common behavior on all platforms so I suggest calling

s.setsockopt(socket.IPPROTO_IPV6, socket.IPV6_V6ONLY, 1)

(see patch).

Attachments (1)

ipv6_only.patch (652 bytes) - added by scibi 6 years ago.

Download all attachments as: .zip

Change History (2)

Changed 6 years ago by scibi

Attachment: ipv6_only.patch added

comment:1 Changed 6 years ago by Tristan Seligmann

Cc: Tristan Seligmann added

+1 for this change (although I guess it needs tests and I'm not sure how that should work); mapped addresses are awkward to deal with, and while listening on two different ports is not particularly difficult to begin with, Twisted generally makes it even easier.

Note: See TracTickets for help on using tickets.