RPL implementation for GNRC.
More...
RPL implementation for GNRC.
Configuration
USEMODULE
- RPL (Storing Mode)
- RPL auto-initialization on interface
USEMODULE += auto_init_gnrc_rpl
Auto-Initialization
If the application defines only one interface (gnrc_netif_highlander() returns true), then RPL will be initialized on this interface.
If the application defines several interfaces (gnrc_netif_highlander() returns false), then RPL will be initialized on the interface CONFIG_GNRC_RPL_DEFAULT_NETIF
. Your application is responsible for setting CONFIG_GNRC_RPL_DEFAULT_NETIF
to a valid interface PID, e.g. via CFLAGS
or menuconfig.
Initializing RPL on multiple interfaces automatically is currently not supported. Call gnrc_rpl_init()
manually from your application for the desired interfaces in this case.
CFLAGS
- Exclude Prefix Information Options from DIOs
CFLAGS += -DCONFIG_GNRC_RPL_WITHOUT_PIO
- Modify trickle parameters
CFLAGS += -DCONFIG_GNRC_RPL_DEFAULT_DIO_INTERVAL_DOUBLINGS=20
CFLAGS += -DCONFIG_GNRC_RPL_DEFAULT_DIO_INTERVAL_MIN=3
CFLAGS += -DCONFIG_GNRC_RPL_DEFAULT_DIO_REDUNDANCY_CONSTANT=10
- Make reception of DODAG_CONF optional when joining a DODAG. This will use the default trickle parameters until a DODAG_CONF is received from the parent. The DODAG_CONF is requested once from the parent while joining the DODAG. The standard behaviour is to request a DODAG_CONF and join only a DODAG once a DODAG_CONF is received.
CFLAGS += -DCONFIG_GNRC_RPL_DODAG_CONF_OPTIONAL_ON_JOIN
- Set interface for auto-initialization if more than one interface exists (gnrc_netif_highlander() returns false)
CFLAGS += -DCONFIG_GNRC_RPL_DEFAULT_NETIF=6
- By default, all incoming control messages get checked for validation. This validation can be disabled in case the involved RPL implementations are known to produce valid messages.
CFLAGS += -DCONFIG_GNRC_RPL_WITHOUT_VALIDATION
This RPL implementation currently only supports storing mode. That means, in order to have downwards routes to all nodes the storage space within gnrc_ipv6's
Neighbor Information Base must be big enough to store information for each node.
For a random topology of n nodes, to ensure you can reach every node from the root, set CONFIG_GNRC_IPV6_NIB_NUMOF
== CONFIG_GNRC_IPV6_NIB_OFFL_NUMOF
== n.
e.g. for n = 50 set
CFLAGS += -DCONFIG_GNRC_IPV6_NIB_NUMOF=50
CFLAGS += -DCONFIG_GNRC_IPV6_NIB_OFFL_NUMOF=50
If you want to allow for alternative parents, increase the number of default routers in the NIB.
e.g. for one alternative parent, set
CFLAGS += -DCONFIG_GNRC_IPV6_NIB_DEFAULT_ROUTER_NUMOF=2
TODO
The GNRC RPL implementation only implements storing mode with OF0 (RFC6552). The RPL routing header is parsed by the nodes when the gnrc_rpl_srh
module is used, but anything else for non-storing mode is missing. For interoperability with other RPL implementations, open task include:
|
file | dodag.h |
| DODAG-related functions for RPL.
|
|
file | of_manager.h |
| RPL Objective functions manager header.
|
|
file | structs.h |
| RPL data structs.
|
|
file | rpl.h |
| RPL header. Declaration of global variables and functions needed for core functionality of RPL.
|
|
file | globals.h |
| Internal globals for RPL.
|
|
file | netstats.h |
| RPL control message statistics functions.
|
|
file | validation.h |
| RPL control message validation functions.
|
|
file | of0.h |
| Objective Function Zero.
|
|
|
#define | GNRC_RPL_STACK_SIZE (THREAD_STACKSIZE_DEFAULT) |
| Default stack size to use for the RPL thread.
|
|
#define | GNRC_RPL_PRIO (GNRC_IPV6_PRIO + 1) |
| Default priority for the RPL thread.
|
|
#define | CONFIG_GNRC_RPL_MSG_QUEUE_SIZE_EXP (3U) |
| Default message queue size to use for the RPL thread (as exponent of 2^n). More...
|
|
#define | GNRC_RPL_MSG_QUEUE_SIZE (1 << CONFIG_GNRC_RPL_MSG_QUEUE_SIZE_EXP) |
| Message queue size to use for the RPL thread.
|
|
#define | GNRC_RPL_ALL_NODES_ADDR {{ 0xff, 0x02, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0x1a }} |
| Static initializer for the all-RPL-nodes multicast IPv6 address (ff02::1a) More...
|
|
#define | GNRC_RPL_MSG_TYPE_LIFETIME_UPDATE (0x0900) |
| Message type for lifetime updates.
|
|
#define | GNRC_RPL_MSG_TYPE_TRICKLE_MSG (0x0901) |
| Message type for trickle.
|
|
#define | GNRC_RPL_MSG_TYPE_DAO_HANDLE (0x0903) |
| Message type for handling DAO sending.
|
|
#define | GNRC_RPL_INFINITE_RANK (0xFFFF) |
| Infinite rank. More...
|
|
#define | CONFIG_GNRC_RPL_DEFAULT_MIN_HOP_RANK_INCREASE (256) |
| Default minimum hop rank increase. More...
|
|
#define | CONFIG_GNRC_RPL_DEFAULT_MAX_RANK_INCREASE (0) |
| Maximum rank increase.
|
|
#define | GNRC_RPL_IMPLEMENTED_OFS_NUMOF (1) |
| Number of implemented Objective Functions.
|
|
#define | GNRC_RPL_DEFAULT_OCP (0) |
| Default Objective Code Point (OF0)
|
|
#define | CONFIG_GNRC_RPL_DEFAULT_INSTANCE (0) |
| Default Instance ID.
|
|
#define | GNRC_RPL_DEFAULT_PREFIX_LEN (64) |
| Default prefix length for the DODAG id.
|
|
#define | GNRC_RPL_DEFAULT_PREFIX_LIFETIME (0xFFFFFFFF) |
| Default prefix valid and preferred time for the DODAG id. More...
|
|
#define | GNRC_RPL_GROUNDED (1) |
| A DODAG can be grounded or floating. More...
|
|
#define | CONFIG_GNRC_RPL_CLEANUP_TIME (5 * MS_PER_SEC) |
| Cleanup interval in milliseconds.
|
|
#define | GNRC_RPL_ROOT_RANK (CONFIG_GNRC_RPL_DEFAULT_MIN_HOP_RANK_INCREASE) |
| Rank of the root node.
|
|
#define | GNRC_RPL_ICMPV6_CODE_DIS (0x00) |
| DIS ICMPv6 code. More...
|
|
#define | GNRC_RPL_ICMPV6_CODE_DIO (0x01) |
| DIO ICMPv6 code. More...
|
|
#define | GNRC_RPL_ICMPV6_CODE_DAO (0x02) |
| DAO ICMPv6 code. More...
|
|
#define | GNRC_RPL_ICMPV6_CODE_DAO_ACK (0x03) |
| DAO ACK ICMPv6 code. More...
|
|
#define | GNRC_RPL_LIFETIME_UPDATE_STEP (2) |
| Update interval of the lifetime update function.
|
|
#define | DAGRANK(rank, mhri) (rank/mhri) |
| Rank part of the DODAG. More...
|
|
#define | CONFIG_GNRC_RPL_PARENT_TIMEOUT_DIS_RETRIES (3) |
| Number of DIS retries before parent times out.
|
|
#define | CONFIG_GNRC_RPL_DEFAULT_NETIF (KERNEL_PID_UNDEF) |
| Default network interface for GNRC RPL.
|
|
|
kernel_pid_t | gnrc_rpl_init (kernel_pid_t if_pid) |
| Initialization of the RPL thread. More...
|
|
gnrc_rpl_instance_t * | gnrc_rpl_root_init (uint8_t instance_id, ipv6_addr_t *dodag_id, bool gen_inst_id, bool local_inst_id) |
| Initialization of a node as root. More...
|
|
void | gnrc_rpl_send_DIO (gnrc_rpl_instance_t *instance, ipv6_addr_t *destination) |
| Send a DIO of the instance to the destination . More...
|
|
void | gnrc_rpl_send_DIS (gnrc_rpl_instance_t *instance, ipv6_addr_t *destination, gnrc_rpl_internal_opt_t **options, size_t num_opts) |
| Send a DIS of the instance to the destination . More...
|
|
void | gnrc_rpl_send_DAO (gnrc_rpl_instance_t *instance, ipv6_addr_t *destination, uint8_t lifetime) |
| Send a DAO of the dodag to the destination . More...
|
|
void | gnrc_rpl_send_DAO_ACK (gnrc_rpl_instance_t *instance, ipv6_addr_t *destination, uint8_t seq) |
| Send a DAO-ACK of the instance to the destination . More...
|
|
void | gnrc_rpl_recv_DIS (gnrc_rpl_dis_t *dis, kernel_pid_t iface, ipv6_addr_t *src, ipv6_addr_t *dst, uint16_t len) |
| Parse a DIS. More...
|
|
void | gnrc_rpl_recv_DIO (gnrc_rpl_dio_t *dio, kernel_pid_t iface, ipv6_addr_t *src, ipv6_addr_t *dst, uint16_t len) |
| Parse a DIO. More...
|
|
void | gnrc_rpl_recv_DAO (gnrc_rpl_dao_t *dao, kernel_pid_t iface, ipv6_addr_t *src, ipv6_addr_t *dst, uint16_t len) |
| Parse a DAO. More...
|
|
void | gnrc_rpl_recv_DAO_ACK (gnrc_rpl_dao_ack_t *dao_ack, kernel_pid_t iface, ipv6_addr_t *src, ipv6_addr_t *dst, uint16_t len) |
| Parse a DAO-ACK. More...
|
|
void | gnrc_rpl_delay_dao (gnrc_rpl_dodag_t *dodag) |
| Delay the DAO sending interval. More...
|
|
void | gnrc_rpl_long_delay_dao (gnrc_rpl_dodag_t *dodag) |
| Long delay the DAO sending interval. More...
|
|
gnrc_rpl_instance_t * | gnrc_rpl_root_instance_init (uint8_t instance_id, ipv6_addr_t *dodag_id, uint8_t mop) |
| Create a new RPL instance and RPL DODAG. More...
|
|
void | gnrc_rpl_send (gnrc_pktsnip_t *pkt, kernel_pid_t iface, ipv6_addr_t *src, ipv6_addr_t *dst, ipv6_addr_t *dodag_id) |
| Send a control message. More...
|
|
uint8_t | gnrc_rpl_gen_instance_id (bool local) |
| Generate a local or global instance id. More...
|
|
static void | gnrc_rpl_config_pio (gnrc_rpl_dodag_t *dodag, bool status) |
| (De-)Activate the transmission of Prefix Information Options within DIOs for a particular DODAG. More...
|
|
|
#define | GNRC_RPL_MOP_NO_DOWNWARD_ROUTES (0x00) |
|
#define | GNRC_RPL_MOP_NON_STORING_MODE (0x01) |
|
#define | GNRC_RPL_MOP_STORING_MODE_NO_MC (0x02) |
|
#define | GNRC_RPL_MOP_STORING_MODE_MC (0x03) |
|
#define | GNRC_RPL_DEFAULT_MOP GNRC_RPL_MOP_STORING_MODE_NO_MC |
| default MOP set on compile time
|
|
|
- See also
- Sequence Counter Operation
|
static uint8_t | GNRC_RPL_COUNTER_INCREMENT (uint8_t counter) |
|
static bool | GNRC_RPL_COUNTER_IS_INIT (uint8_t counter) |
|
static bool | GNRC_RPL_COUNTER_GREATER_THAN_LOCAL (uint8_t A, uint8_t B) |
|
static bool | GNRC_RPL_COUNTER_GREATER_THAN (uint8_t A, uint8_t B) |
|
#define | GNRC_RPL_COUNTER_MAX (255) |
|
#define | GNRC_RPL_COUNTER_LOWER_REGION (127) |
|
#define | GNRC_RPL_COUNTER_SEQ_WINDOW (16) |
|
#define | GNRC_RPL_COUNTER_INIT (GNRC_RPL_COUNTER_MAX - GNRC_RPL_COUNTER_SEQ_WINDOW + 1) |
|
|
- See also
- Trickle Parameters
|
#define | CONFIG_GNRC_RPL_DEFAULT_DIO_INTERVAL_DOUBLINGS (20) |
|
#define | CONFIG_GNRC_RPL_DEFAULT_DIO_INTERVAL_MIN (3) |
|
#define | CONFIG_GNRC_RPL_DEFAULT_DIO_REDUNDANCY_CONSTANT (10) |
|
|
default lifetime will be multiplied by the lifetime unit to obtain the resulting lifetime
- See also
- DODAG Configuration
|
#define | CONFIG_GNRC_RPL_DEFAULT_LIFETIME (5) |
|
#define | CONFIG_GNRC_RPL_LIFETIME_UNIT (60) |
|
|
#define | GNRC_RPL_NORMAL_NODE (0) |
|
#define | GNRC_RPL_ROOT_NODE (1) |
|
#define | GNRC_RPL_LEAF_NODE (2) |
|
|
- See also
- RPL Control Message Options
|
#define | GNRC_RPL_OPT_PAD1 (0) |
|
#define | GNRC_RPL_OPT_PADN (1) |
|
#define | GNRC_RPL_OPT_DAG_METRIC_CONTAINER (2) |
|
#define | GNRC_RPL_OPT_ROUTE_INFO (3) |
|
#define | GNRC_RPL_OPT_DODAG_CONF (4) |
|
#define | GNRC_RPL_OPT_TARGET (5) |
|
#define | GNRC_RPL_OPT_TRANSIT (6) |
|
#define | GNRC_RPL_OPT_SOLICITED_INFO (7) |
|
#define | GNRC_RPL_OPT_PREFIX_INFO (8) |
|
#define | GNRC_RPL_OPT_TARGET_DESC (9) |
|
|
- See also
- RFC 6550, section 5.1, RPL Instance ID
|
#define | GNRC_RPL_INSTANCE_ID_MSB (1 << 7) |
|
#define | GNRC_RPL_GLOBAL_INSTANCE_MASK (0x7F) |
|
#define | GNRC_RPL_LOCAL_INSTANCE_MASK (0x3F) |
|
#define | GNRC_RPL_INSTANCE_D_FLAG_MASK (1 << 6) |
|
#define | GNRC_RPL_DIS_SOLICITED_INFO_LENGTH (19) |
| DIS Solicited Information option (numbers) More...
|
|
#define | GNRC_RPL_DIS_SOLICITED_INFO_FLAG_V (1 << 7) |
|
#define | GNRC_RPL_DIS_SOLICITED_INFO_FLAG_I (1 << 6) |
|
#define | GNRC_RPL_DIS_SOLICITED_INFO_FLAG_D (1 << 5) |
|
◆ CONFIG_GNRC_RPL_DEFAULT_MIN_HOP_RANK_INCREASE
#define CONFIG_GNRC_RPL_DEFAULT_MIN_HOP_RANK_INCREASE (256) |
◆ CONFIG_GNRC_RPL_MSG_QUEUE_SIZE_EXP
#define CONFIG_GNRC_RPL_MSG_QUEUE_SIZE_EXP (3U) |
Default message queue size to use for the RPL thread (as exponent of 2^n).
As the queue size ALWAYS needs to be power of two, this option represents the exponent of 2^n, which will be used as the size of the queue.
Definition at line 189 of file rpl.h.
◆ DAGRANK
#define DAGRANK |
( |
|
rank, |
|
|
|
mhri |
|
) |
| (rank/mhri) |
◆ GNRC_RPL_ALL_NODES_ADDR
#define GNRC_RPL_ALL_NODES_ADDR {{ 0xff, 0x02, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0x1a }} |
Static initializer for the all-RPL-nodes multicast IPv6 address (ff02::1a)
- See also
- RFC 6550, section 6
Definition at line 207 of file rpl.h.
◆ GNRC_RPL_DEFAULT_PREFIX_LIFETIME
#define GNRC_RPL_DEFAULT_PREFIX_LIFETIME (0xFFFFFFFF) |
Default prefix valid and preferred time for the DODAG id.
- Note
- Currently not used, but needed for RIOs
- See also
- Route Information
Definition at line 378 of file rpl.h.
◆ GNRC_RPL_DIS_SOLICITED_INFO_LENGTH
#define GNRC_RPL_DIS_SOLICITED_INFO_LENGTH (19) |
◆ GNRC_RPL_GROUNDED
#define GNRC_RPL_GROUNDED (1) |
◆ GNRC_RPL_ICMPV6_CODE_DAO
#define GNRC_RPL_ICMPV6_CODE_DAO (0x02) |
◆ GNRC_RPL_ICMPV6_CODE_DAO_ACK
#define GNRC_RPL_ICMPV6_CODE_DAO_ACK (0x03) |
◆ GNRC_RPL_ICMPV6_CODE_DIO
#define GNRC_RPL_ICMPV6_CODE_DIO (0x01) |
◆ GNRC_RPL_ICMPV6_CODE_DIS
#define GNRC_RPL_ICMPV6_CODE_DIS (0x00) |
◆ GNRC_RPL_INFINITE_RANK
#define GNRC_RPL_INFINITE_RANK (0xFFFF) |
◆ gnrc_rpl_config_pio()
(De-)Activate the transmission of Prefix Information Options within DIOs for a particular DODAG.
This function has no effect if CONFIG_GNRC_RPL_WITHOUT_PIO is set.
- Parameters
-
[in] | dodag | Pointer to the DODAG |
[in] | status | true for activating PIOs and false for deactivating them |
Definition at line 732 of file rpl.h.
◆ gnrc_rpl_delay_dao()
Delay the DAO sending interval.
- Parameters
-
[in] | dodag | The DODAG of the DAO |
◆ gnrc_rpl_gen_instance_id()
uint8_t gnrc_rpl_gen_instance_id |
( |
bool |
local | ) |
|
Generate a local or global instance id.
- Parameters
-
[in] | local | flag to indicate whether a local or global instance id is requested |
- Returns
- Local instance id, if
local
is true
-
Global instance id, otherwise.
◆ gnrc_rpl_init()
Initialization of the RPL thread.
- Parameters
-
[in] | if_pid | PID of the interface |
- Returns
- The PID of the RPL thread, on success.
-
a negative errno on error.
◆ gnrc_rpl_long_delay_dao()
Long delay the DAO sending interval.
- Parameters
-
[in] | dodag | The DODAG of the DAO |
◆ gnrc_rpl_recv_DAO()
Parse a DAO.
- Parameters
-
[in] | dao | Pointer to the DAO message. |
[in] | iface | Interface PID of the incoming DIO. |
[in] | src | Pointer to the source address of the IPv6 packet. |
[in] | dst | Pointer to the destination address of the IPv6 packet. |
[in] | len | Length of the IPv6 packet. |
◆ gnrc_rpl_recv_DAO_ACK()
Parse a DAO-ACK.
- Parameters
-
[in] | dao_ack | Pointer to the DAO-ACK message. |
[in] | iface | Interface PID of the incoming DIO. |
[in] | src | Pointer to the source address of the IPv6 packet. |
[in] | dst | Pointer to the destination address of the IPv6 packet. |
[in] | len | Length of the IPv6 packet. |
◆ gnrc_rpl_recv_DIO()
Parse a DIO.
- Parameters
-
[in] | dio | Pointer to the DIO message. |
[in] | iface | Interface PID of the incoming DIO. |
[in] | src | Pointer to the source address of the IPv6 packet. |
[in] | dst | Pointer to the destination address of the IPv6 packet. |
[in] | len | Length of the IPv6 packet. |
◆ gnrc_rpl_recv_DIS()
Parse a DIS.
- Parameters
-
[in] | dis | Pointer to the DIS message. |
[in] | iface | Interface PID of the incoming DIS. |
[in] | src | Pointer to the source address of the IPv6 packet. |
[in] | dst | Pointer to the destination address of the IPv6 packet. |
[in] | len | Length of the IPv6 packet. |
◆ gnrc_rpl_root_init()
Initialization of a node as root.
- Parameters
-
[in] | instance_id | Id of the instance |
[in] | dodag_id | Id of the DODAG |
[in] | gen_inst_id | Flag indicating whether to generate an instance id. If true, instance_id will be ignored |
[in] | local_inst_id | Flag indicating whether a local or global instance id should be generatad |
- Returns
- Pointer to the new RPL Instance, on success.
-
NULL, otherwise.
◆ gnrc_rpl_root_instance_init()
Create a new RPL instance and RPL DODAG.
- Parameters
-
[in] | instance_id | Id of the instance |
[in] | dodag_id | Id of the DODAG |
[in] | mop | Mode of Operation |
- Returns
- Pointer to the new RPL instance, on success.
-
NULL, otherwise.
◆ gnrc_rpl_send()
Send a control message.
- Parameters
-
[in] | pkt | gnrc_pktnsip_t to send |
[in] | iface | Interface PID to send this pkt to |
[in] | src | Source address of the packet |
[in] | dst | Destination address of the packet |
[in] | dodag_id | Id of the DODAG |
◆ gnrc_rpl_send_DAO()
Send a DAO of the dodag
to the destination
.
- Parameters
-
[in] | instance | Pointer to the instance. |
[in] | destination | IPv6 address of the destination. |
[in] | lifetime | Lifetime of the route to announce. |
◆ gnrc_rpl_send_DAO_ACK()
Send a DAO-ACK of the instance
to the destination
.
- Parameters
-
[in] | instance | Pointer to the RPL instance. |
[in] | destination | IPv6 address of the destination. |
[in] | seq | Sequence number to be acknowledged. |
◆ gnrc_rpl_send_DIO()
Send a DIO of the instance
to the destination
.
- Parameters
-
[in] | instance | Pointer to the RPL instance. |
[in] | destination | IPv6 address of the destination. |
◆ gnrc_rpl_send_DIS()
Send a DIS of the instance
to the destination
.
- Parameters
-
[in] | instance | Pointer to the RPL instance, optional. |
[in] | destination | IPv6 address of the destination. |
[in] | options | Pointer to the first option to be attached. |
[in] | num_opts | The number of options to attach. |
◆ ipv6_addr_all_rpl_nodes