Loading...
Searching...
No Matches

GNRC's IPv6 implementation. More...

Detailed Description

GNRC's IPv6 implementation.

This module is for usage with the GNRC communication interface

Supported NETAPI commands

This module handles the following GNRC communication interface message types:

<tt>GNRC_NETAPI_MSG_TYPE_RCV</tt>

GNRC_NETAPI_MSG_TYPE_RCV expects a Packet (referred to as "packet" in the following) in receive order (payload first, headers ordered down the stack). It must at least contain a link-layer payload starting with a valid IPv6 header. If it contains a Generic network interface header this header will be taken into account.

If the link-layer payload is not an IPv6 packet (starting with a 0x6 half-byte) or the module is not able to parse it correctly it will be dropped. If the packet can't be forwarded (either to another node or an upper layer) it will be dropped. Otherwise, there are two scenarios of success:

  1. If the destination address is an address on this host, and a suitable upper layer is registered the packet will be forwarded to that upper layer. An upper layer is suitable with its registration if

    In both cases nh is the [next header field of one of the IPv6 header] (ipv6_hdr_t::nh) or the next header field of one of the IPv6 extension headers" within the packet. The IPv6 header and every IPv6 extension header between the IPv6 header and the payload will be marked as separate @ref gnrc_pktsnip_t (i.e. the IPv6 payload will be the first snip due to receive order). Note, that IPv6-internal headers (such as ICMPv6 and extension headers) are handled within this module. If the @ref net_gnrc_ipv6_ext "`gnrc_ipv6_ext`" module is not present, IPv6 extension headers can't be parsed, so the packet might not be read properly. 2. If the receiving network interface (indicated by the gnrc_netif_hdr_t::if_pid if provided or the destination address in the IPv6 header) is configured as a forwarding interface, the destination is not an address on this host, and a route is configured for the destination the packet will be forwarded. In consequence, the module will emit a @ref GNRC_NETAPI_MSG_TYPE_SND with the packet reversed into send order and the (if necessary prepended) gnrc_netif_hdr_t::if_pid has the appropriate link-layer destination addresses to the next hop towards the destination. @subsection autotoc_md2035 <tt>GNRC_NETAPI_MSG_TYPE_SND</tt> @ref GNRC_NETAPI_MSG_TYPE_SND expects a @ref net_gnrc_pkt (referred to as "packet" in the following) in send order (headers ordered up the stack, payload last). It must at least contain a snip of type @ref GNRC_NETTYPE_IPV6 as its first or second snip. If the first snip is not of type @ref GNRC_NETTYPE_IPV6, it must be of type @ref GNRC_NETTYPE_NETIF. If the destination address within the @ref GNRC_NETTYPE_IPV6 snip is an address on this host or the loopback address <tt>::1</tt>, the packet will be @ref gnrc_pktbuf_reverse_snips() "reversed" and @ref gnrc_pktbuf_merge() "merged" so that it has a format as though it came from a network interface. It will then be handled as a received packet ("looped back") by the IPv6 module (see previous section).

Otherwise, if a route (or neighbor cache entry) to the IPv6 destination address exists, the IPv6 header will be filled for fields that were not set by upper layers and handed over to the link-layer (L2) with the L2 destination address set to the L2 address associated to that IPv6 destination address.

<tt>GNRC_NETAPI_MSG_TYPE_SET</tt>

GNRC_NETAPI_MSG_TYPE_SET is not supported.

<tt>GNRC_NETAPI_MSG_TYPE_GET</tt>

GNRC_NETAPI_MSG_TYPE_GET is not supported.

Modules

 GNRC IPv6 compile configurations
 
 ICMPv6
 GNRC's implementation of ICMPv6.
 
 IPv6 address blacklist
 This refuses IPv6 addresses that are defined in this list.
 
 IPv6 address whitelist
 This allows you to only accept IPv6 addresses that are defined in this list.
 
 IPv6 extension headers.
 Implementation of IPv6 extension headers.
 
 IPv6 header definitions
 
 IPv6 neighbor discovery (v2)
 Provides build and send functions for neighbor discovery packets.
 
 Neighbor Information Base for IPv6
 Neighbor Information Base (NIB) for IPv6.
 

Files

file  ipv6.h
 Definitions for GNRC's IPv6 implementation.
 

Macros

#define CONFIG_GNRC_IPV6_STATIC_LLADDR_IS_FIXED   0
 Use the same static IPv6 link local address on every network interface.
 
#define CONFIG_GNRC_IPV6_STATIC_LLADDR_NETDEV_MASK   0ULL
 Select interfaces by driver types for setting static link local addresses.
 
#define GNRC_IPV6_MSG_QUEUE_SIZE   (1 << CONFIG_GNRC_IPV6_MSG_QUEUE_SIZE_EXP)
 Message queue size to use for the IPv6 thread.
 

Functions

kernel_pid_t gnrc_ipv6_init (void)
 Initialization of the IPv6 thread.
 
ipv6_hdr_tgnrc_ipv6_get_header (gnrc_pktsnip_t *pkt)
 Get the IPv6 header from a given list of gnrc_pktsnip_t.
 

Variables

kernel_pid_t gnrc_ipv6_pid
 The PID to the IPv6 thread.
 

Macro Definition Documentation

◆ CONFIG_GNRC_IPV6_STATIC_LLADDR_IS_FIXED

#define CONFIG_GNRC_IPV6_STATIC_LLADDR_IS_FIXED   0

Use the same static IPv6 link local address on every network interface.

When CONFIG_GNRC_IPV6_STATIC_LLADDR is used, to not add the interface pid to the set static address but use the same static link local address for all interfaces.

Definition at line 181 of file ipv6.h.

◆ CONFIG_GNRC_IPV6_STATIC_LLADDR_NETDEV_MASK

#define CONFIG_GNRC_IPV6_STATIC_LLADDR_NETDEV_MASK   0ULL

Select interfaces by driver types for setting static link local addresses.

This option allows to explicitly include interfaces by matching their netdev driver types, encoded in a bitmask. See netdev_type_t for possible values of netdev driver types. Matching NETDEV_ANY will include all netdev driver types.

Example usage, includes AT86RF215 and MRF24J40 driver types:

#define CONFIG_GNRC_IPV6_STATIC_LLADDR_NETDEV_MASK \
((1UL << NETDEV_AT86RF215) | (1UL << NETDEV_MRF24J40))

A value of 0 will switch this selection feature off.

Definition at line 203 of file ipv6.h.

◆ GNRC_IPV6_MSG_QUEUE_SIZE

#define GNRC_IPV6_MSG_QUEUE_SIZE   (1 << CONFIG_GNRC_IPV6_MSG_QUEUE_SIZE_EXP)

Message queue size to use for the IPv6 thread.

Definition at line 210 of file ipv6.h.

Function Documentation

◆ gnrc_ipv6_get_header()

ipv6_hdr_t * gnrc_ipv6_get_header ( gnrc_pktsnip_t pkt)

Get the IPv6 header from a given list of gnrc_pktsnip_t.

     This function may be used with e.g. a pointer to a (full) UDP datagram.
Precondition
Any GNRC_NETTYPE_IPV6 snip in pkt is contains a full IPv6 header.
Parameters
[in]pktThe pointer to the first gnrc_pktsnip_t of the packet.
Returns
A pointer to the ipv6_hdr_t of the packet.
NULL if the packet does not contain an IPv6 header.

◆ gnrc_ipv6_init()

kernel_pid_t gnrc_ipv6_init ( void  )

Initialization of the IPv6 thread.

Returns
The PID to the IPv6 thread, on success.
a negative errno on error.
-EOVERFLOW, if there are too many threads running already
-EEXIST, if IPv6 was already initialized.

Variable Documentation

◆ gnrc_ipv6_pid

kernel_pid_t gnrc_ipv6_pid
extern

The PID to the IPv6 thread.

Note
Use gnrc_ipv6_init() to initialize. Do not set by hand.

This variable is preferred for IPv6 internal communication only. Please use Network protocol registry for external communication.