@CHIP-RTOS - IPv4/v6 Dual layer stack
IPC@CHIP® Documentation Index
IPv4/v6 Dual Layer Stack
Additional to the IPv4 protocol, the TCP/IP protocol stack of the IPC@CHIP® SC1x3/SC2x
IPv6 is sometimes called the Next Generation Internet Protocol, or IPng. The current
Internet and most of corporate or private intranets use IPv4, developed in 1970s and 1980s.
Now with IPv6, the first significant upgrade of the Internet protocol has been started.
The compelling reason behind the formation of IPv6 was lack of address space,
especially in the heavily populated countries of Asia such as China.
The most important changes from IPv4 to IPv6 can be summarized as follows:
1. Expanded addressing and autoconfiguration mechanisms
The address size for IPv6 is 128 bits (as defined by RFC 2373 and 2374),
instead of 32 bits for IPv4. This solves the problem of limited address space
and offers much simpler address configuration.
IPv6 addresses are mostly composed of two logical parts:
A 64-bit network prefix, and a 64-bit host-addressing part,
which is often automatically generated from the interface MAC address.
IPv6 addresses are normally written as eight groups of four hexadecimal digits.
For example, 2001:0db8:85a3:08d3:1319:8a2e:0370:7334 is a valid IPv6 address.
If the address is an IPv4 address in disguise, the last 32 bits may be written in decimal
Addresses on IPv6 interfaces can be configured without manual intervention.
With stateless address autoconfiguration
, a device interface is automatically
assigned a link-local IPv6 address by the system.
This link-local IPv6 address is generated by prepending a fixed local address prefix (fe80::)
to a token derived from the MAC address. (The address is verified to be unique.)
This allows each IPv6 interface to have at least one source address that can be used
by Neighbor Discovery. If an IPv6 router on the network advertises network prefixes
in router advertisements, IPv6 derives IPv6 addresses based on the network interface
identifier of the interface and on the network prefixes advertised.
2. Simplified new header format
The IPv6 header has a length of 40 bytes. Some fields of the IPv4-header are removed.
This allows a faster and easier processing of IP packets.
The header contains both source and destination addresses (128 bits each),
as well as the version (4-bit IP version), traffic class (8 bits, Packet Priority),
flow label (20 bits, QoS management), payload length (16 bits), next header (8 bits),
and hop limit (8 bits, time to live).
The payload can be up to 64k in size in standard mode, or larger with a "jumbo payload"
3. Better support for extensions and options
In IPv4, all options were integrated into the basis packet header. In IPv6, options
are handled with Extension headers
. Extension headers are optional
and only inserted if necessary. For example, the IPSec
option is inserted by using an extension header.
Extension headers allow a more flexible and efficent construction of IP packets.
New options defined in the future can be easily inserted.
The TCP/IP stack of the IPC@CHIP® works as a dual layer stack.
If the IPv6 protocol is enabled at the IPC@CHIP®, all TCP/IP applications
(e.g HTTP, Telnet or FTP servers) are accessible via both IPv4 and IPv6.
The provided socket interface supports both protocol types.
We cannot explain the entire functionality of the IPv6 protocol
in this document. The IPv6 base protocol is described in RFC 1883.
A good book for understanding IPv6 is
"IPv6 essentials" from Silvia Hagen, published by O'Reilly.
Under www.ipv6.org, you will also
find several documents explaining the essentials of IPv6.
Please note: The IPv6 on IPC@CHIP® is under development and currently not
completed. Expansions and modifications of the RTOS and the provided
API functions are possible in later versions.
In the following sections we describe the provided features and functionality
of IPv6 offered by the IPC@CHIP®.
Enable IPv6 protocol
- IPv6 on the IPC@CHIP® must be enabled by the chip.ini entry
Top of list
- Configuration of IPv6 addresses is provided as follows:
1. Stateless autoconfiguration
2. Manual configuration
3. Get PPP server configuration
4. Open PPP client IPv6 link
The shell command IPV6CFG lists the configuration
of all started device interfaces.
The TCP/IP API function GET_IPV6_IFACE_ENTRIES
provides read-only access from within user application programs.
Top of list
- The socket application interface of the IPC@CHIP® has been updated to add
support for IPv6. For IPv6 communication, a socket must be opened with
the API function
Depending on the API used to open the socket, all subsequent socket API functions,
use either the sockaddr_in
or sockaddr_in6 structure,
defined in the CLIB header file tcpipapi.h.
1. If a IPC@CHIP® host has a valid IPv4 configuration, it is also possible to
communicate over the IPv6-capable socket via the IPv4 address. In such a case the
IPv4 addresses are stored internally (at
structure member sin6_addr
) as a IPv4-mapped IPv6 address
(e.g. 172.30.8.69 is stored as ::FFFF:172.30.8.69).
2. For support of both protocols, the C-library functions
bind, connect, sendto, recvfrom, ...
use a pointer to the
structure type. For example the
addressPtr parameter here:
int bind ( int sd, const struct sockaddr far *addressPtr, int *error );
3. Conversion of IPv4 and IPv6 addresses from text format to binary and back
can be done by using the INET_PTON and
4. Provided IPv6 socket API examples (built with Clib functions) are:
- UDPEchoClient, udp6clie.c
- UDPEchoServer, udp6serv.c
- TCPEchoClient, tcp6clie.c
- TCPEchoServer, tcp6serv.c
Supported since or modified in @CHIP-RTOS version
Top of list
End of document