Partial IPv6 support

I’ve pushed quite a few enhancements to library(socket) that implements basic support for IPv6. Rough updates:

  • Added socket_create(-Socket, +Options), so we have one predicate that can manipulate all the arguments to create a socket. Currently supports unix, inet and inet6 domains and stream and dgram types. protocols are supported, but we can now at least add them easily.
  • Added ip(A,B,C,D,E,F,G,H) term to describe IPv6 addresses as 8 16-bit integers.
  • Added host_address(?Host, ?Address, ?Options) as replacement for tcp_host_to_address/2, providing much more options and information.
  • Added ip_name/2 to translate between an atom/string representing an IP address as text and an ip/4 or ip/8 term.

TCP sockets seem to work fine using IPv6. I have not tested UDP. I think some work needs to be done to deal with multicast addresses.

Another issue is that tcp_connect/3 (tcp_connect(+Address, -Stream, +Options)) can now deal with IPv6 using the option domain(inet6), but it should probably figure out what the host at Address supports and choose.

4 Likes