Seth Woolley's Man Viewer

ipv6(7) - PF_INET6, ipv6, PF_INET6, ipv6 - Linux IPv6 protocol implementation - man 7 ipv6

([section] manual, -k keyword, -K [section] search, -f whatis)
man plain no title

IPV6(7)                    Linux Programmer's Manual                   IPV6(7)

       ipv6, PF_INET6 - Linux IPv6 protocol implementation

       #include <sys/socket.h>
       #include <netinet/in.h>

       tcp6_socket = socket(2,7,n)(PF_INET6, SOCK_STREAM, 0);
       raw6_socket = socket(2,7,n)(PF_INET6, SOCK_RAW, protocol);
       udp6_socket = socket(2,7,n)(PF_INET6, SOCK_DGRAM, protocol);

       Linux 2.2 optionally implements the Internet Protocol, version(1,3,5) 6.  This
       man(1,5,7) page contains a description of the IPv6 basic API as implemented by
       the Linux kernel and glibc 2.1. The interface is based on the BSD sock-
       ets interface; see socket(2,7,n)(7).

       The IPv6 API aims to be mostly compatible with the ip(7,8)(7) v4  API.  Only
       differences are described in(1,8) this man(1,5,7) page.

       To  bind(2,n,1 builtins)  an AF_INET6 socket(2,7,n) to any process the local address should be
       copied from the in6addr_any  variable  which  has  in6_addr  type.   In
       static initializations IN6ADDR_ANY_INIT may also be used, which expands
       to a constant expression.  Both of them are in(1,8) network order.

       The  IPv6  loopback  address  (::1)  is   available   in(1,8)   the   global
       in6addr_loopback  variable.  For  initializations IN6ADDR_LOOPBACK_INIT
       should be used.

       IPv4 connections can be handled with the v6 API by using the v4-mapped-
       on-v6  address type; thus a program only needs only to support this API
       type to support both protocols. This is handled  transparently  by  the
       address handling functions in(1,8) libc.

       IPv4  and IPv6 share the local port space. When you get an IPv4 connec-
       tion or packet to a IPv6 socket(2,7,n) its source address will be mapped to v6
       and it'll be mapped to v6.

              struct sockaddr_in6 {
                  u_int16_t       sin6_family;/* AF_INET6 */
                  u_int16_t       sin6_port;/* port number */
                  u_int32_t       sin6_flowinfo;/* IPv6 flow information */
                  struct in6_addr sin6_addr;/* IPv6 address */
                  u_int32_t   sin6_scope_id;  /* Scope id (new in(1,8) 2.4) */

              struct in6_addr {
                  unsigned char   s6_addr[16];/* IPv6 address */

       sin6_family  is  always set(7,n,1 builtins) to AF_INET6; sin6_port is the protocol port
       (see sin_port in(1,8) ip(7,8)(7)); sin6_flowinfo is  the  IPv6  flow  identifier;
       sin6_addr  is  the  128bit  IPv6  address.   sin6_scope_id  is an id of
       depending of on the scope of the address.  It  is  new  in(1,8)  Linux  2.4.
       Linux  only  supports  it  for  link(1,2)  scope  addresses,  in(1,8)  that  case
       sin6_scope_id contains the interface index (see netdevice(7))

       IPv6 supports several address types: unicast to address a single  host(1,5),
       multicast  to  address a group of hosts, anycast to address the nearest
       member of a group of hosts (not implemented in(1,8) Linux), IPv4-on-IPv6  to
       address a IPv4 host(1,5), and other reserved address types.

       The address notation for IPv6 is a group of 16 2 digit hexadecimal num-
       bers, separated with a ':'. '::' stands for a string(3,n) of 0  bits.   Spe-
       cial  addresses  are  ::1  for  loopback  and ::FFFF:<IPv4 address> for

       The port space of IPv6 is shared with IPv4.

       IPv6 supports some protocol specific socket(2,7,n) options  that  can  be  set(7,n,1 builtins)
       with  setsockopt(2)  and  read(2,n,1 builtins)  with  getsockopt(2).  The socket(2,7,n) option
       level for IPv6 is IPPROTO_IPV6.  A boolean integer flag is zero when it
       is false, otherwise true.

              Set the unicast hop limit for the socket. Argument is an pointer
              to an integer. -1 in(1,8) the value means use the route default, oth-
              erwise it should be between 0 and 255.

              Set  the  multicast  hop  limit  for  the  socket. Argument is a
              pointer to an integer. -1 in(1,8)  the  value  means  use  the  route
              default, otherwise it should be between 0 and 255.

              Set  the  device  for  outgoing multicast packets on the socket.
              This is only allowed for SOCK_DGRAM and  SOCK_RAW  socket.   The
              argument  is an pointer to an interface index (see netdevice(7))
              in(1,8) an integer.

              Turn an AF_INET6 socket(2,7,n) into a socket(2,7,n)  of  a  different  address
              family. Only AF_INET is currently supported for that. It is only
              allowed for IPv6 sockets that  are  connected  and  bound  to  a
              v4-mapped-on-v6  address. The argument is a pointer to a integer
              containing AF_INET.  This is useful to pass v4-mapped sockets as
              filedescriptors to programs that don't know how to deal with the
              IPv6 API.

              Set delivery of the IPV6_PKTINFO  control  message  on  incoming
              datagrams.  Only  allowed  for  SOCK_DGRAM  or SOCK_RAW sockets.
              Argument is a pointer to a boolean value in(1,8) an integer.

              Set delivery of control messages for incoming datagrams contain-
              ing  extension headers from the received packet.  IPV6_RTHDR de-
              livers the routing header, IPV6_AUTHHDR delivers the authentica-
              tion  header,  IPV6_DSTOPTS  delivers  the  destination options,
              IPV6_HOPOPTS delivers the hop options, IPV6_FLOWINFO delivers an
              integer  containing the flow id, IPV6_HOPLIMIT delivers an inte-
              ger containing the hop count of the packet.   The  control  mes-
              sages  have the same type as the socket(2,7,n) option. All these header
              options can also be set(7,n,1 builtins) for outgoing packets by putting the  ap-
              propriate control message into the control buffer of sendmsg(2).
              Only allowed for SOCK_DGRAM or SOCK_RAW sockets. Argument  is  a
              pointer to a boolean value.

              Control  whether  the  socket(2,7,n) sees multicast packets that is has
              send(2,n) itself.  Argument is a pointer to boolean.

              Control membership in(1,8) multicast groups. Argument is a pointer to
              a struct ipv6_mreq structure.

              Set the MTU to be used for the socket. The MTU is limited by the
              device MTU or the path mtu when path mtu discovery  is  enabled.
              Argument is a pointer to integer.

              Control path mtu discovery on the socket. See IP_MTU_DISCOVER in(1,8)
              ip(7,8)(7) for details.

              Control receiving of asynchronous error(8,n) options. See  IP_RECVERR
              in(1,8) ip(7,8)(7) for details.  Argument is a pointer to boolean.

              Pass  all forwarded packets containing an router alert option to
              this socket.  Only allowed for datagram sockets  and  for  root.
              Argument is a pointer to boolean.

       The older libinet6 libc5 based IPv6 API implementation for Linux is not
       described here and may vary in(1,8) details.

       Linux 2.4 will break binary  compatibility  for  the  sockaddr_in6  for
       64bit  hosts  by changing the alignment of in6_addr and adding an addi-
       tional sin6_scope_id field. The kernel interfaces stay compatible,  but
       a  program including sockaddr_in6 or in6_addr into other structures may
       not be. This is not a problem for 32bit hosts like i386.

       The sin6_flowinfo field is  new  in(1,8)  Linux  2.4.  It  is  transparently
       passed/read(2,n,1 builtins)  by  the kernel when the passed address length contains it.
       Some programs that pass a longer address buffer and then check the out-
       going address length may break.

       The  sockaddr_in6  structure is bigger than the generic sockaddr.  Pro-
       grams that assume that all address types can  be  stored  safely  in(1,8)  a
       struct  sockaddr  need to be changed to use struct sockaddr_storage for
       that instead.

       The IPv6 extended API as in(1,8) RFC2292 is currently only partly implement-
       ed; although the 2.2 kernel has near complete support for receiving op-
       tions, the macros for generating IPv6 options are missing in(1,8) glibc 2.1.

       IPSec support for EH and AH headers is missing.

       Flow label management is not complete and not documented here.

       This man(1,5,7) page is not complete.

       cmsg(3), ip(7,8)(7)

       RFC2553: IPv6 BASIC API. Linux tries to be compliant to this.

       RFC2460: IPv6 specification.

Linux Man Page                    1999-06-29                           IPV6(7)

References for this manual (incoming links)