INET6(4)

NAME
inet6 - Internet protocol family (version 6)

SYNOPSIS
#include <sys/types.h>
#include <netinet6/in6.h>

DESCRIPTION
Version 6 of the Internet Protocol (henceforth IPv6) is a new version of the internet protocol with 16-byte addresses, and a number of other enhancements. Like with the Internet protocol family, there is a collection of protocols layered atop the version 6 of the Internet Protocol (IPv6) transport layer, and utilizing the version 6 Internet address format. The version 6 Internet family provides protocol support for the SOCK_STREAM, SOCK_DGRAM, and SOCK_RAW socket types; the SOCK_RAW interface provides access to the IPv6 protocol.

ADDRESSING
Version 6 Internet addresses are 16 byte quantities, stored in network standard format. The include file <netinet6/in6_types.h> (which is included in <netinet6/in6.h> ) defines this address as a structure. The size of IPv6 addresses exceeds normal C data types, so the structure elements may have to be manipulated.

Sockets bound to version 6 of Internet protocol family utilize the following addressing structure,

    struct sockaddr_in6 {
    	u_char	sin6_len;
    	u_char	sin6_family;
    	u_short	sin6_port;
    	u_long	sin6_flowinfo;
    	struct	in_addr6 sin6_addr;
    };

Sockets may be created with an all-zeroes local address to effect “wildcard” matching on incoming messages. The address in a connect(2) or sendto(2) call may be given as INADDR_ANY to mean “this host”.

Version 6 Internet sockets can communicate using the old version of IP by specifying an address of the form

    ::FFFF:<IPv4-address>

This also means that sockets with all-zeros local addresses can accept old-style IP data.

PROTOCOLS
The Internet protocol family is comprised of the IPv6 Internet protocol, Internet Control Message Protocol (version 6) (ICMPv6), Transmission Control Protocol (TCP), and User Datagram Protocol (UDP). TCP is used to support the SOCK_STREAM abstraction while UDP is used to support the SOCK_DGRAM abstraction. A raw interface to IPv6 is available by creating an Internet socket of type SOCK_RAW. The ICMPv6 message protocol is accessible from a raw socket.

The 128-bit IPv6 address, from the point of view of the host, contains two parts, a prefix, and a host part. The length of the prefix can vary, and as a consequence the host part varies as well. This allows the addressing to better fit network topology, and avoids the constraints of rigid address classes.

IOCTL
The inet6 suite introduces one new ioctl to go along with the ones in netintro(4).

SIOCVIFADDR_INET6
    Verify an address added with SIOCAIFADDR_INET6. This is needed because IPv6 duplicate address detection is started after a successful SCIOCAIFADDR_INET6 ioctl. If the ioctl returns -1 with an error code of EWOULDBLOCK, then duplicate address detection has not yet completed on the address. If the ioctl returns 0, then duplicate address detection verified the uniqueness of the address. If the ioctl returns -1 with an error code of EADDRNOTAVAIL, then duplicate address detection found a duplicate address.

<More stuff about passing source routes (in addressing section), v4-compatibility and transition, hints at security, and other things.>

SEE ALSO
ioctl(2), socket(2), netintro(4), ipsec(4), esp(4), ah(4), tcp(4), udp(4), ipv6(4), icmpv6(4) An Introductory 4.3 BSD Interprocess Communication Tutorial, PS1, 7. An Advanced 4.3 BSD Interprocess Communication Tutorial, PS1, 8.

CAVEAT
The Internet protocol support is subject to change as the Internet protocols develop. Users should not depend on details of the current implementation, but rather the services exported.

HISTORY
The inet6 protocol interface first appeared in NRL's 4.4BSD IPv6 networking distribution. The IPv6 extensions were written by Ran Atkinson, Dan McDonald, Craig Metz, and Bao Phan of the U. S. Naval Research Laboratory.