Internet Engineering Task Force (IETF) P. Thubert, Ed. Request for Comments: 8138 Cisco Category: Standards Track C. Bormann ISSN: 2070-1721 Uni Bremen TZI L. Toutain IMT Atlantique R. Cragie ARM April 2017 IPv6 over Low-Power Wireless Personal Area Network (6LoWPAN) Routing Header Abstract This specification introduces a new IPv6 over Low-Power Wireless Personal Area Network (6LoWPAN) dispatch type for use in 6LoWPAN route-over topologies, which initially covers the needs of Routing Protocol for Low-Power and Lossy Networks (RPL) data packet compression (RFC 6550). Using this dispatch type, this specification defines a method to compress the RPL Option (RFC 6553) information and Routing Header type 3 (RFC 6554), an efficient IP-in-IP technique, and is extensible for more applications. Status of This Memo This is an Internet Standards Track document. This document is a product of the Internet Engineering Task Force (IETF). It represents the consensus of the IETF community. It has received public review and has been approved for publication by the Internet Engineering Steering Group (IESG). Further information on Internet Standards is available in Section 2 of RFC 7841. Information about the current status of this document, any errata, and how to provide feedback on it may be obtained at http://www.rfc-editor.org/info/rfc8138.
Copyright Notice Copyright (c) 2017 IETF Trust and the persons identified as the document authors. All rights reserved. This document is subject to BCP 78 and the IETF Trust's Legal Provisions Relating to IETF Documents (http://trustee.ietf.org/license-info) in effect on the date of publication of this document. Please review these documents carefully, as they describe your rights and restrictions with respect to this document. Code Components extracted from this document must include Simplified BSD License text as described in Section 4.e of the Trust Legal Provisions and are provided without warranty as described in the Simplified BSD License.
Table of Contents 1. Introduction . . . . . . . . . . . . . . . . . . . . . . . . 4 2. Terminology . . . . . . . . . . . . . . . . . . . . . . . . . 7 3. Using the Page Dispatch . . . . . . . . . . . . . . . . . . . 7 3.1. New Routing Header Dispatch (6LoRH) . . . . . . . . . . . 7 3.2. Placement of 6LoRH Headers . . . . . . . . . . . . . . . 8 3.2.1. Relative to Non-6LoRH Headers . . . . . . . . . . . . 8 3.2.2. Relative to Other 6LoRH Headers . . . . . . . . . . . 8 4. 6LoWPAN Routing Header General Format . . . . . . . . . . . . 9 4.1. Elective Format . . . . . . . . . . . . . . . . . . . . . 10 4.2. Critical Format . . . . . . . . . . . . . . . . . . . . . 10 4.3. Compressing Addresses . . . . . . . . . . . . . . . . . . 11 4.3.1. Coalescence . . . . . . . . . . . . . . . . . . . . . 11 4.3.2. DODAG Root Address Determination . . . . . . . . . . 12 5. The SRH-6LoRH Header . . . . . . . . . . . . . . . . . . . . 13 5.1. Encoding . . . . . . . . . . . . . . . . . . . . . . . . 13 5.2. SRH-6LoRH General Operation . . . . . . . . . . . . . . . 14 5.2.1. Uncompressed SRH Operation . . . . . . . . . . . . . 14 5.2.2. 6LoRH-Compressed SRH Operation . . . . . . . . . . . 15 5.2.3. Inner LOWPAN_IPHC Compression . . . . . . . . . . . . 15 5.3. The Design Point of Popping Entries . . . . . . . . . . . 16 5.4. Compression Reference for SRH-6LoRH Header Entries . . . 17 5.5. Popping Headers . . . . . . . . . . . . . . . . . . . . . 18 5.6. Forwarding . . . . . . . . . . . . . . . . . . . . . . . 19 6. The RPL Packet Information 6LoRH (RPI-6LoRH) . . . . . . . . 19 6.1. Compressing the RPLInstanceID . . . . . . . . . . . . . . 21 6.2. Compressing the SenderRank . . . . . . . . . . . . . . . 21 6.3. The Overall RPI-6LoRH Encoding . . . . . . . . . . . . . 21 7. The IP-in-IP 6LoRH Header . . . . . . . . . . . . . . . . . . 24 8. Management Considerations . . . . . . . . . . . . . . . . . . 26 9. Security Considerations . . . . . . . . . . . . . . . . . . . 27 10. IANA Considerations . . . . . . . . . . . . . . . . . . . . . 27 10.1. Reserving Space in 6LoWPAN Dispatch Page 1 . . . . . . . 27 10.2. New Critical 6LoWPAN Routing Header Type Registry . . . 28 10.3. New Elective 6LoWPAN Routing Header Type Registry . . . 28 11. References . . . . . . . . . . . . . . . . . . . . . . . . . 28 11.1. Normative References . . . . . . . . . . . . . . . . . . 28 11.2. Informative References . . . . . . . . . . . . . . . . . 29 Appendix A. Examples . . . . . . . . . . . . . . . . . . . . . . 31 A.1. Examples Compressing the RPI . . . . . . . . . . . . . . 31 A.2. Example of a Downward Packet in Non-Storing Mode . . . . 32 A.3. Example of SRH-6LoRH Life Cycle . . . . . . . . . . . . . 34 Acknowledgements . . . . . . . . . . . . . . . . . . . . . . . . 36 Authors' Addresses . . . . . . . . . . . . . . . . . . . . . . . 37
1. Introduction The design of Low-Power and Lossy Networks (LLNs) is generally focused on saving energy, a very constrained resource in most cases. The other constraints, such as the memory capacity and the duty cycling of the LLN devices, derive from that primary concern. Energy is often available from primary batteries that are expected to last for years, or it is scavenged from the environment in very limited quantities. Any protocol that is intended for use in LLNs must be designed with the primary concern of saving energy as a strict requirement. Controlling the amount of data transmission is one possible venue to save energy. In a number of LLN standards, the frame size is limited to much smaller values than the guaranteed IPv6 Maximum Transmission Unit (MTU) of 1280 bytes. In particular, an LLN that relies on the classical Physical Layer (PHY) of IEEE 802.15.4 [IEEE.802.15.4] is limited to 127 bytes per frame. The need to compress IPv6 packets over IEEE 802.15.4 led to the writing of "Compression Format for IPv6 Datagrams over IEEE 802.15.4-Based Networks" [RFC6282]. Innovative route-over techniques have been and still are being developed for routing inside an LLN. Generally, such techniques require additional information in the packet to provide loop prevention and to indicate information such as flow identification, source routing information, etc. For reasons such as security and the capability to send ICMPv6 errors (see "Internet Control Message Protocol (ICMPv6) for the Internet Protocol Version 6 (IPv6) Specification" [RFC4443]) back to the source, an original packet must not be tampered with, and any information that must be inserted in or removed from an IPv6 packet must be placed in an extra IP-in-IP encapsulation. This is the case when the additional routing information is inserted by a router on the path of a packet, for instance, the root of a mesh, as opposed to the source node, with the Non-Storing mode of the "RPL: IPv6 Routing Protocol for Low-Power and Lossy Networks" [RFC6550]. This is also the case when some routing information must be removed from a packet that flows outside the LLN.
"When to use RFC 6553, RFC 6554 and IPv6-in-IPv6" [RPL-INFO] details different cases where IPv6 headers defined in the RPL Option for Carrying RPL Information in Data-Plane Datagrams [RFC6553], Header for Source Routes with RPL [RFC6554], and IPv6-in-IPv6 encapsulation, are inserted or removed from packets in LLN environments operating RPL. When using RFC 6282 [RFC6282], the outer IP header of an IP-in-IP encapsulation may be compressed down to 2 octets in stateless compression and down to 3 octets in stateful compression when context information must be added. 0 1 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 +---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+ | 0 | 1 | 1 | TF |NH | HLIM |CID|SAC| SAM | M |DAC| DAM | +---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+ Figure 1: LOWPAN_IPHC Base Encoding (RFC 6282) The stateless compression of an IPv6 address can only happen if the IPv6 address can de deduced from the Media Access Control (MAC) addresses, meaning that the IP endpoint is also the MAC-layer endpoint. This is usually not the case in a RPL network, which is generally a multi-hop route-over (i.e., operated at Layer 3) network. A better compression, which does not involve variable compressions depending on the hop in the mesh, can be achieved based on the fact that the outer encapsulation is usually between the source (or destination) of the inner packet and the root. Also, the inner IP header can only be compressed by RFC 6282 [RFC6282] if all the fields preceding it are also compressed. This specification makes the inner IP header the first header to be compressed by RFC 6282 [RFC6282], and it keeps the inner packet encoded the same way whether or not it is encapsulated, thus preserving existing implementations. As an example, RPL [RFC6550] is designed to optimize the routing operations in constrained LLNs. As part of this optimization, RPL requires the addition of RPL Packet Information (RPI) in every packet, as defined in Section 11.2 of RFC 6550 [RFC6550]. "The Routing Protocol for Low-Power and Lossy Networks (RPL) Option for Carrying RPL Information in Data-Plane Datagrams" [RFC6553] specification indicates how the RPI can be placed in a RPL Option (RPL-OPT) that is placed in an IPv6 Hop-by-Hop header. This representation demands a total of 8 bytes, while, in most cases, the actual RPI payload requires only 19 bits. Since the Hop-by-Hop header must not flow outside of the RPL domain, it must be inserted
in packets entering the domain and be removed from packets that leave the domain. In both cases, this operation implies an IP-in-IP encapsulation. Additionally, in the case of the Non-Storing Mode of Operation (MOP), RPL requires a Source Routing Header (SRH) in all packets that are routed down a RPL graph. For that purpose, "An IPv6 Routing Header for Source Routes with the Routing Protocol for Low-Power and Lossy Networks (RPL)" [RFC6554] defines the type 3 Routing Header for IPv6 (RH3). ------+--------- ^ | Internet | | | Native IPv6 +-----+ | | | Border Router (RPL Root) + | + | | | | | +-----+ | | | tunneled | | | | using o o o o | | | IPv6-in- o o o o o o o o o | | | IPv6 and o o o o o o o o o o | | | RPL SRH o o o o o o o o o | | | o o o o o o o o | | | o o o o + v + LLN Figure 2: IP-in-IP Encapsulation within the LLN With Non-Storing RPL, even if the source is a node in the same LLN, the packet must first reach up the graph to the root so that the root can insert the SRH to go down the graph. In any fashion, whether the packet was originated in a node in the LLN or outside the LLN, and regardless of whether or not the packet stays within the LLN, as long as the source of the packet is not the root itself, the source- routing operation also implies an IP-in-IP encapsulation at the root in order to insert the SRH. "An Architecture for IPv6 over the TSCH mode of IEEE 802.15.4" [IPv6-ARCH] specifies the operation of IPv6 over the mode of operation described in "Using IEEE 802.15.4e Time-Slotted Channel Hopping (TSCH) in the Internet of Things (IoT): Problem Statement" [RFC7554]. The architecture requires the use of both RPL and the 6lo adaptation layer over IEEE 802.15.4. Because it inherits the constraints on frame size from the MAC layer, 6TiSCH cannot afford to allocate 8 bytes per packet on the RPI, hence the requirement for 6LoWPAN header compression of the RPI.
An extensible compression technique is required that simplifies IP-in-IP encapsulation when it is needed and optimally compresses existing routing artifacts found in RPL LLNs. This specification extends the 6lo adaptation layer framework ([RFC4944] [RFC6282]) so as to carry routing information for route- over networks based on RPL. It includes the formats necessary for RPL and is extensible for additional formats. 2. Terminology The key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT", "SHOULD", "SHOULD NOT", "RECOMMENDED", "NOT RECOMMENDED", "MAY", and "OPTIONAL" in this document are to be interpreted as described in RFC 2119 [RFC2119]. This document uses the terms from, and is consistent with, "Terms Used in Routing for Low-Power and Lossy Networks" [RFC7102] and RPL [RFC6550]. The terms "route-over" and "mesh-under" are defined in RFC 6775 [RFC6775]. Other terms in use in LLNs are found in "Terminology for Constrained- Node Networks" [RFC7228]. The term "byte" is used in its now customary sense as a synonym for "octet". 3. Using the Page Dispatch The "IPv6 over Low-Power Wireless Personal Area Network (6LoWPAN) Paging Dispatch" [RFC8025] specification extends the 6lo adaptation layer framework ([RFC4944] [RFC6282]) by introducing a concept of "context" in the 6LoWPAN parser, a context being identified by a Page number. The specification defines 16 Pages. This document operates within Page 1, which is indicated by a dispatch value of binary 11110001. 3.1. New Routing Header Dispatch (6LoRH) This specification introduces a new 6LoWPAN Routing Header (6LoRH) to carry IPv6 routing information. The 6LoRH may contain source routing information such as a compressed form of SRH, as well as other sorts of routing information such as the RPI and IP-in-IP encapsulation.
The 6LoRH is expressed in a 6loWPAN packet as a Type-Length-Value (TLV) field, which is extensible for future use. It is expected that a router that does not recognize the 6LoRH general format detailed in Section 4 will drop the packet when a 6LoRH is present. This specification uses the bit pattern 10xxxxxx in Page 1 for the new 6LoRH Dispatch. Section 4 describes how RPL artifacts in data packets can be compressed as 6LoRH headers. 3.2. Placement of 6LoRH Headers 3.2.1. Relative to Non-6LoRH Headers In a zone of a packet where Page 1 is active (that is, once the Page 1 Paging Dispatch is parsed, and until another Paging Dispatch is parsed as described in the 6LoWPAN Paging Dispatch specification [RFC8025]), the parsing of the packet MUST follow this specification if the 6LoRH Bit Pattern (see Section 3.1) is found. With this specification, the 6LoRH Dispatch is only defined in Page 1, so it MUST be placed in the packet in a zone where the Page 1 context is active. Because a 6LoRH header requires a Page 1 context, it MUST always be placed after any Fragmentation Header and/or Mesh Header as defined in RFC 4944 [RFC4944]. A 6LoRH header MUST always be placed before the LOWPAN_IPHC as defined in RFC 6282 [RFC6282]. It is designed in such a fashion that placing or removing a header that is encoded with 6LoRH does not modify the part of the packet that is encoded with LOWPAN_IPHC, whether or not there is an IP-in-IP encapsulation. For instance, the final destination of the packet is always the one in the LOWPAN_IPHC, whether or not there is a Routing Header. 3.2.2. Relative to Other 6LoRH Headers The "Internet Protocol, Version 6 (IPv6) Specification" [RFC2460] defines chains of headers that are introduced by an IPv6 header and terminated by either another IPv6 header (IP-in-IP) or an Upper-Layer Protocol (ULP) header. When an outer header is stripped from the packet, the whole chain goes with it. When one or more headers are inserted by an intermediate router, that router normally chains the headers and encapsulates the result in IP-in-IP.
With this specification, the chains of headers MUST be compressed in the same order as they appear in the uncompressed form of the packet. This means that if there is more than one nested IP-in-IP encapsulation, the first IP-in-IP encapsulation, with all its chain of headers, is encoded first in the compressed form. In the compressed form of a packet that has a Source Route or a Hop- by-Hop (HbH) Options Header [RFC2460] after the inner IPv6 header (e.g., if there is no IP-in-IP encapsulation), these headers are placed in the 6LoRH form before the 6LOWPAN_IPHC that represents the IPv6 header (see Section 3.2.1). If this packet gets encapsulated and some other SRH or HbH Options Headers are added as part of the encapsulation, placing the 6LoRH headers next to one another may present an ambiguity on which header belongs to which chain in the uncompressed form. In order to disambiguate the headers that follow the inner IPv6 header in the uncompressed form from the headers that follow the outer IP-in-IP header, it is REQUIRED that the compressed IP-in-IP header is placed last in the encoded chain. This means that the 6LoRH headers that are found after the last compressed IP-in-IP header are to be inserted after the IPv6 header that is encoded with the 6LOWPAN_IPHC when decompressing the packet. With regard to the relative placement of the SRH and the RPI in the compressed form, it is a design point for this specification that the SRH entries are consumed as the packet progresses down the LLN (see Section 5.3). In order to make this operation simpler in the compressed form, it is REQUIRED that in the compressed form, the addresses along the source route path are encoded in the order of the path, and that the compressed SRH are placed before the compressed RPI. 4. 6LoWPAN Routing Header General Format The 6LoRH uses the Dispatch Value Bit Pattern of 10xxxxxx in Page 1. The Dispatch Value Bit Pattern is split in two forms of 6LoRH: Elective (6LoRHE), which may skipped if not understood Critical (6LoRHC), which may not be ignored For each form, a Type field is used to encode the type of 6LoRH. Note that there is a different registry for the Type field of each form of 6LoRH.
This means that a value for the Type that is defined for one form of 6LoRH may be redefined in the future for the other form. 4.1. Elective Format The 6LoRHE uses the Dispatch Value Bit Pattern of 101xxxxx. A 6LoRHE may be ignored and skipped in parsing. If it is ignored, the 6LoRHE is forwarded with no change inside the LLN. 0 1 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+- ... -+ |1|0|1| Length | Type | | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+- ... -+ <-- Length --> Figure 3: Elective 6LoWPAN Routing Header Length: Length of the 6LoRHE expressed in bytes, excluding the first 2 bytes. This enables a node to skip a 6LoRHE header that it does not support and/or cannot parse, for instance, if the Type is not recognized. Type: Type of the 6LoRHE 4.2. Critical Format The 6LoRHC uses the Dispatch Value Bit Pattern of 100xxxxx. A node that does not support the 6LoRHC Type MUST silently discard the packet. Note: A situation where a node receives a message with a Critical 6LoWPAN Routing Header that it does not understand should not occur and is an administrative error, see Section 8. 0 1 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+- ... -+ |1|0|0| TSE | Type | | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+- ... -+ <-- Length implied by Type/TSE --> Figure 4: Critical 6LoWPAN Routing Header
Type-Specific Extension (TSE): The meaning depends on the Type, which must be known in all of the nodes. The interpretation of the TSE depends on the Type field that follows. For instance, it may be used to transport control bits, the number of elements in an array, or the length of the remainder of the 6LoRHC expressed in a unit other than bytes. Type: Type of the 6LoRHC 4.3. Compressing Addresses The general technique used in this document to compress an address is first to determine a reference that has a long prefix match with this address and then elide that matching piece. In order to reconstruct the compressed address, the receiving node will perform the process of coalescence described in Section 4.3.1. One possible reference is the root of the RPL Destination-Oriented Directed Acyclic Graph (DODAG) that is being traversed. It is used by 6LoRH as the reference to compress an outer IP header in case of an IP-in-IP encapsulation. If the root is the source of the packet, this technique allows one to fully elide the source address in the compressed form of the IP header. If the root is not the encapsulator, then the Encapsulator Address may still be compressed using the root as a reference. How the address of the root is determined is discussed in Section 4.3.2. Once the address of the source of the packet is determined, it becomes the reference for the compression of the addresses that are located in compressed SRH headers that are present inside the IP-in- IP encapsulation in the uncompressed form. 4.3.1. Coalescence An IPv6 compressed address is coalesced with a reference address by overriding the N rightmost bytes of the reference address with the compressed address, where N is the length of the compressed address, as indicated by the Type of the SRH-6LoRH header in Figure 7. The reference address MAY be a compressed address as well, in which case, it MUST be compressed in a form that is of an equal or greater length than the address that is being coalesced. A compressed address is expanded by coalescing it with a reference address. In the particular case of a Type 4 SRH-6LoRH, the address is expressed in full and the coalescence is a complete override as illustrated in Figure 5.
RRRRRRRRRRRRRRRRRRR A reference address, which may be compressed or not CCCCCCC A compressed address, which may be shorter or the same as the reference RRRRRRRRRRRRCCCCCCC A coalesced address, which may be the same compression as the reference Figure 5: Coalescing Addresses 4.3.2. DODAG Root Address Determination Stateful address compression requires that some state is installed in the devices to store the compression information that is elided from the packet. That state is stored in an abstract context table, and some form of index is found in the packet to obtain the compression information from the context table. With RFC 6282 [RFC6282], the state is provided to the stack by the 6LoWPAN Neighbor Discovery Protocol (NDP) [RFC6775]. NDP exchanges the context through the 6LoWPAN Context Option in Router Advertisement (RA) messages. In the compressed form of the packet, the context can be signaled in a Context Identifier Extension. With this specification, the compression information is provided to the stack by RPL, and RPL exchanges it through the DODAGID field in the DAG Information Object (DIO) messages, as described in more detail below. In the compressed form of the packet, the context can be signaled by the RPLInstanceID in the RPI. With RPL [RFC6550], the address of the DODAG root is known from the DODAGID field of the DIO messages. For a Global Instance, the RPLInstanceID that is present in the RPI is enough information to identify the DODAG that this node participates with and its associated root. But, for a Local Instance, the address of the root MUST be explicit, either in some device configuration or signaled in the packet, as the source or the destination address, respectively. When implicit, the address of the DODAG root MUST be determined as follows: If the whole network is a single DODAG, then the root can be well- known and does not need to be signaled in the packets. But, since RPL does not expose that property, it can only be known by a configuration applied to all nodes.
Else, the router that encapsulates the packet and compresses it with this specification MUST also place an RPI in the packet as prescribed by RPL to enable the identification of the DODAG. The RPI must be present even in the case when the router also places an SRH header in the packet. It is expected that the RPL implementation maintains an abstract context table, indexed by Global RPLInstanceID, that provides the address of the root of the DODAG that this node participates in for that particular RPL Instance. 5. The SRH-6LoRH Header 5.1. Encoding A Source Routing Header 6LoRH (SRH-6LoRH) provides a compressed form for the SRH, as defined in RFC 6554 [RFC6554], for use by RPL routers. One or more SRH-6LoRH header(s) MAY be placed in a 6LoWPAN packet. If a non-RPL router receives a packet with an SRH-6LoRH header, there was a routing or a configuration error (see Section 8). The desired reaction for the non-RPL router is to drop the packet, as opposed to skipping the header and forwarding the packet. The Dispatch Value Bit Pattern for the SRH-6LoRH header indicates it is Critical. Routers that understand the 6LoRH general format detailed in Section 4 cannot ignore a 6LoRH header of this type and will drop the packet if it is unknown to them. 0 1 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+- -+- -+ ... +- -+ |1|0|0| Size |6LoRH Type 0..4| Hop1 | Hop2 | | HopN | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+- -+- -+ ... +- -+ Where N = Size + 1 Figure 6: The SRH-6LoRH The 6LoRH Type of an SRH-6LoRH header indicates the compression level used for that header. The fields following the 6LoRH Type are compressed addresses indicating the consecutive hops and are ordered from the first to the last hop.
All the addresses in a given SRH-6LoRH header MUST be compressed in an identical fashion, so the Length of the compressed form is the same for all. In order to get different degrees of compression, multiple consecutive SRH-6LoRH headers MUST be used. Type 0 means that the address is compressed down to one byte, whereas Type 4 means that the address is provided in full in the SRH-6LoRH with no compression. The complete list of Types of SRH-6LoRH and the corresponding compression level are provided in Figure 7: +-----------+----------------------+ | 6LoRH | Length of compressed | | Type | IPv6 address (bytes) | +-----------+----------------------+ | 0 | 1 | | 1 | 2 | | 2 | 4 | | 3 | 8 | | 4 | 16 | +-----------+----------------------+ Figure 7: The SRH-6LoRH Types In the case of an SRH-6LoRH header, the TSE field is used as a Size, which encodes the number of hops minus 1; so a Size of 0 means one hop, and the maximum that can be encoded is 32 hops. (If more than 32 hops need to be expressed, a sequence of SRH-6LoRH elements can be employed.) The result is that the Length, in bytes, of an SRH-6LoRH header is: 2 + Length_of_compressed_IPv6_address * (Size + 1) 5.2. SRH-6LoRH General Operation 5.2.1. Uncompressed SRH Operation In the uncompressed form, when the root generates or forwards a packet in Non-Storing mode, it needs to include a Source Routing Header [RFC6554] to signal a strict source route path to a final destination down the DODAG. All the hops along the path, except the first one, are encoded in order in the SRH. The last entry in the SRH is the final destination; the destination in the IPv6 header is the first hop along the source route path. The intermediate hops perform a swap
and the Segments Left field indicates the active entry in the Routing Header [RFC2460]. The current destination of the packet, which is the termination of the current segment, is indicated at all times by the destination address of the IPv6 header. 5.2.2. 6LoRH-Compressed SRH Operation The handling of the SRH-6LoRH is different: there is no swap, and a forwarding router that corresponds to the first entry in the first SRH-6LoRH, upon reception of a packet, effectively consumes that entry when forwarding. This means that the size of a compressed source-routed packet decreases as the packet progresses along its path and that the routing information is lost along the way. This also means that an SRH encoded with 6LoRH is not recoverable and cannot be protected. When compressed with this specification, all the remaining hops MUST be encoded in order in one or more consecutive SRH-6LoRH headers. Whether or not there is an SRH-6LoRH header present, the address of the final destination is indicated in the LOWPAN_IPHC at all times along the path. Examples of this are provided in Appendix A. The current destination (termination of the current segment) for a compressed source-routed packet is indicated in the first entry of the first SRH-6LoRH. In strict source routing, that entry MUST match an address of the router that receives the packet. The last entry in the last SRH-6LoRH is the last router on the way to the final destination in the LLN. This router can be the final destination if it is found desirable to carry a whole IP-in-IP encapsulation all the way. Else, it is the RPL parent of the final destination, or a router acting at 6LoWPAN Router (6LR) [RFC6775] for the destination host, and it is advertising the host as an external route to RPL. If the SRH-6LoRH header is contained in an IP-in-IP encapsulation, the last router removes the whole chain of headers. Otherwise, it removes the SRH-6LoRH header only. 5.2.3. Inner LOWPAN_IPHC Compression 6LoWPAN ND [RFC6282] is designed to support more than one IPv6 address per node and per Interface Identifier (IID); an IID is typically derived from a MAC address to optimize the LOWPAN_IPHC compression.
Link-local addresses are compressed with stateless address compression (S/DAC=0). The other addresses are derived from different prefixes, and they can be compressed with stateful address compression based on a context (S/DAC=1). But, stateless compression is only defined for the specific link- local prefix as opposed to the prefix in an encapsulating header. And with stateful compression, the compression reference is found in a context, as opposed to an encapsulating header. The result is that, in the case of an IP-in-IP encapsulation, it is possible to compress an inner source (respective destination) IP address in a LOWPAN_IPHC based on the encapsulating IP header only if stateful (context-based) compression is used. The compression will operate only if the IID in the source (respective destination) IP address in the outer and inner headers match, which usually means that they refer to the same node. This is encoded as S/DAC = 1 and S/AM=11. It must be noted that the outer destination address that is used to compress the inner destination address is the last entry in the last SRH-6LoRH header. 5.3. The Design Point of Popping Entries In order to save energy and to optimize the chances of transmission success on lossy media, it is a design point for this specification that the entries in the SRH that have been used are removed from the packet. This creates a discrepancy from the art of IPv6, where Routing Headers are mutable but recoverable. With this specification, the packet can be expanded at any hop into a valid IPv6 packet, including an SRH, and compressed back. But the packet, as decompressed along the way, will not carry all the consumed addresses that packet would have if it had been forwarded in the uncompressed form. It is noted that: The value of keeping the whole RH in an IPv6 header is for the receiver to reverse it to use the symmetrical path on the way back. It is generally not a good idea to reverse a Routing Header. The RH may have been used to stay away from the shortest path for some reason that is only valid on the way in (segment routing). There is no use in reversing an RH in the present RPL specifications.
Point-to-Point (P2P) RPL reverses a path that was learned reactively as a part of the protocol operation, which is probably a cleaner way than a reversed echo on the data path. Reversing a header is discouraged (by RFC 2460 [RFC2460]) for Redirected Header Option (RHO) unless it is authenticated, which requires an Authentication Header (AH). There is no definition of an AH operation for SRH, and there is no indication that the need exists in LLNs. AH does not protect the RH on the way. AH is a validation at the receiver with the sole value of enabling the receiver to reverse it. A RPL domain is usually protected by L2 security, which secures both RPL itself and the RH in the packets at every hop. This is a better security than that provided by AH. In summary, the benefit of saving energy and lowering the chances of loss by sending smaller frames over the LLN are seen as overwhelming compared to the value of possibly reversing the header. 5.4. Compression Reference for SRH-6LoRH Header Entries In order to optimize the compression of IP addresses present in the SRH headers, this specification requires that the 6LoWPAN layer identifies an address that is used as a reference for the compression. With this specification, the Compression Reference for the first address found in an SRH header is the source of the IPv6 packet, and then the reference for each subsequent entry is the address of its predecessor once it is uncompressed. With RPL [RFC6550], an SRH header may only be present in Non-Storing mode, and it may only be placed in the packet by the root of the DODAG, which must be the source of the resulting IPv6 packet [RFC2460]. In this case, the address used as Compression Reference is the address of the root. The Compression Reference MUST be determined as follows: The reference address may be obtained by configuration. The configuration may indicate either the address in full or the identifier of a 6LoWPAN Context that carries the address [RFC6775], for instance, one of the 16 Context Identifiers used in LOWPAN_IPHC [RFC6282].
Else, if there is no IP-in-IP encapsulation, the source address in the IPv6 header that is compressed with LOWPAN_IPHC is the reference for the compression. Else, if the IP-in-IP compression specified in this document is used and the Encapsulator Address is provided, then the Encapsulator Address is the reference. Else, meaning that the IP-in-IP compression specified in this document is used and the encapsulator is implicitly the root, the address of the root is the reference. 5.5. Popping Headers Upon reception, the router checks whether the address in the first entry of the first SRH-6LoRH is one of its own addresses. If that is the case, the router MUST consume that entry before forwarding, which is an action of popping from a stack, where the stack is effectively the sequence of entries in consecutive SRH-6LoRH headers. Popping an entry of an SRH-6LoRH header is a recursive action performed as follows: If the Size of the current SRH-6LoRH header is 1 or more (indicating that there are at least 2 entries in the header), the router removes the first entry and decrements the Size by 1. If the Size of the current SRH-6LoRH header is 0 (indicating that there is only 1 entry in the header) and there is no subsequent SRH-6LoRH after this, then the current SRH-6LoRH is removed. If the Size of the current SRH-6LoRH header is 0 and there is a subsequent SRH-6LoRH and the Type of the subsequent SRH-6LoRH is equal to or greater than the Type of the current SRH-6LoRH header (indicating the same or lesser compression yielding the same or larger compressed forms), then the current SRH-6LoRH is removed. If the Size of the current SRH-6LoRH header is 0 and there is a subsequent SRH-6LoRH and the Type of the subsequent SRH-6LoRH is less the Type of the current SRH-6LoRH header, the first entry of the subsequent SRH-6LoRH is removed and coalesced with the first entry of the current SRH-6LoRH. At the end of the process, if there are no more SRH-6LoRH in the packet, then the processing node is the last router along the source route path. An example of this operation is provided in Appendix A.3.
5.6. Forwarding When receiving a packet with an SRH-6LoRH, a router determines the IPv6 address of the current segment endpoint. If strict source routing is enforced and this router is not the segment endpoint for the packet, then this router MUST drop the packet. If this router is the current segment endpoint, then the router pops its address as described in Section 5.5 and continues processing the packet. If there is still an SRH-6LoRH, then the router determines the new segment endpoint and routes the packet towards that endpoint. Otherwise, the router uses the destination in the inner IP header to forward or accept the packet. The segment endpoint of a packet MUST be determined as follows: The router first determines the Compression Reference as discussed in Section 4.3.1. The router then coalesces the Compression Reference with the first entry of the first SRH-6LoRH header as discussed in Section 5.4. If the SRH-6LoRH header is Type 4, then the coalescence is a full override. Since the Compression Reference is an uncompressed address, the coalesced IPv6 address is also expressed in the full 128 bits.