MirOS Manual: inet6(4)

INET6(4)                   BSD Programmer's Manual                    INET6(4)

NAME

     inet6 - Internet protocol version 6 family

SYNOPSIS

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

DESCRIPTION

     The inet6 family is an updated version of the inet(4) family. While
     inet(4) implements Internet Protocol version 4, inet6 implements Internet
     Protocol version 6.

     inet6 is a collection of protocols layered atop the Internet Protocol
     version 6 (IPv6) transport layer, and utilizing the IPv6 address format.
     The inet6 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

     IPv6 addresses are 16 byte quantities, stored in network standard
     byteorder. The include file <netinet/in.h> defines this address as a
     discriminated union.

     Sockets bound to the inet6 family utilize the following addressing struc-
     ture:

           struct sockaddr_in6 {
                   u_int8_t        sin6_len;
                   sa_family_t     sin6_family;
                   in_port_t       sin6_port;
                   u_int32_t       sin6_flowinfo;
                   struct in6_addr sin6_addr;
                   u_int32_t       sin6_scope_id;
           };

     Sockets may be created with the local address "::"
     (which is equal to IPv6 address 0:0:0:0:0:0:0:0) to effect "wildcard"
     matching on incoming messages.

     The IPv6 specification defines scoped address, like link-local or site-
     local address. A scoped address is ambiguous to the kernel, if it is
     specified without a scope identifier. To manipulate scoped addresses
     properly from userland, programs must use the advanced API defined in RFC
     2292. A compact description of the advanced API is available in ip6(4).
     If scoped addresses are specified without explicit scope, the kernel may
     raise an error. Note that scoped addresses are not for daily use at this
     moment, both from a specification and an implementation point of view.

     KAME implementation supports extended numeric IPv6 address notation for
     link-local addresses, like "fe80::1%de0" to specify
     "fe80::1 on de0 interface". The notation is supported by getaddrinfo(3)
     and getnameinfo(3). Some normal userland programs, such as telnet(1) or
     ftp(1), are able to use the notation. With special programs like
     ping6(8), an outgoing interface can be specified with an extra command
     line option to disambiguate scoped addresses.

     Scoped addresses are handled specially in the kernel. In the kernel
     structures like routing tables or interface structure, scoped addresses
     will have their interface index embedded into the address. Therefore, the
     address on some of the kernel structure is not the same as that on the
     wire. The embedded index will become visible on PF_ROUTE socket, kernel
     memory accesses via kvm(3) and some other occasions. HOWEVER, users
     should never use the embedded form. For details please consult
     http://www.kame.net/dev/cvsweb.cgi/kame/IMPLEMENTATION. Note that the
     above URL describes the situation with the latest KAME tree, not the
     OpenBSD tree.

PROTOCOLS

     The inet6 family is comprised of the IPv6 network protocol, Internet Con-
     trol 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. Note that TCP and UDP are common to inet(4) and inet6. 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.

Interaction between IPv4/v6 sockets

     OpenBSD does not route IPv4 traffic to an AF_INET6 socket. The particular
     behavior in RFC 2553 is intentionally omitted for security reasons
     presented above. If both IPv4 and IPv6 traffic need to be accepted,
     listen to two sockets.

     The behavior of AF_INET6 TCP/UDP socket is documented in RFC 2553. Basi-
     cally, it says the following:

     •   A specific bind to an AF_INET6 socket
         (bind(2) with address specified) should accept IPv6 traffic to that
         address only.
     •   If a wildcard bind is performed on an AF_INET6 socket
         (bind(2) to IPv6 address ::), and there is no wildcard bind AF_INET
         socket on that TCP/UDP port, IPv6 traffic as well as IPv4 traffic
         should be routed to that AF_INET6 socket. IPv4 traffic should be seen
         as if it came from IPv6 address like ::ffff:10.1.1.1. This is called
         IPv4 mapped address.
     •   If there are both wildcard bind AF_INET socket and wildcard bind
         AF_INET6 socket on one TCP/UDP port, they should behave separately.
         IPv4 traffic should be routed to AF_INET socket and IPv6 should be
         routed to AF_INET6 socket.

     However, RFC 2553 does not define the constraint between the order of
     bind(2), nor how IPv4 TCP/UDP port numbers and IPv6 TCP/UDP port numbers
     relate to each other (should they be integrated or separated). Implement-
     ed behavior is very different from kernel to kernel. Therefore, it is un-
     wise to rely too much upon the behavior of AF_INET6 wildcard bind socket.
     It is recommended to listen to two sockets, one for AF_INET and another
     for AF_INET6, if both IPv4 and IPv6 traffic are to be accepted.

     It should also be noted that malicious parties can take advantage of the
     complexity presented above, and are able to bypass access control, if the
     target node routes IPv4 traffic to AF_INET6 socket. Caution should be
     taken when handling connections from IPv4 mapped addresses to AF_INET6
     sockets.

SEE ALSO

     ioctl(2), socket(2), sysctl(3), icmp6(4), intro(4), ip6(4), tcp(4),
     udp(4)

STANDARDS

     Tatsuya Jinmei and Atsushi Onoe, An Extension of Format for IPv6 Scoped
     Addresses, internet draft, draft-ietf-ipngwg-scopedaddr-format-02.txt,
     June 2000, work in progress material.

HISTORY

     The inet6 protocol interface is defined in RFC 2553 and RFC 2292. The im-
     plementation described herein appeared in WIDE/KAME project.

BUGS

     The IPv6 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.

     "Version independent" code should be implemented as much as possible in
     order to support both inet(4) and inet6.

MirOS BSD #10-current          January 29, 1999                              2

Generated on 2014-07-04 21:17:45 by $MirOS: src/scripts/roff2htm,v 1.79 2014/02/10 00:36:11 tg Exp $

These manual pages and other documentation are copyrighted by their respective writers; their source is available at our CVSweb, AnonCVS, and other mirrors. The rest is Copyright © 2002‒2014 The MirOS Project, Germany.
This product includes material provided by Thorsten Glaser.

This manual page’s HTML representation is supposed to be valid XHTML/1.1; if not, please send a bug report – diffs preferred.