## 4 A Routing Protocol for LLNs (RPL)
### RPL Overview  
An RPL [1] is explicitly designed to meet the requirements of LLNs, thus satisfying the five criteria mentioned in Section 3.3. Hence, RPL takes into account the limitations in terms of memory size, processing capability, and energy and performs within these constraints. RPL belongs to the DVRP category, which reduces the amount of topology information needed to perform the routing services compared to LSRPs. RPL organises the network topology as a Directed Acyclic Graph (DAG) oriented toward one or more nodes, i.e., DAG root, which acts as a sink. A DAG is divided into Destination-Oriented DAGs (DODAGs) per sink. The DODAG provides multiple forwarding paths towards the root via the so-called parent nodes. Each node in a DODAG selects a next hop node, i.e., parent node, to form a path connecting to the root node [75]. A set of one or more DODAGs creates an RPL Instance and shares the same unique identifier, RPLInstanceID. An example of an RPL Instance comprising two DODAGs with two different DODAG roots, R1 and R2, is shown in Figure 4.  
To create and maintain DODAGs, RPL uses four types of control packets: (i) DODAG information object (DIO), (ii) DODAG information solicitation (DIS), (iii) destination advertisement object (DAO), and (iv) DAO acknowledgement (DAO-ACK) [76]. The four types of RPL control packets are illustrated in Figure 5. A DIS message allows new nodes to request DIO packets from neighbour nodes. A DIO message is considered the primary source of routing control information in an RPL. It contains essential information such as RPLInstanceID, node Rank, and routing metrics, which allows nodes to discover an RPL Instance, select a parent node, and maintain a DODAG. A DAO message is used to propagate destination information upward along the DODAG. Furthermore, nodes send a  
Figure 4: RPL instance comprising two DODAGs. \begin{table}
\begin{tabular}{c c} \hline \hline
**Link-State Protocols** & **Distance Vector Protocols** \\ \hline Uses Dijkstra algorithm & Uses Bellman Ford algorithm \\ Based on link cost & Based on hop count \\ Triggered updates & Periodic updates \\ View whole network map & View from neighbour’s view \\ Send only the changes in the updates & Send entire routing table in the updates \\ \hline \hline \end{tabular}
\end{table} 
Table 3: Link-state Protocols vs. distance victor protocols. DAO-ACK as a response to receiving a DAO message. All RPL control packets are defined based on the Internet Control Message Protocol (ICMPv6) [77]. RPL provides a rank-based data-path technique to detect and repair loops when they occur in the network. This technique avoids routing loops by giving a rank for each node related to its position in the DODAG. As shown in Figure 6, a node with a high rank represents a far away node from the root, while a node with a low rank represents a close node to the root. Thus, packets are transmitted from the high-rank nodes toward the low-rank nodes until they reach the root. In other words, RPL does not prevent loops from happening but (i) tries to ensure that packets are transmitted forward to the root and (ii) triggers repairs as soon as possible when necessary [78]. In the case of link failure, RPL fixes links on-demand for the actively used links; thus, it reduces control overhead and avoids wasting energy in repairing unused paths [79]. Moreover, RPL uses an objective function to define how nodes select the best path toward the DODAG root within an RPL instance. The selection of parent nodes is based on different routing metrics, i.e., link and node metrics [80]. Thus, RPL separates packet processing and forwarding functions from the path-finding function. This separation of functions allows new objective functions to be plugged into RPL without altering other functions of RPL. The IETF presents two main objective functions for RPL: (i) objective function zero (OF0) [81, 82, 83, 84] and (ii) minimum rank with hysteresis objective function (MRHOF) [85, 86, 87]. Both of these objective functions are based on a single routing metric.