id,summary,reporter,owner,description,type,status,priority,milestone,component,resolution,keywords,cc,branch,branch_author,launchpad_bug
5086,Accept IPv6 address literals (with embedded scope ids) in IReactorUDP.listenUDP,exarkun,,"Similarly to #5084, Twisted should provide low-level support for [wiki:IPv6] UDP servers.  `IReactorUDP.listenUDP` implementations should accept IPv6 address literals and set up a UDP port bound to that address.

Nothing about how IPv4 support is provided will change - IPv4 address literals and hostnames will continue to listen only on an IPv4 address.  The default will still be to listen on INADDR_ANY, which does not include an IPv6 addresses.

The resulting `IListeningPort` will return an `IPv6Address` (see #5084) from its `getHost` implementations.

The protocol will be connected to an `IUDPTransport` implementation which also returns `IPv6Address` instances from its `getHost` implementation.

When a datagram is delivered to the server, the `datagramReceived` method will be invoked with the address returned by `socket.recvfrom` (nominally a 4 tuple giving address, port, flow info, and scope id), just as is the case for IPv4 (where only address and port are present in the tuple).

The `IUDPTransport.write` implementation in this case will also accept a 4 tuple of this sort.  Sending to IPv6 addresses in this way is supported, but only if an IPv6 address literal was passed to `listenUDP` in the first place.

`IUDPTransport.getHost` is documented as returning `IPv4Address` instances.  This should probably change.

Once this is resolved, Twisted servers should be able to bind UDP ports on IPv6 addresses, eg `::1` or `fe80::1%lo0` or `::`, as well as send datagrams to IPv6 address from such ports.  Note that where the platform requires the scope id, `IReactorUDP.listenUDP` and `IUDPTransport.write` will require the scope id as well.

",enhancement,new,normal,,core,,ipv6,,,,
