lpwan Working Group A. Minaburo Internet-Draft Acklio Intended status: Informational L. Toutain Expires:June 25,September 1, 2018 IMT-Atlantique C. Gomez Universitat Politecnica de CatalunyaDecember 22, 2017February 28, 2018 LPWAN Static Context Header Compression (SCHC) and fragmentation for IPv6 and UDPdraft-ietf-lpwan-ipv6-static-context-hc-09draft-ietf-lpwan-ipv6-static-context-hc-10 Abstract This documentdescribes adefines the Static Context Header Compression (SCHC) framework, which provides header compressionschemeand fragmentationfunctionality for very low bandwidth networks. These techniques are speciallyfunctionality. SCHC has been tailored for Low Power Wide AreaNetworkNetworks (LPWAN).The Static Context Header Compression (SCHC) offers a great level of flexibility when processing the header fields.SCHC compression is based on a common static context stored inaLPWANdevicedevices and in the network.Static context means that the stored information does not change during packet transmission. The context describes the field values and keeps information that will not be transmitted through the constrained network. SCHC must be used for LPWAN networks because it avoids complex resynchronization mechanisms, which are incompatible with LPWAN characteristics. And also, because with SCHC, in most cases IPv6/UDP headers can be reduced to a small identifier called Rule ID. Even though, sometimes, a SCHC compressed packet will not fit in one L2 PDU, and the SCHC fragmentation protocol defined in this document may be used.This documentdescribes the SCHC compression/decompression framework andappliesitSCHC compression to IPv6/UDP headers. This document also specifies a fragmentation and reassembly mechanism that is used to support the IPv6 MTU requirement over LPWAN technologies. Fragmentation is mandatory for IPv6 datagrams that, after SCHC compression or when it has not been possible to apply such compression, still exceed theL2layer two maximum payload size.Similar solutions for other protocols such as CoAPThe SCHC header compression mechanism is independent of the specific LPWAN technology over which it will bedescribedused. Note that this document defines generic functionality. This document purposefully offers flexibility with regard to parameter settings and mechanism choices, that are expected to be made inseparateother, technology-specific, documents. Status of This Memo This Internet-Draft is submitted in full conformance with the provisions of BCP 78 and BCP 79. Internet-Drafts are working documents of the Internet Engineering Task Force (IETF). Note that other groups may also distribute working documents as Internet-Drafts. The list of current Internet- Drafts is at https://datatracker.ietf.org/drafts/current/. Internet-Drafts are draft documents valid for a maximum of six months and may be updated, replaced, or obsoleted by other documents at any time. It is inappropriate to use Internet-Drafts as reference material or to cite them other than as "work in progress." This Internet-Draft will expire onJune 25,September 1, 2018. Copyright Notice Copyright (c)20172018 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 (https://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 . . . . . . . . . . . . . . . . . . . . . . . .43 2. LPWAN Architecture . . . . . . . . . . . . . . . . . . . . . 4 3. Terminology . . . . . . . . . . . . . . . . . . . . . . . . . 5 4.Static Context Header CompressionSCHC overview . . . . . . . . . . . . . . . .7 4.1. SCHC Rules. . . . . . . . 8 5. Rule ID . . . . . . . . . . . . . . . .8 4.2. Rule ID. . . . . . . . . . . 9 6. Static Context Header Compression . . . . . . . . . . . . . . 104.3.6.1. SCHC C/D Rules . . . . . . . . . . . . . . . . . . . . . 11 6.2. Rule ID for SCHC C/D . . . . . . . . . . . . . . . . . . 13 6.3. Packet processing . . . . . . . . . . . . . . . . . . . .10 4.4.13 6.4. Matching operators . . . . . . . . . . . . . . . . . . .12 4.5.15 6.5. Compression Decompression Actions (CDA) . . . . . . . . .12 4.5.1.16 6.5.1. not-sent CDA . . . . . . . . . . . . . . . . . . . .13 4.5.2.17 6.5.2. value-sent CDA . . . . . . . . . . . . . . . . . . .13 4.5.3.17 6.5.3. mapping-sent CDA . . . . . . . . . . . . . . . . . .. . 14 4.5.4. LSB17 6.5.4. LSB(y) CDA . . . . . . . . . . . . . . . . . . . . .. . 14 4.5.5.18 6.5.5. DEViid, APPiid CDA . . . . . . . . . . . . . . . . .14 4.5.6.18 6.5.6. Compute-* . . . . . . . . . . . . . . . . . . . . . .14 5.18 7. Fragmentation . . . . . . . . . . . . . . . . . . . . . . . .15 5.1.19 7.1. Overview . . . . . . . . . . . . . . . . . . . . . . . .15 5.2. Functionalities19 7.2. Fragmentation Tools . . . . . . . . . . . . . . . . . . . 19 7.3. Reliability modes . . . .15 5.3. Delivery Reliability options. . . . . . . . . . . . . .18 5.4.. . 22 7.4. FragmentationFrameFormats . . . . . . . . . . . . . . .20 5.4.1.. . . 24 7.4.1. Fragment format . . . . . . . . . . . . . . . . . . .20 5.4.2. ACK format24 7.4.2. All-1 and All-0 formats . . . . . . . . . . . . . . . 25 7.4.3. ACK format . . . . . .21 5.4.3. All-1 and All-0 formats. . . . . . . . . . . . . . .21 5.4.4.26 7.4.4. Abort formats . . . . . . . . . . . . . . . . . . . .23 5.5.29 7.5. Baseline mechanism . . . . . . . . . . . . . . . . . . .23 5.5.1. No ACK30 7.5.1. No-ACK . . . . . . . . . . . . . . . . . . . . . . .24 5.5.2. The Window modes31 7.5.2. ACK-Always . . . . . . . . . . . . . . . . . .25 5.5.3. Bitmap Optimization. . . 32 7.5.3. ACK-on-Error . . . . . . . . . . . . . .29 5.6.. . . . . . 34 7.6. Supporting multiple window sizes . . . . . . . . . . . .31 5.7.36 7.7. Downlink SCHC fragment transmission . . . . . . . . . . .. . 31 6.36 8. Padding management . . . . . . . . . . . . . . . . . . . . .32 7.37 9. SCHC Compression for IPv6 and UDP headers . . . . . . . . . .33 7.1.38 9.1. IPv6 version field . . . . . . . . . . . . . . . . . . .33 7.2.38 9.2. IPv6 Traffic class field . . . . . . . . . . . . . . . .33 7.3.38 9.3. Flow label field . . . . . . . . . . . . . . . . . . . .33 7.4.38 9.4. Payload Length field . . . . . . . . . . . . . . . . . .34 7.5.39 9.5. Next Header field . . . . . . . . . . . . . . . . . . . .34 7.6.39 9.6. Hop Limit field . . . . . . . . . . . . . . . . . . . . .34 7.7.39 9.7. IPv6 addresses fields . . . . . . . . . . . . . . . . . .35 7.7.1.39 9.7.1. IPv6 source and destination prefixes . . . . . . . .35 7.7.2.40 9.7.2. IPv6 source and destination IID . . . . . . . . . . .35 7.8.40 9.8. IPv6 extensions . . . . . . . . . . . . . . . . . . . . .36 7.9.41 9.9. UDP source and destination port . . . . . . . . . . . . .36 7.10.41 9.10. UDP length field . . . . . . . . . . . . . . . . . . . .36 7.11.41 9.11. UDP Checksum field . . . . . . . . . . . . . . . . . . .37 8.41 10. Security considerations . . . . . . . . . . . . . . . . . . .37 8.1.42 10.1. Security considerations for header compression . . . . .37 8.2.42 10.2. Security considerations for SCHC fragmentation . . . . .. . . 37 9.42 11. Acknowledgements . . . . . . . . . . . . . . . . . . . . . .38 10.43 12. References . . . . . . . . . . . . . . . . . . . . . . . . .38 10.1.43 12.1. Normative References . . . . . . . . . . . . . . . . . .38 10.2.43 12.2. Informative References . . . . . . . . . . . . . . . . .3944 Appendix A. SCHC Compression Examples . . . . . . . . . . . . .3944 Appendix B. Fragmentation Examples . . . . . . . . . . . . . . .4247 Appendix C. Fragmentation State Machines . . . . . . . . . . . .4853 Appendix D.Allocation of Rule IDs for fragmentation . . . . . . 55 Appendix E.Note . . . . . . . . . . . . . . . . . . . . . . . .5560 Authors' Addresses . . . . . . . . . . . . . . . . . . . . . . .5560 1. Introduction This document defines a header compression scheme and fragmentation functionality, both specially tailored for Low Power Wide Area Networks (LPWAN). Header compression ismandatoryneeded to efficiently bring Internet connectivity to the node withinaan LPWAN network. Some LPWAN networks properties can be exploited to get an efficient header compression: oTopologyThe topology isstar-oriented; therefore,star-oriented which means that allthepackets follow the same path. For theneedsnecessity of this draft, the architecturecan be summarized tois simple and is described as Devices (Dev) exchanging information with LPWAN ApplicationServerServers (App) throughaNetworkGatewayGateways (NGW). oTrafficThe traffic flowsare mostlycan be known in advance since devices embed built-in applications.Contrary to computers or smartphones, newNew applications cannot be easilyinstalled.installed in LPWAN devices, as they would in computers or smartphones. The Static Context Header Compression (SCHC) is defined for this environment. SCHC uses acontextcontext, where header information is kept in the header format order. This context isstatic (thestatic: the values of the header fields do not change overtime) avoidingtime. This avoids complex resynchronization mechanisms, that would be incompatible with LPWAN characteristics. In mostof thecases,IPv6/UDP headers are reduced toa small contextidentifier.identifier is enough to represent the full IPv6/UDP headers. The SCHC header compression mechanism is independent of the specific LPWAN technology over which itwill beis used. LPWAN technologies impose some strict limitations on traffic. For instance, devices are sleeping most of the time and MAY receive data during short periods of time after transmission to preserve battery. LPWAN technologies are also characterized, among others, by a very reduced data unit and/or payload size [I-D.ietf-lpwan-overview]. However, some of these technologies do notsupport layer two fragmentation,provide fragmentation functionality, therefore the only option for them to support the IPv6 MTU requirement of 1280 bytes [RFC2460] istheto useofa fragmentation protocol at the adaptationlayerlayer, below IPv6.This draft definesIn response to this need, this document also defines afragmentation functionality to supportfragmentation/reassembly mechanism, which supports the IPv6 MTU requirement over LPWAN technologies. Such functionality has been designed under the assumption that data unitreorderingout-of-sequence delivery will not happen between the entity performing fragmentation and the entity performing reassembly. Note that this document defines generic functionality and purposefully offers flexibility with regard to parameter settings and mechanism choices, that are expected to be made in other, technology- specific documents. 2. LPWAN Architecture LPWAN technologies have similar network architectures but different terminology. We can identify different types of entities in a typical LPWAN network, see Figure 1: o Devices (Dev) are the end-devices or hosts (e.g. sensors, actuators, etc.). There can be a very high density of devices per radio gateway. o The Radio Gateway (RGW), which is the end point of the constrained link. o The Network Gateway (NGW) is the interconnection node between the Radio Gateway and the Internet. o LPWAN-AAA Server, which controls the user authentication and the applications. o Application Server (App) +------+ () () () | |LPWAN-| () () () () / \ +---------+ | AAA | () () () () () () /\=====|\======| ^ |===|Server| +-----------+ () () () | | <--|--> | +------+ |APPLICATION| () () () () / \==========| v |=============| (App) | () () () / \ +---------+ +-----------+ Dev Radio Gateways NGW Figure 1: LPWAN Architecture 3. Terminology This section defines the terminology and acronyms used in this document. o Abort. A SCHC fragment format to signal the other end-point that the on-going fragment transmission is stopped and finished. o ACK (Acknowledgment). A SCHC fragment format used to report the success or unsuccess reception of a set of SCHC fragments. o All-0.FragmentThe SCHC fragment format for the last frame of awindow.window that is not the last one of a packet (see Window in this glossary). o All-1.FragmentThe SCHC fragment format for the last frame ofathe packet. o All-0 empty.Fragment formatAn All-0 SCHC fragment withoutpayload for requestinga payload. It is used to request the ACK with the encoded Bitmap when the Retransmission Timerexpiresexpires, in a window that is not the last oneforof afragmented packet transmission.packet. o All-1 empty.Fragment formatAn All-1 SCHC fragment withoutpayload for requestinga payload. It is used to request the ACK with the encoded Bitmap when the Retransmission Timer expires in the lastwindow.window of a packet. o App: LPWAN Application. An application sending/receiving IPv6 packets to/from the Device. o APP-IID: Application Interface Identifier. Second part of the IPv6 addressto identifythat identifies the applicationinterfaceserver interface. o Bi: Bidirectional, a rule entry that applies to headers of packets travelling in bothdirections.directions (Up and Dw). o Bitmap: a field of bits in an acknowledgment message that tells the sender which SCHC fragments of a window were correctly received. o C: Checked bit. Used in an acknowledgment (ACK) header to determinewhenif the MICis correctlocally computed by the receiver matches (1) the received MIC or not (0). o CDA: Compression/Decompression Action.An actionDescribes the reciprocal pair of actions thatisare performedfor both functionalitiesat the compressor to compress a header fieldorand at the decompressor to recoveritsthe originalvalue inheader field value. o Compress Residue. The bytes that need to be sent after applying thedecompression phase.SCHC compression over each header field o Context: A set of rules used to compress/decompressheadersheaders. o Dev: Device. ANodenode connected to the LPWAN. A DevmaySHOULD implement SCHC. o Dev-IID: Device Interface Identifier. Second part of the IPv6 addressto identifythat identifies the deviceinterfaceinterface. o DI: DirectionIndicator isIndicator. This field tells which direction of packet travel (Up, Dw or Bi) adifferentiator for matching in order to be able to have different valuesrule applies to. This allows forboth sides.assymmetric processing. o DTag: DatagramTag is aTag. This SCHC fragmentation header fieldthatis set to the same value for all SCHC fragments carrying the same IPv6 datagram. o Dw:Down LinkDw: Downlink direction forcompression,compression/decompression in both sides, from SCHC C/D in the network toDevSCHC C/D in the Dev. o FCN: Fragment CompressedNumber is aNumber. This SCHC fragmentation header fieldthatcarries an efficient representation of a larger-sized fragment number. o Field Description. A line in the Rule Table. o FID: FieldIdentifierIdentifier. This is an index to describe the header fields inthe Rulea Rule. o FL: Field Length isa value to identify ifthe length of the fieldisin bits for fixed values orvariable length.a type (variable, token length, ...) for length unknown at the rule creation. The length of a header field is defined in the specific protocol standard. o FP: Field Position is a value that is used to identify the position where each instance of a field appears in the header. o SCHC Fragment: A data unit that carries a subset of a SCHC packet. SCHC Fragmentation is needed when the size of a SCHC packet exceeds the available payload size of the underlying L2 technology data unit. o IID: Interface Identifier. See the IPv6 addressing architecture [RFC7136] o Inactivity Timer. A timer used after receiving a SCHC fragment toend the fragmentation state machinedetect when there is an error and there is no possibility to continue an on-going SCHC fragmented packet transmission. o L2: Layer two. The immediate lower layer SCHC interfaces with. It is provided by an underlying LPWAN technology. o MIC: Message Integrity Check. A SCHC fragmentation header field computed over an IPv6 packet before fragmentation, used for error detection after IPv6 packet reassembly. o MO: Matching Operator. An operator used to match a value contained in a header field with a value contained in a Rule. o Retransmission Timer. A timer used by the SCHC fragment sender during an on-going SCHC fragmented packet transmission to detect possible link errors when waiting for a possible incoming ACK. o Rule: A set of header field values. o Rule entry: A row in the rule that describes a header field. o Rule ID: An identifier for a rule, SCHCC/D, and DevC/D in both sides share the same Rule ID for a specificflow.packet. A set of Rule IDs are used to support SCHC fragmentation functionality. o SCHC C/D: Static Context Header Compression Compressor/ Decompressor. Aprocessmechanism used in both sides, at the Dev and at the network to achievecompression/ decompressingCompression/Decompression of headers. SCHC C/D uses SCHC rules to perform compression and decompression. o SCHC packet: A packet (e.g. an IPv6 packet) whose header has been compressed as per the header compression mechanism defined in this document. If the header compression process is unable to actually compress the packet header, the packet with the uncompressed header is still called a SCHC packet (in this case, a Rule ID is used to indicate that the packet header has not been compressed). o TV: Target value. A value contained in the Rule that will be matched with the value of a header field. o Up:Up LinkUplink direction forcompression,compression/decompression in both sides, from the Dev SCHC C/D to the network SCHC C/D. o W: Window bit. A SCHC fragment header field used in Window mode(see section 5),({Frag}), which carries the same value for all SCHC fragments of a window. o Window: A subset of the SCHC fragments needed to carry a packet(see section 5)({Frag}). 4. SCHC overview SCHC can be abstracted as an adaptation layer below IPv6 and the underlying LPWAN technology. SCHC that comprises two sublayers (i.e. the Compression sublayer and the Fragmentation sublayer), as shown in Figure 2. +----------------+ | IPv6 | +- +----------------+ | | Compression | SCHC < +----------------+ | | Fragmentation | +- +----------------+ |LPWAN technology| +----------------+ Figure 2: Protocol stack comprising IPv6, SCHC and an LPWAN technology As per this document, when a packet (e.g. an IPv6 packet) needs to be transmitted, header compression is first applied to the packet. The resulting packet after header compression (whose header MAY actually be smaller than that of the original packet or not) is called a SCHC packet. Subsequently, and if the SCHC packet size exceeds the layer 2 (L2) MTU, fragmentation is then applied to the SCHC packet. This process is illustrated by Figure 3 A packet (e.g. an IPv6 packet) | V +------------------------------+ |SCHC Compression/Decompression| +------------------------------+ | SCHC packet | V +------------------+ |SCHC Fragmentation| (if needed) +------------------+ | V SCHC Fragment(s) (if needed) Figure 3: SCHC operations from a sender point of view: header compression and fragmentation 5. Rule ID Rule ID are identifiers used to select either the correct context to be used for Compression/Decompression functionalities or for SCHC Fragmentation or after trying to do SCHC C/D and SCHC fragmentation the packet is sent as is. The size of the Rule ID is not specified in this document, as it is implementation-specific and can vary according to the LPWAN technology and the number of Rules, among others. The Rule IDs identifiers are: * In the SCHC C/D context the Rule used to keep the Field Description of the header packet. o In SCHC Fragmentation to identify the specific modes and settings. In bidirectional SCHC fragmentation at least two Rules ID are needed. o And at least one Rule ID MAY be reserved to the case where no SCHC C/D nor SCHC fragmentation were possible. 6. Static Context Header Compression In order to perform header compression, this document defines a mechanism called Static Context Header Compression(SCHC)(SCHC), which is based on using context, i.e. a set of rules to compress or decompress headers. SCHC avoids context synchronization, which is the most bandwidth-consuming operation in other header compression mechanisms such as RoHC [RFC5795].Based on the fact thatSince the nature ofdata flows ispackets are highly predictable in LPWAN networks,somestatic contextsmayMAY be storedonbeforehand to omit transmitting some information over theDevice (Dev).air. The contextsmustMUST be storedinat both ends, anditthey can either be learned by a provisioningprotocol orprotocol, by out of bandmeansmeans, oritthey can bepre-provisioned, etc.pre- provisioned. The way thecontext is learnedcontexts are provisioned on bothsides areends is out of the scope of this document. Dev App +----------------+ +--------------++--------------+ |APP1| APP1 APP2APP3|APP3 | |APP1 APP2 APP3| | | | | | UDP | | UDP | | IPv6 | | IPv6 | | | | || SCHC C/D | | | | (context) ||SCHC Comp / Frag| | |+-------+------++--------+-------+ +-------+------+ | +--+ +----++---------++-----------+ . +~~ |RG| === |NGW | ===|SCHC C/D| SCHC |... Internet .. +--+ +----+|(context)| +---------+|Comp / Frag| +-----------+ Figure2:4: Architecture Figure24 The figure represents the architecture forcompression/decompression, itSCHC (Static Context Header Compression) Compression / Fragmentation where SCHC C/ D (Compressor/Decompressor) and SCHC Fragmentation are performed. It is based on [I-D.ietf-lpwan-overview] terminology.The DeviceSCHC Compression / Fragmentation issending applications flows usinglocated on both sides of the transmission in the Dev and in the Network side. In the Uplink direction, the Device application packets use IPv6 or IPv6/UDP protocols.These flows are compressed by a Static Context Header Compression Compressor/Decompressor (SCHC C/D) to reduceBefore sending these packets, the Dev compresses their headerssize. Theusing SCHC C/D and if the SCHC packet resultinginformationfrom the compression exceeds the maximum payload size of the underlying LPWAN technology, SCHC fragmentation is performed, see Section 7. The resulting SCHC fragments are sent as one or more L2 frames toa layer two (L2) frame to aan LPWAN RadioNetworkGateway (RG) which forwards theframeframe(s) to a Network Gateway (NGW). The NGW sends the data to an SCHC Fragmentation and then to the SCHC C/D fordecompression which shares the same rules with the Dev.decompression. The SCHC C/D in the Network side can be locatedonin the Network Gateway (NGW) orin another placesomewhere else as long as a tunnel is established between the NGW and the SCHCC/D. TheCompression / Fragmentation. Note that, for some LPWAN technologies, it MAY be suitable to locate SCHCC/Dfragmentation and reassembly functionality nearer the NGW, in order to better deal with time constraints of such technologies. The SCHC C/Ds on both sidesmustMUST share the same set of Rules. After decompression, the packet can be sentonover the Internet to one or several LPWAN Application Servers (App). The SCHCC/DCompression / Fragmentation process isbidirectional, sosymmetrical, therefore the sameprinciples can be applied indescription applies to theotherreverse direction.4.1.6.1. SCHC C/D Rules The main idea of the SCHC compression scheme is tosendtransmit the RuleidID to the other end instead of sending known field values. This RuleidID identifies a rule thatmatches as much as possibleprovides the closest match to the original packet values.WhenHence, when a value is known by both ends, it isnotonly necessary to sendit throughthe corresponding Rule ID over the LPWAN network. How Rules are generated is out of the scope of this document. The rule MAY be changed but it will be specified in another document. The context contains a list of rules (cf. Figure3).5). Each Rule contains itself a list offields descriptionsFields Descriptions composed of a field identifier (FID), a field length (FL), a field position (FP), a direction indicator (DI), a target value (TV), a matching operator (MO) and a Compression/Decompression Action (CDA). /-----------------------------------------------------------------\ | Rule N | /-----------------------------------------------------------------\| | Rule i || /-----------------------------------------------------------------\|| | (FID) Rule 1 ||| |+-------+--+--+--+------------+-----------------+---------------+||| ||Field 1|FL|FP|DI|Target Value|Matching Operator|Comp/Decomp Act|||| |+-------+--+--+--+------------+-----------------+---------------+||| ||Field 2|FL|FP|DI|Target Value|Matching Operator|Comp/Decomp Act|||| |+-------+--+--+--+------------+-----------------+---------------+||| ||... |..|..|..| ... | ... | ... |||| |+-------+--+--+--+------------+-----------------+---------------+||/ ||Field N|FL|FP|DI|Target Value|Matching Operator|Comp/Decomp Act||| |+-------+--+--+--+------------+-----------------+---------------+|/ | | \-----------------------------------------------------------------/ Figure3:5: Compression/Decompression Context The Rule does not describe how to delineate each field in the original packetformat which mustheader. This MUST be known from thecompressor/decompressor.compressor/ decompressor. The rulejustonly describes the compression/decompression behavior fortheeach headerfields.field. In the rule, thedescription ofFields Descriptions are listed in theheader field should be performedorder in which the fields appear in theformatpacketorder.header. The Rule also describes thecompressed header fields which are transmittedCompression Residue sent regardingtheir position intherule which is used for data serialization onorder of thecompressor side and data deserialization onFields Descriptions in thedecompressor side.Rule. The Context describes the header fields and its values with the following entries: oAField ID (FID) is a unique value to define the header field. oAField Length (FL)isrepresents the length of the fieldthat can be of fixed length asinIPv6 or UDP headersbits for fixed values orvariable length as in CoAP options. Fixeda type (variable, token length, ...) for Field Description lengthfields shall be represented by its actual value in bits. Variableunknown at the rule creation. The lengthfields shall be represented by a function orof avariable.header field is defined in the specific protocol standard. oAField Position(FP)(FP): indicating if several instances ofthea field exist in the headers which one is targeted. The default position is11. o A direction indicator (DI) indicating the packetdirection.direction(s) this Field Description applies to. Three values are possible: * UPLINK(Up) when the field or the value(Up): this Field Description is onlypresent inapplicable to packets sent by the Dev to the App, * DOWNLINK(Dw) when the field or the value(Dw): this Field Description is onlypresent in packetapplicable to packets sent from the App to theDev andDev, * BIDIRECTIONAL(Bi) when the field or the value(Bi): this Field Description ispresent either upstream or downstream.applicable to packets travelling both Up and Dw. oATarget Value (TV) is the value used to make thecomparisonmatch with the packet header field. The Target Value can be of any type (integer, strings, etc.). For instance, it can be a single value or a more complex structure (array, list, etc.), such as a JSON or a CBOR structure. oAMatching Operator (MO) is the operator used tomake the comparison betweenmatch the Field Value and the Target Value. The Matching Operator may require some parameters. MO is only used during the compression phase. The set of MOs defined in this document can be found in Section 6.4. oACompression Decompression Action (CDA)is used to describedescribes the compression andthedecompressionprocess.processes to be performed after the MO is applied. The CDAmayMAY require someparameters, CDAparameters to be processed. CDAs are used in both the compression and the decompressionphases. 4.2.functions. The set of CDAs defined in this document can be found in Section 6.5. 6.2. Rule ID for SCHC C/D Rule IDs are sentbetween both compression/decompression elements. The size ofby theRule ID is not specifiedcompression function inthis document, it is implementation-specificone side andcan vary regarding the LPWAN technology,are received for thenumber of flows, among others. Some valuesdecompression function in theRule ID space are reserved forotherfunctionalities than header compression as fragmentation. (See Section 5).side. In SCHC C/D, the Rule IDs are specific to a Dev.Two Devs mayHence, multiple Dev instances MAY use the same Rule IDforto define different headercompression.compression contexts. To identify the correct Rule ID, the SCHC C/D needs tocombinecorrelate the Rule ID with the DevL2identifier to find the appropriateRule. 4.3.Rule to be applied. 6.3. Packet processing The compression/decompression process follows several steps: ocompressionCompression Rule selection: The goal is to identify which Rule(s) will be used to compress the packet's headers. When doingcompressiondecompression, in theNGWnetwork side the SCHC C/D needs to find the correct Ruleto be used by identifying itsbased on the L2 address and in this way, it can use the Dev-ID and the Rule-ID. In theDev,Dev side, only theRule-ID mayRule ID is needed to identify the correct Rule since the Dev only holds Rules that apply to itself. The Rule will beused.selected by matching the Fields Descriptions to the packet header as described below. When the selection of a Rule is done, this Rule is used to compress the header. Thenextdetailed steps for compression Rule selection are the following: * The first step is to choose thefieldsFields Descriptions by their direction, using the direction indicator(DI), so the fields(DI). A Field Description thatdodoes not correspond to theappropriatedappropriate DI will beexcluded. Next,ignored, if all the fields of the packet do not have a Field Description with the correct DI the Rule is discarded and SCHC C/D proceeds to explore the next Rule. * When the DI has matched, then the next step is to identify the fieldsare identifiedaccording totheir field identifier (FID) and field positionField Position (FP). If thefield positionField Position does not correspond,thenthe Rule is not used and the SCHCtakeC/D proceeds to consider the next Rule. * Once the DI and the FP correspond to the header information, each field's value of the packet is then compared to the correspondingtarget valueTarget Value (TV) stored in the Rule for that specific field using the matching operator (MO). * If all the fields in the packet's header satisfy all the matching operators(MOs)(MO) of a Rule (i.e. all MO results are True), the fields of the header are thenprocessedcompressed according to theCompression/ DecompressionCompression/Decompression Actions (CDAs) and a compressed headeris(with possibly a Compressed Residue) SHOULD be obtained. Otherwise, the nextruleRule is tested. * If no eligibleruleRule is found, then the headermustMUST be sent without compression,in whichdepending on the L2 PDU size, this is one of the case that MAY require the use of the SCHC fragmentationprocess must be required.process. osending: TheSending: If an eligible Rule is found, the Rule ID is sent to the other end followed by theinformation resulting from the compression of header fields,Compression Residue (which could be empty) and directly followed by the payload. The product offield compressionthe Compression Residue is sent in the order expressed in the Rule for all thematchingfields. The way the Rule ID is sent depends on the specific LPWAN layer twotechnology and will be specified in a specific document and is out of the scope of this document.technology. For example, it can be either included in a Layer 2 header or sent in the first byte of the L2 payload. (Cf. Figure4).6). This process will be specified in the LPWAN technology-specific document and is out of the scope of the present document. On LPWAN technologies that are byte- oriented, the compressed header concatenated with the original packet payload is padded to a multiple of 8 bits, if needed. See Section 8 for details. odecompression:Decompression: When doing decompression, in the network side the SCHC C/D needs to find the correct Rule based on the L2 address and in this way, it can use the Dev-ID and the Rule-ID. Inboth directions,the Dev side, only the Rule ID is needed to identify the correct Rule since the Dev only holds Rules that apply to itself. The receiver identifies the sender through its device-id (e.g. MACaddress)address, if exists) and selects the appropriate Rulethroughfrom the Rule ID. If a source identifier is present in the L2 technology, it is used to select the Rule ID. This Rulegivesdescribes the compressed header format and associatesthesethe values to the header fields.ItThe receiver applies the CDA action to reconstruct the original header fields. The CDA application order can be different from the order given by the Rule. For instance, Compute-*maySHOULD be applied at the end, after all the other CDAs.If after using SCHC compression and adding the payload to the L2 frame the datagram is not multiple of 8 bits, padding may be used.+--- ...--+----------------+------- ...--------------+-----------+--...--+-------+------------------+~~~~~~~ | Rule ID|Compressed Hdr Fields information||Compression Residue| packet payload|padding||padding +--- ...--+----------------+------- ...--------------+-----------+--...--+-------+------------------+~~~~~~~ (optional) <----- compressed header ------> Figure4: LPWAN Compressed Format6: SCHC C/D Packet4.4.Format 6.4. Matching operators Matching Operators (MOs) are functions used by both SCHC C/D endpoints involved in the header compression/decompression. They are not typed and can beappliedindifferently applied to integer, string or any other data type. The result of the operation can either be True or False. MOs are defined as follows: o equal:AThe match result is True if a field value in a packetmatches with a TVand the value ina Rule if theythe TV are equal. o ignore: No check is done between a field value in a packet and a TV in the Rule. The result of the matching is always true. oMSB(length):MSB(x): Amatchingmatch is obtained if the most significant x bits of thelengthfield valuebits ofin the header packet are equal to the TV in therule.Rule. The x parameter of the MSB Matching Operatorneeds a parameter, indicating the number of bits, to proceed toindicates how many bits are involved in thematching.comparison. o match-mapping:The goal of mapping-sent is to reduceWith match-mapping, thesize of a field by allocating a shorter value. TheTarget Valuecontainsis a list of values. Each value of the list is identified by a short ID (or index). Compression is achieved by sending the index instead of the original header field value. This operator matches ifathe header field value is equal to one ofthosethe values in the targetvalues. 4.5.list. 6.5. Compression Decompression Actions (CDA) The Compression Decompression Action (CDA) describes the actions taken during the compression of headers fields, and inversely, the action taken by the decompressor to restore the original value. /--------------------+-------------+----------------------------\ | Action | Compression | Decompression | | | | | +--------------------+-------------+----------------------------+ |not-sent |elided |use value stored in ctxt | |value-sent |send |build from received value | |mapping-sent |send index |value from index on a table ||LSB(length)|LSB(y) |send LSB|TV OR|TV, received value | |compute-length |elided |compute length | |compute-checksum |elided |compute UDP checksum | |Deviid |elided |build IID from L2 Dev addr | |Appiid |elided |build IID from L2 App addr | \--------------------+-------------+----------------------------/ y=size of the transmitted bits Figure5:7: Compression and Decompression Functions Figure57 summarizes thebasicsbasic functionsdefinedthat can be used to compress and decompress a field. The first columngiveslists theaction'sactions name. The second and third columns outline thecompression/decompression behavior.reciprocal compression/ decompression behavior for each action. Compression is done inthe ruleorderand compressed values are sent inthatorderFields Descriptions appear in thecompressed message.Rule. Thereceiver must be ableresult of each Compression/Decompression Action is appended tofindthe working Compression Residue in that same order. The receiver knows the size of each compressed field which can be given by the rule ormayMAY be sent with the compressed header. If the field is identified as beingvariable,variable in the Field Description, thenitsthe sizemustof the Compression Residue value in bytes MUST be sent first using the following coding: o If the size is between 0 and 14bytesbytes, it is sentusing 4 bits.as a 4-bits integer. o For values between 15 and 255, the first 4 bits sent are set to 1 and the size is sent using 8bits.bits integer. o For highervalue,values of size, the first 12 bits are set to 1 and the next two bytes contain the size value as a 16 bits integer. o If a field does not exist in the packet but in the Rule and its FL issent on 2 bytes. 4.5.1.variable, the size zero MUST be used. 6.5.1. not-sent CDA The not-sent function is generally used when the field value is specified in theruleRule and therefore known bytheboth the Compressor and the Decompressor. This action is generally used with the "equal" MO. If MO is "ignore", there is a risk to have a decompressed field value different from the compressed field. The compressor does not send any value in thecompressed headerCompressed Residue forthea field on which not-sent compression is applied. The decompressor restores the field value with thetarget valueTarget Value stored in the matchedrule. 4.5.2.Rule identified by the received Rule ID. 6.5.2. value-sent CDA The value-sent action is generally used when the field value is not known by both Compressor and Decompressor. The value is sent in the compressed message header. Both Compressor and DecompressormustMUST know the size of the field, either implicitly (the size is known by both sides) or explicitly in thecompressed header fieldcompression residue by indicating thelength.length, as defined in Section 6.5. This function is generally used with the "ignore" MO.4.5.3.6.5.3. mapping-sent CDA The mapping-sent is used to send a smaller indexassociated with(the index into the Target Value list ofvalues invalues) instead of theTarget Value.original value. This function is used together with the "match-mapping" MO.TheOn the compressorlooks onside, the match-mapping Matching Operator searches the TVto findfor a match with the header field value andsendthe mapping-sent CDA appends the correspondingindex. Theindex to the Compression Residue to be sent. On the decompressor side, the CDA usesthisthe received index to restore the fieldvalue.value by looking up the list in the TV. The number of bits sent is the minimal size for coding all the possibleindexes. 4.5.4. LSBindices. 6.5.4. LSB(y) CDALSBThe LSB(y) action is used together with the "MSB(x)" MO to avoid sending theknownhigher part of the packet fieldheader to the other end. This actionif that part isused together withalready known by the"MSB" MO.receiving end. A length can be specified in the rule to indicate how many bits have to be sent. If the length is not specified, the number of bits sent is the original header field length minus thebits'length specified in theMSBMSB(x) MO. The compressor sends the"length"Least SignificantBits.Bits (e.g. LSB of the length field). The decompressor combines the value received with the TargetValue.Value depending on the field type. If this actionis madeneeds to be done on a variable length field, theremainingsize of the Compressed Residue inbyte has tobytes MUST be sentbefore. 4.5.5.as described in Section 6.5. 6.5.5. DEViid, APPiid CDA These functions are used to process respectively the Dev and the App Interface Identifiers (Deviid and Appiid) of the IPv6 addresses. Appiid CDA is less common since current LPWAN technologies frames contain a single address, which is the Dev's address. The IID valuemayMAY be computed from the Device ID present in the Layer 2header.header, or from some other stable identifier. The computation is specific for each LPWAN technology andmayMAY depend on the Device ID size. In thedownstreamDownlink direction, these Deviid CDAmay beis used to determine the L2 addresses used by the LPWAN.4.5.6.6.5.6. Compute-*These classes of functions are used by the decompressor to compute the compressed field value based on received information. CompressedSome fields are elided during compression and reconstructed during decompression. This is the case for length and Checksum, so: o compute-length:computecomputes the length assigned to this field.For instance, regarding the field ID, thisThis CDAmayMAY be used to compute IPv6 length or UDP length. o compute-checksum:computecomputes a checksum from the information already received by the SCHC C/D. This fieldmayMAY be used to compute UDP checksum.5.7. Fragmentation5.1.7.1. Overview In LPWAN technologies, the L2 data unit size typically varies from tens to hundreds of bytes.IfThe SCHC fragmentation MAY be used either because after applying SCHCheader compressionC/D or when SCHCheader compressionC/D is not possible the entireIPv6 datagram fits within a singleSCHC packet still exceeds the L2 dataunit, theunit. The SCHC fragmentationmechanism isfunctionality defined in this document has been designed under the assumption that data unit out-of- sequence delivery will notused andhappen between thepacket is sent. Otherwise,entity performing fragmentation and thedatagram SHALL be broken into fragments. LPWAN technologies impose some strict limitations on traffic, (e.g.) devices are sleeping most ofentity performing reassembly. This assumption allows reducing thetimecomplexity andmay receive data during a short periodoverhead oftime after transmission to preserve battery.the SCHC fragmentation mechanism. To adapt the SCHC fragmentation to the capabilities of LPWANtechnologies, ittechnologies isdesirablerequired to enable optional SCHC fragment retransmission and to allow agradation of fragmentstepper deliveryreliability.for the reliability of SCHC fragments. This document does not make any decision with regard to which SCHC fragment delivery reliabilityoption(s)mode will be used over a specific LPWAN technology.An important consideration is that LPWAN networks typically follow a the star topology, and therefore data unit reordering is not expected in such networks. This specification assumes that reorderingThese details willnot happen between the entity performing fragmentation and the entity performing reassembly. This assumption allows to reduce complexity and overhead of the fragmentation mechanism. 5.2. Functionalitiesbe defined in other technology-specific documents. 7.2. Fragmentation Tools This subsection describes the differentfields in the fragmentation header frames (see the related formats in Section 5.4), as well as thetools that are used to enable the SCHC fragmentationfunctionalitiesfunctionality defined in this document, such as fields in the SCHC fragmentation header frames (see the related formats in Section 7.4), and the different parameters supported in the reliabilityoptions supported.modes such as timers and parameters. o Rule ID. The Rule ID is present in the SCHC fragment header and in the ACK header format. The Rule ID in a SCHC fragment header is used to identify that a SCHC fragment is being carried,thewhich SCHC fragmentationdeliveryreliabilityoptionmode is used andit may indicate thewhich window sizein use (if any).is used. The Rule ID in the SCHC fragmentation header also allowsto interleaveinterleaving non-fragmentedIPv6 datagrams withpackets and SCHC fragments that carrya larger IPv6 datagram.other SCHC packets. The Rule ID in an ACKallows to identify thatidentifies the messageisas an ACK. o Fragment Compressed Number (FCN). The FCN is included in all SCHC fragments. This field can be understood as a truncated, efficient representation of a larger-sized fragment number, and does not carry an absolute SCHC fragment number. There are two FCN reserved values that are used for controlling the SCHC fragmentation process, as describednext.next: * The FCN value with all the bits equal to 1(All- 1)(All-1) denotes the last SCHC fragment of a packet.And theThe last window of a packet is called an All-1 window. * The FCN value with all the bits equal to 0 (All-0) denotes the last SCHC fragment of a window(when such windowthat is not the last one of thepacket) in anypacket. Such a windowmode or the fragments in No ACK mode.is called an All-0 window. The rest of the FCN values are assigned in asequential andsequentially decreasing order, which has the purpose to avoid possible ambiguity for the receiver that might arise under certain conditions. In the SCHC fragments, this field is an unsigned integer, with a size of N bits. In theNo ACK modeNo-ACK mode, it is set to 1 bit(N=1).(N=1), All-0 is used in all SCHC fragments and All-1 for the last one. For the other reliabilityoptions,modes, it is recommended to use a number of bits (N) equal to or greater than 3. Nevertheless, theapropriateappropriate valuewillof N MUST be defined in the correspondingtechnologytechnology-specific profile documents.The FCN MUST be set sequentially decreasing from the highest FCN in the window (which will be used for the first fragment), and MUST wrap from 0 back to the highest FCN in the window.For windows that are not the last one from a SCHC fragmented packet, the FCN for the last SCHC fragment in such windows is an All-0. This indicates that the window is finished and communication proceeds according to the reliabilityoptionmode in use. The FCN for the last SCHC fragment in the last window is anAll-1.All-1, indicating the last SCHC fragment of the SCHC packet. It is also important to note that,for No ACKin the No-ACK mode or when N=1, the last SCHC fragment of the packet will carry a FCN equal to 1, while all previous SCHC fragments will carry a FCN of 0. For further details see Section 7.5. The highest FCN in the window, denoted MAX_WIND_FCN, MUST be a value equal to or smaller than 2^N-2. (Example for N=5, MAX_WIND_FCN MAY be set to 23, then subsequent FCNs are set sequentially and in decreasing order, and the FCN will wrap from 0 back to 23). o Datagram Tag (DTag). The DTag field, if present, is set to the same value for all SCHC fragments carrying the sameIPv6 datagram. This field allowsSCHC packet, and to different values for different datagrams. Using this field, the sender can interleave fragmentsthat correspond tofrom differentIPv6 datagrams.SCHC packets, while the receiver can still tell them apart. In the SCHC fragmentformatsformats, the size of the DTag field is T bits, whichmayMAY be set to a value greater than or equal to 0 bits. For each new SCHC packet processed by the sender, DTag MUST besetsequentiallyincreasingincreased, from 0 to 2^T -1, and MUST wrap1 wrapping back from 2^T - 1 to 0. In the ACK format, DTag carries the same value as the DTag field in the SCHC fragments for which this ACK is intended. o W (window): W is a 1-bit field. This field carries the same value for all SCHC fragments of a window, and it is complemented for the next window. The initial value for this field is 0. In the ACK format, this field also has a size of 1 bit. In all ACKs, the W bit carries the same value as the W bit carried by the SCHC fragments whose reception is being positively or negatively acknowledged by the ACK. o Message Integrity Check (MIC). This field, which has a size of M bits, is computed by the sender over the completepacket (i.e. aSCHCcompressed or an uncompressed IPv6 packet)packet before SCHC fragmentation. The MIC allows the receiver to check errors in the reassembled packet, while it also enables compressing the UDP checksum by use of SCHC compression. The CRC32 as 0xEDB88320 (i.e. the reverse representation of the polynomial used e.g. in the Ethernet standard [RFC3385]) is recommended as the default algorithm for computing the MIC. Nevertheless, otheralgorithmalgorithms MAY bemandatedrequired and are defined in thecorresponding technology documents (e.g.technology-specificprofiles).documents. o C (MIC checked): C is a 1-bit field. This field is used in the ACKformatpackets to report the outcome of the MIC check, i.e. whether the reassembled packet was correctly received or not. A value of 1 represents a positive MIC check at the receiver side (i.e. the MIC computed by the receiver matches the received MIC). o Retransmission Timer.It is used by aA SCHC fragment sender uses it after the transmission of a window to detect a transmission error of the ACK corresponding to this window. Depending on the reliabilityoption,mode, it will lead to a requestforan ACK retransmissionon(in ACK-Always mode) or it will trigger the transmission of the next windowon ACK-on-error.(in ACK-on-Error mode). Thedureationduration of this timer is not defined in this document andmustMUST be defined in the corresponding technologydocuments (e.g. technology-specific profiles).documents. o Inactivity Timer.This timer is used by aA SCHC fragment receiver uses it todetecttake action when there is a problem in the transmission offragments andSCHC fragments. Such a problem could be detected by the receiverdoesnotget anygetting a single SCHC fragment during a given period of time or not getting a given number of packets in a given period of time. When this happens, an Abort messageneeds towill besent.sent (see related text later in this section). Initially, and each time a SCHC fragment isreceivedreceived, the timer is reinitialized. The duration of this timer is not defined in this document andmustMUST be defined in the specific technologydocument (e.g. technology-specific profiles).document. o Attempts.It is aThis counterused to requestcounts the requests for a missingACK, and in consequence to determine when an Abort is needed, becauseACK. When it reaches the value MAX_ACK_REQUESTS, the sender assume there are recurrent SCHC fragment transmissionerrors, whose maximum valueerrors and determines that an Abort isMAX_ACK_REQUESTS.needed. The default valueofoffered MAX_ACK_REQUESTS is not stated in this document, and it is expected to be defined inother documents (e.g. technology-the specificprofiles).technology document. The Attempts counter is defined perwindow, it will bewindow. It is initialized each time a new window is used. o Bitmap. The Bitmap is a sequence of bits carried in anACK for a given window.ACK. Each bit in the Bitmap corresponds to a SCHC fragment of the current window, and provides feedback on whether the SCHC fragment has been received or not. The right-most position on the Bitmapis used to report whetherreports if the All-0 or All-1fragments havefragment has been received or not. Feedbackfor aon the SCHC fragment with the highest FCN value is provided by the bit in the left-most positioninof the Bitmap. In the Bitmap, a bit set to 1 indicates that thecorresponding FCNSCHC fragment of FCN corresponding to that bit position has been correctly sent and received.However,The text above describes thesending formatinternal representation of theBitmap will be truncated until a byte boundary whereBitmap. When inserted in thelast error is given. However, when allACK for transmission from the receiver to the sender, the Bitmapis transmitted, it mayMAY betruncated,truncated for energy/ bandwidth optimisation, see more details in Section5.5.37.4.3.1. o Abort.In caseOn expiration oferror or whenthe Inactivitytimer expirestimer, orMAX_ACK_REQUESTS iswhen Attempts reached MAX_ACK_REQUESTS or upon an occurrence of some other error, the sender or the receivermayMUST use theAbort frames.Abort. When the receiver needs to abort the on-going SCHC fragmented packet transmission, ituses the ACK Abort format packet with allsends thebits set to 1.Receiver-Abort format. When the sender needs to abort thetransmissiontransmission, itwill usesends the Sender-Abort format. None of theAll-1Abortformat, this fragment is not acked.are acknowledged. o Padding (P).Padding will be used to alignIf it is needed, thelast byte of a fragment with a byte boundary. Thenumber of bits used for padding is not defined and depends on the size of the Rule ID, DTag and FCN fields, and on thelayer twoL2 payloadsize. 5.3. Deliverysize (see Section 8). Some ACKs are byte-aligned and do not need padding (see Section 7.4.3.1). 7.3. Reliabilityoptionsmodes This specification definesthe followingthreefragment deliveryreliabilityoptions:modes: No-ACK, ACK- Always and ACK-on-Error. ACK-Always and ACK-on-Error operate on windows of SCHC fragments. A window of SCHC fragments is a subset of the full set of SCHC fragments needed to carry a packet or an SCHC packet. oNo ACK. No ACKNo-ACK. No-ACK is the simplest SCHC fragmentdeliveryreliabilityoption.mode. The receiver does not generate overhead in the form of acknowledgments (ACKs). However, thisoptionmode does not enhancedeliveryreliability beyond that offered by the underlying LPWAN technology. In theNo ACK option,No-ACK mode, the receiver MUST NOT issue ACKs. See further details in Section 7.5.1. oWindow mode - ACK always (ACK-Always).ACK-Always. TheACK-always optionACK-Always mode provides flowcontrol. In addition, this optioncontrol using a window scheme. This mode is also able to handle long bursts of lostfragments,SCHC fragments since detection of such events can be done before the end of theIPv6SCHC packettransmission,transmission as long as the window size is short enough. However, such benefit comes at the expense of ACK use. InACK- always, an ACK is transmitted byACK-Always thefragmentreceiver sends an ACK after a window of SCHC fragments has beensent. Areceived, where a window of SCHC fragments is a subset of thefull setwhole number of SCHC fragments needed to carryan IPv6a complete SCHC packet.In this mode, theThe ACKinformsis used to inform the senderabout received and/or missed fragments fromif a SCHC fragment in the actual windowof fragments.has been lost or well received. Uponreceipt ofan ACKthat informs about any lost fragments,reception, the sender retransmits the lost SCHC fragments. When an ACK is lost and the sender has not receivedbyit before thefragment sender,expiration of thelatter sendsInactivity Timer, the sender uses an ACK requestusingby sending the All-1 empty SCHC fragment. The maximum number of ACK requests is MAX_ACK_REQUESTS. If the MAX_ACK_REQUEST is reached the transmission needs to be Aborted. See further details in Section 7.5.2. oWindow mode - ACK-on-error (ACK-on-error).ACK-on-Error. TheACK-on-error optionACK-on-Error mode is suitable for links offering relatively low L2 data unit loss probability.This optionIn this mode, the SCHC fragment receiver reduces the number of ACKstransmitted by the fragment receiver. This maytransmitted, which MAY be especially beneficial in asymmetricscenarios, e.g. where fragmented data are sentscenarios. Because the SCHC fragments use the uplinkandof the underlying LPWANtechnology downlinktechnology, which has higher capacityor message rate is lowerthanthe uplink one. In ACK-on-error,downlink. The receiver transmits an ACKis transmitted by the fragment receiveronly afterathe complete windowof fragments have been sent, onlytransmission and if at least one SCHC fragment ofthe fragments in thethis window has been lost.InAn exception to thismode,behavior is in theACK informslast window, where thesender about received and/or missedreceiver MUST transmit an ACK, including the C bit set based on the MIC checked result, even if all the SCHC fragmentsfromof the last window have been correctly received. The ACK gives the state offragments.all the SCHC fragments (received or lost). Uponreceipt ofan ACKthat informs about any lost fragments,reception, the sender retransmits the lost SCHC fragments.However, ifIf an ACK is not transmitted back by the receiver at the end of a window, the sender assumes that all SCHC fragments have been correctly received. When the ACK is lost, the sender assumes that all SCHC fragments covered by the lost ACK have been successfully delivered,andso the sender continues transmitting the next window of SCHC fragments. If the next SCHC fragments received belong to the next window, the receiver will abort the on-going fragmented packet transmission.One exception to this behavior is in the last window, where the receiver MUST transmit an ACK, even if all the fragmentsSee further details inthe last window have been correctly received.{{ACK-on-Error- subsection}}. The same reliabilityoptionmode MUST be used for all SCHC fragments ofaan SCHC packet.It is up to implementers and/or representatives of the underlying LPWAN technology to decideThe decision on which reliabilityoption to usemode will be used and whether the same reliabilityoptionmode applies to allIPv6SCHC packetsor not.is an implementation problem and is out of the scope of this document. Note that the reliabilityoption to be usedmode choice is not necessarily tied tothea particularcharacteristicscharacteristic of the underlying L2 LPWANtechnology (e.g.technology, e.g. theNo ACK reliability option mayNo-ACK mode MAY be used on top of an L2 LPWAN technology with symmetric characteristics for uplink anddownlink).downlink. This document does not make any decision as to which SCHC fragmentdeliveryreliabilityoption(s)mode(s) are supported by a specific LPWAN technology. Examples of the different reliabilityoptionsmodes described are provided in Appendix B.5.4.7.4. FragmentationFrameFormats This section defines the SCHC fragment format, the All-0 and All-1frameformats, the ACK format and the Abortframeformats.5.4.1.7.4.1. Fragment format A SCHC fragment comprises a SCHC fragment header, a SCHC fragmentpayload,payload andPaddingpadding bits (ifany).needed). A SCHC fragment conforms to the general format shown in Figure6.8. The SCHC fragment payload carries a subset ofeither aSCHCheader or an IPv6 header or the original IPv6 packet data payload.packet. A SCHC fragment is the payloadinof the L2 protocol data unit (PDU).+-----------------+-----------------------+---------+Padding MAY be added in SCHC fragments and in ACKs if necessary, therefore a padding field is optional (this is explicitly indicated in Figure 8 for the sake of illustration clarity. +-----------------+-----------------------+~~~~~~~~~~~~~~~ | Fragment Header | Fragment payload | padding| +-----------------+-----------------------+---------+(opt.) +-----------------+-----------------------+~~~~~~~~~~~~~~~ Figure6:8: Fragment general format. Presence of a padding field is optional In ACK-Always or ACK-on-Error, SCHC fragments except theNo ACK option,last one SHALL conform the detailed format defined in {{Fig- NotLastWin}}. The total size of the fragment header is R bits. Where is R is not a multiple of 8 bits. <------------ R -----------> <--T--> 1 <--N--> +-- ... --+- ... -+-+- ... -+--------...-------+ | Rule ID | DTag |W| FCN | Fragment payload | +-- ... --+- ... -+-+- ... -+--------...-------+ Figure 9: Fragment Detailed Format for Fragments except the Last One, Window mode In the No-ACK mode, SCHC fragments except the last one SHALLcontainconform to the detailed formatasdefined in Figure7.10. The total size of the fragment header is R bits. <------------ R---------->-----------> <--T--> <--N--> +-- ... --+- ... -+- ...-+---...---+-+-+--------...-------+ | Rule ID | DTag | FCN | Fragment payload|P|| +-- ... --+- ... -+- ...-+---...---+-+-+--------...-------+ Figure7:10: Fragment Detailed Format for Fragments except the Last One,NoNo-ACK mode In all these cases, R may not be a multiple of 8 bits. 7.4.2. All-1 and All-0 formats The All-0 format is used for sending the last SCHC fragment of a window that is not the last window of the packet. <------------ R -----------> <- T -> 1 <- N -> +-- ... --+- ... -+-+- ... -+--- ... ---+ | Rule ID | DTag |W| 0..0 | payload | +-- ... --+- ... -+-+- ... -+--- ... ---+ Figure 11: All-0 fragment detailed format The All-0 empty fragment format is used by a sender to request the retransmission of an ACKoptionby the receiver. It is only used in ACK- Always mode. <------------ R -----------> <- T -> 1 <- N -> +-- ... --+- ... -+-+- ... -+ | Rule ID | DTag |W| 0..0 | (no payload) +-- ... --+- ... -+-+- ... -+ Figure 12: All-0 empty fragment detailed format In the No-ACK mode, the last SCHC fragment of an IPv6 datagram SHALL contain a SCHC fragment header that conforms to the detaield format shown in Figure 13. The total size of this SCHC fragment header is R+M bits. <------------ R -----------> <- T -> <N=1> <---- M ----> +---- ... ---+- ... -+-----+---- ... ----+---...---+ | Rule ID | DTag | 1 | MIC | payload | +---- ... ---+- ... -+-----+---- ... ----+---...---+ Figure 13: All-1 Fragment Detailed Format for the Last Fragment, No- ACK mode In any of the Windowmode options, fragments exceptmodes, the lastonefragment of an IPv6 datagram SHALL contain a SCHC fragment header that conforms to thefragmentationdetailed formatas definedshown in Figure8.14. The total size of the SCHC fragment header in this format isRR+M bits..<------------ R----------> <--T-->-----------> <- T -> 1<--N--><- N -> <---- M ----> +-- ... --+- ... -+-+- ...-+---...---+-+-+---- ... ----+---...---+ | Rule ID | DTag |W|FCN11..1 | MIC | payload|P|| +-- ... --+- ... -+-+- ...-+---...---+-+-+---- ... ----+---...---+ (FCN) Figure8:14: All-1 Fragment Detailed Format forFragments exceptthe LastOne, Window mode 5.4.2.Fragment, ACK- Always or ACK-on-Error In either ACK-Always or ACK-on-Error, in order to request a retransmission of the ACK for the All-1 window, the fragment sender uses the format shown in Figure 15. The total size of the SCHC fragment header in this format is R+M bits. <------------ R -----------> <- T -> 1 <- N -> <---- M ----> +-- ... --+- ... -+-+- ... -+---- ... ----+ | Rule ID | DTag |W| 1..1 | MIC | (no payload) +-- ... --+- ... -+-+- ... -+---- ... ----+ Figure 15: All-1 for Retries format, also called All-1 empty The values for R, N, T and M are not specified in this document, and SHOULD be determined in other documents (e.g. technology-specific profile documents). 7.4.3. ACK format The format of an ACK that acknowledges a window that is not the last one (denoted asALL-0All-0 window) is shown in Figure9. <--------16. <--------- R------->--------> <- T -> 1 +---- ... --+-...-+-+------+-+---- ...---+-----+ | Rule ID | DTag|W| Bitmap ||W|encoded Bitmap| (no payload) +---- ... --+-...-+-+------+-+---- ...---+-----+ Figure9:16: ACK format for All-0 windows To acknowledge the last window of a packet (denoted as All-1 window), a C bit (i.e. MIC checked) following the W bit is set to 1 to indicate that the MIC check computed by the receiver matches the MIC present in the All-1 fragment. If the MIC check fails, the C bit is set to 0 and the Bitmap for the All-1 window follows.<--------<---------- R-------> <- byte boundary ->---------> <- T -> 1 1 +---- ... --+-... -+-+-+ | Rule ID | DTag |W|1| (MIC correct) +---- ... --+-... -+-+-+ +---- ... --+-...-+-+-+--------+-+-+----- ...-------+-----+ | Rule ID | DTag|W|0||W|0|encoded Bitmap| (MIC|(MIC Incorrect) +---- ... --+-...-+-+-+--------+-+-+----- ...-------+-----+ C Figure10:17: Format of an ACK for All-1 windows5.4.3. All-1 and All-0 formats7.4.3.1. Bitmap Encoding TheAll-0 formatBitmap isused fortransmitted by a receiver as part of thelast fragmentACK format. An ACK message MAY include padding at the end to align its number of transmitted bits to a multiple of 8 bits. Note that the ACK sent in response to an All-1 fragment includes the C bit. Therefore, the window size and thus the encoded Bitmap size need to be determined taking into account the available space in the layer two frame payload, where there will be 1 bit less for an ACK sent in response to an All-1 fragment than in other ACKs. Note thatis notthe maximum number of SCHC fragments of the last window is one unit smaller than that of thepacket. <------------ R ------------> <- T -> 1 <- N -> +-- ... --+- ... -+-+- ... -+--- ... ---+previous windows. When the receiver transmits an encoded Bitmap with a SCHC fragment that has not been sent during the transmission, the sender will Abort the transmission. <---- Bitmap bits ----> | Rule ID | DTag|W| 0..0|W|1|0|1|1|1|1|1|1|1|1|1|1|1|1|1|1|1|1| |--- byte boundary ----| 1 byte next |payload1 byte next |+-- ... --+- ... -+-+- ... -+--- ... ---+Figure11: All-0 fragment format The All-0 empty fragment format18: A non-encoded Bitmap In order to reduce the resulting frame size, the encoded Bitmap isusedshortened bya senderapplying the following algorithm: all the right-most contiguous bytes in the encoded Bitmap that have all their bits set torequest an ACK1 MUST NOT be transmitted. Because the SCHC fragment sender knows the actual Bitmap size, it can reconstruct the original Bitmap with the trailing 1 bit optimized away. In the example shown inACK-Always mode <------------Figure 19, the last 2 bytes of the Bitmap shown in Figure 18 comprise bits that are all set to 1, therefore they are not sent. <------- R------------>-------> <- T -> 1<- N -> +-- ... --+- ... -+-+-+---- ...-+--+-... -+-+-+-+ | Rule ID | DTag|W| 0..0 | (no payload) +-- ... --+- ... -+-+-|W|1|0| +---- ...-+--+-... -+-+-+-+ |---- byte boundary -----| Figure12: All-0 empty fragment19: Optimized Bitmap formatIn the No ACK option, the last fragmentFigure 20 shows an example of anIPv6 datagram SHALL contain a fragment header that conformsACK with FCN ranging from 6 down to 0, where theformat shown in Figure 13. The total size of this fragment header is R+M bits. <-------------Bitmap indicates that the second and the fifth SCHC fragments have not been correctly received. <------ R---------->------>6 5 4 3 2 1 0 (*) <- T -><-N-><----- M -----> +---- ... ---+- ... -+-----+---- ... ----+---...---+1 +---------+------+-+-+-+-+-+-+-+-----+ | Rule ID | DTag||W|1|0|1|1|0|1|all-0| Bitmap(before tx) +---------+------+-+-+-+-+-+-+-+-----+ |<-- byte boundary ->|<---- 1 byte---->| (*)=(FCN values) +---------+------+-+-+-+-+-+-+-+-----+~~ |MIC | payloadRule ID |+---- ... ---+- ... -+-----+---- ... ----+---...---+DTag |W|1|0|1|1|0|1|all-0|Padding(opt.) encoded Bitmap +---------+------+-+-+-+-+-+-+-+-----+~~ |<-- byte boundary ->|<---- 1 byte---->| Figure13: All-1 Fragment Format for the Last Fragment, No ACK option In any20: Example of a Bitmap before transmission, and theWindow modes,transmitted one, in any window except the lastfragmentone Figure 21 shows an example of anIPv6 datagram SHALL contain a fragment header that conformsACK with FCN ranging from 6 down to 0, where theformat shown in Figure 14. The total size ofBitmap indicates that thefragment header in this format is R+M bits. <------------MIC check has failed but there are no missing SCHC fragments. <------- R------------>-------> 6 5 4 3 2 1 7 (*) <- T -> 1<- N -> <---- M -----> +-- ... --+- ... -+-+- ... -+---- ... ----+---...---+1 | Rule ID | DTag|W| 11..1|W|0|1|1|1|1|1|1|1|padding| Bitmap (before tx) |---- byte boundary -----| 1 byte next |MICC +---- ... --+-... -+-+-+-+ |payloadRule ID |+-- ... --+- ... -+-+- ... -+----DTag |W|0|1| encoded Bitmap +---- ...----+---...---+ (FCN)--+-... -+-+-+-+ |<--- byte boundary ---->| (*) = (FCN values indicating the order) Figure14: All-1 Fragment Format for21: Example of theLast Fragment, Window mode In eitherBitmap in ACK-Always orACK-on-error, in order to request a retransmission of the ACKACK-on-Error for theAll-1last window, for N=3) 7.4.4. Abort formats Abort are coded as exceptions to the previous coding, a specific format is defined for each direction. When a SCHC fragment senderusesneeds to abort the transmission, it sends the Sender-Abort formatshown inFigure15. The total size22, that is an All-1 fragment with no MIC or payload. In regular cases All-1 fragment contains at least a MIC value. This absence of the MIC value indicates an Abort. When a SCHC fragmentheader in thisreceiver needs to abort the on-going SCHC fragmented packet transmission, it transmits the Receiver- Abort format Figure 23, creating an exception in the encoded Bitmap coding. Encoded Bitmap avoid sending the rigth most bits of the Bitmap set to 1. Abort isR+M bits. <------------ R ------------> <- T ->coded as an ACK message with a Bitmap set to 1<- N -> <---- M -----> +-- ... --+- ... -+-+- ... -+---- ... ----+ | Rule ID | DTag |W| 1..1 | MIC | (no payload) +-- ... --+- ... -+-+- ... -+---- ... ----+ Figure 15: All-1 for Retries format, also called All-1 empty The values for R, N, Tuntil the byte boundary, followed by an extra 0xFF byte. Such message never occurs in a regular acknowledgement andMis view as an abort. None of these messages are notspecifiedacknowledged nor retransmitted. The sender uses the Sender-Abort when the MAX_ACK_REQUEST is reached. The receiver uses the Receiver-Abort when the Inactivity timer expires, or inthis document,the ACK-on-Error mode, ACK is lost andhave to be determined inthe sender transmits SCHC fragments of a new window. Some otherdocuments (e.g. technology-specific profile documents). 5.4.4. Abort formats The All-1cases for Abortand the ACK abort messages haveare explained in thefollowing formats. <------ byte boundary ------><---Section 7.5 or Appendix C. <------------- R -----------><--- 1 byte ---> +--- ... ---+- ... -+-+-...-+-+-+-+-+-+-+-+-+ | Rule ID | DTag |W| FCN | FF | (no MIC & no payload) +--- ... ---+- ... -+-+-...-+-+-+-+-+-+-+-+-+ Figure16: All-1 Abort22: Sender-Abort format. All FCN fields in this format<------are set to 1 <----- byte boundary-----><---------><--- 1 byte ---> +---- ... --+-... -+-+-+-+-+-+-+-+-+-+-+-+-+ | Rule ID | DTag |W| 1..1| FF | +---- ... --+-... -+-+-+-+-+-+-+-+-+-+-+-+-+ Figure17: ACK Abort23: Receiver-Abort format5.5.7.5. Baseline mechanism If after applying SCHC header compression (or when SCHC header compression is not possible) the SCHC packet does not fit within the payload of a single L2 data unit, the SCHC packet SHALL be broken into SCHC fragments and the fragments SHALL be sent to the fragment receiver. The fragment receiver needs to identify all the SCHC fragments that belong to a givenIPv6 datagram.SCHC packet. To this end, the receiver SHALL use: o The sender's L2 source address (if present), o The destination's L2 address (if present), o RuleID andID, o DTag(the latter, if(if present). Then, the fragment receivermayMAY determine the SCHC fragmentdeliveryreliabilityoptionmode that is used for this SCHC fragment based on the Rule IDfieldin that fragment.Upon receipt ofAfter alink fragment,SCHC fragment reception, the receiver starts constructing theoriginal unfragmentedSCHC packet. It uses the FCN and theorder ofarrival order of each SCHC fragment to determine the location of the individual fragments within theoriginal unfragmented packet. A fragment payload may carry bytes from a SCHC compressed IPv6 header, an uncompressed IPv6 header or an IPv6 datagram data payload. An unfragmented packet could be aSCHCcompressed or an uncompressed IPv6 packet (header and data).packet. For example, the receivermayMAY place the fragment payload within a payload datagram reassembly buffer at the location determinedfrom:from the FCN, the arrival order of the SCHC fragments, and the fragment payload sizes. In Window mode, the fragment receiver also uses the W bit in the received SCHC fragments. Note that the size of the original, unfragmented packet cannot be determined from fragmentation headers. Fragmentation functionality uses the FCNvalue, whichvalue to transmit the SCHC fragments. It has a length of Nbits. Thebits where the All-1 and All-0 FCN values are used to control the fragmentation transmission. The rest of the FCNwillnumbers MUST be assigned sequentially in a decreasingorder starting from 2^N-2,order, the first FCN of a window is RECOMMENDED to be MAX_WIND_FCN, i.e. the highest possible FCN value depending on the FCN number ofbits, but excluding the All-1 value.bits. In all modes, the last SCHC fragment of a packetmust containsMUST contain a MIC which is used to check if there are errors or missingfragments,SCHC fragments andmustMUST use the corresponding All-1 fragment format.Also note that,Note that a SCHC fragment with an All-0 format is considered the last SCHC fragment of the current window. If therecipientreceiver receives the last fragment of a datagram (All-1), it checks for the integrity of the reassembled datagram, based on the MIC received. InNo ACK,No-ACK, if the integrity check indicates that the reassembled datagram does not match the original datagram (prior to fragmentation), the reassembled datagram MUST be discarded. In Window mode, a MIC check is also performed by the fragment receiver after reception of each subsequent SCHC fragment retransmitted after the first MIC check.5.5.1. No ACKThere are three reliability modes: No-ACK, ACK-Always and ACK-on- Error. In ACK-Always and ACK-on-Error, a jumping window protocol uses two windows alternatively, identified as 0 and 1. A SCHC fragment with all FCN bits set to 0 (i.e. an All-0 fragment) indicates that theNo ACK modewindow is over (i.e. the SCHC fragment is the last one of the window) and allows to switch from one window to the next one. The All-1 FCN in a SCHC fragment indicates that it is the last fragment of the packet being transmitted and therefore there will not be another window for this packet. 7.5.1. No-ACK In the No-ACK mode, there is no feedback communication from the fragment receiver. The sender will send all the SCHC fragments of a packetuntil the last onewithout any possibilityto knowof knowing if errors oralosses have occurred.AsAs, in thismodemode, there isnot ano need to identify specificfragmentsSCHC fragments, a one-bit FCNis used, thereforeMAY be used. Consequently, the FCN All-0will bevalue is used in all SCHC fragments except the lastone. The latter will carryone, which carries an All-1 FCN andwill also carrythe MIC. The receiver will wait for SCHC fragments and will set the Inactivity timer. TheNo ACK modereceiver will use the MIC contained in the last SCHC fragment to checkerror.for errors. When the Inactivity Timer expires orwhenif the MIC check indicates that the reassembled packet does not match the original one, the receiver will release all resources allocated toreassembly of thereassembling this packet. The initial value of the Inactivity Timer will be determined based on the characteristics of the underlying LPWAN technology and will be defined in other documents (e.g.technology- specifictechnology-specific profile documents).5.5.2. The Window modes In Window modes, a jumping window protocol uses two windows alternatively, identified as 0 and 1. A fragment with all FCN bits set to 0 (i.e. an All-0 fragment) indicates that the window is over (i.e. the fragment is the last one of the window) and allows to switch from one window to the next one. The All-1 FCN in a fragment indicates that it is the last fragment of the packet being transmitted and therefore there will not be another window for the packet. The Window mode offers two different reliability option modes: ACK- on-error and ACK-always. 5.5.2.1.7.5.2. ACK-Always In ACK-Always, the sendersendstransmits SCHC fragments by using thetwo-jumping windowtwo- jumping-windows procedure. A delay between each SCHC fragment can be added to respectregulation ruleslocal regulations or other constraints imposed by the applications. Each time a SCHC fragment is sent, the FCN is decreased by one. When the FCN reaches value 0 and there are more SCHC fragments to besent, ansent after, the sender transmits the last SCHC fragment of this window using the All-0 fragmentis sent andformat, it starts the Retransmission Timeris set. The senderand waits for anACK to know if transmission errors have occurred. Then,ACK. On thereceiver sends an ACK reporting whether any fragments have been lost or not by settingother hand, if thecorresponding bits inFCN has reached 0 and theBitmap, otherwise, an ACK without Bitmap willSCHC fragment to besent, allowing transmission of a new window. Whentransmitted is the last SCHC fragment of thepacket is sent, anSCHC packet, the sender uses the All-1 fragment(whichformat, which includes aMIC) is used. In that case, theMIC. The sender sets the Retransmission Timerto waitand waits for the ACKcorresponding to the last window. During this period, the sender starts listeningtothe radio and starts theknow if transmission errors have occured. The RetransmissionTimer, which needs to beTimer is dimensioned based on thereceived window available for theLPWAN technology in use.IfWhen the Retransmission Timer expires, the sender sends anemptyAll-0(or anempty (resp. All-1if the last fragment has been sent)empty) fragmentis senttoaskrequest again thereceiver to resend its ACK.ACK for the window that ended with the All-0 (resp. All-1) fragment just sent. The window number is not changed. After receiving an All-0 or All-1 fragment, the receiver sends an ACK with an encoded Bitmap reporting whether any SCHC fragments have been lost or not. When the sender receives an ACK, it checks the W bit carried by the ACK. Any ACK carrying an unexpected W bit value is discarded. If the W bit value of the received ACK is correct, the sender analyzes thereceived Bitmap.rest of the ACK message, such as the encoded Bitmap and the MIC. If all the SCHC fragments sentduring thefor this window have been well received, and if at least one more SCHC fragment needs to be sent, the sendermovesadvances its sending window to the next window value and sends the next SCHC fragments. If no more SCHC fragments have to be sent, then the SCHC fragmented packet transmission is finished. However, if one or more SCHC fragments have not been received as per the ACK (i.e. the corresponding bits are not set in the encoded Bitmap) then the sender resends the missing SCHC fragments. When all missing SCHC fragments have been retransmitted, the sender starts the RetransmissionTimer (evenTimer, even if an All-0 or an All-1 has not been sentduring the retransmission)as part of this retransmission and waits for an ACK. Upon receipt of the ACK, if one or more SCHC fragments have not yet been received, the counter Attempts is increased and the sender resends the missing SCHC fragments again. When Attempts reaches MAX_ACK_REQUESTS, the sender aborts the on-going SCHC fragmented packet transmission by sending an Abort message and releases any resources for transmission of the packet. The sender also aborts an on-going SCHC fragmented packet transmission when a failed MIC check is reported by thereceiver.receiver or when a SCHC fragment that has not been sent is reported in the encoded Bitmap. On the other hand, at the beginning, the receiver side expects to receive window 0. Any SCHC fragment received but not belonging to the current window is discarded. All SCHC fragments belonging to the correct window are accepted, and the actual SCHC fragment number managed by the receiver is computed based on the FCN value. The receiver prepares the encoded Bitmap to report the correctly received and the missing SCHC fragments for the current window. After each SCHC fragment is received the receiver initializes the Inactivity timer, if the Inactivity Timer expires the transmission is aborted. When an All-0 fragment is received, it indicates that all the SCHC fragments have been sent in the current window. Since the sender is not obliged to always send a full window, some SCHC fragment number not set in the receiver memorymaySHOULD not correspond to losses. The receiver sends the corresponding ACK, the Inactivity Timer is set and the transmission of the next window by the sender can start. If an All-0 fragment has been received and all SCHC fragments of the current window have also been received, the receiver then expects a new Window and waits for the next SCHC fragment. Upon receipt of a SCHC fragment, if the window value has not changed, the received SCHC fragments are part of a retransmission. A receiver that has already received a SCHC fragmentshouldSHOULD discard it, otherwise, it updates the encoded Bitmap. If all the bits of the encoded Bitmap are set to one, the receivermayMUST send an ACK without waiting for an All-0 fragment and the Inactivity Timer is initialized. On the other hand, if the window value of the next received SCHC fragment is set to the next expected window value, this means that the sender has received a correct encoded Bitmap reporting that all SCHC fragments have been received. The receiver then updates the value of the next expected window.If the receiver receives an All-0 fragment, the sender may send one or more fragments per window. Otherwise, some fragments in the window have been lost.When an All-1 fragment is received, it indicates that the last SCHC fragment of the packet has been sent. Since the last window is not always full, the MIC will be used to detect if all SCHC fragments of the packet have been received. A correct MIC indicates the end of the transmission but the receivermustMUST stay alive for an Inactivity Timer period to answer to any empty All-1 fragments the sendermayMAY send if ACKs sent by the receiver are lost. If the MIC is incorrect, some SCHC fragments have been lost. The receiver sends the ACK regardless of successful SCHC fragmented packet reception or not, the Inactitivity Timer is set. In case of an incorrect MIC, the receiver waits for SCHC fragments belonging to the same window. After MAX_ACK_REQUESTS, the receiver will abort the on-going SCHC fragmented packettransmission.transmission by transmitting a the Receiver-Abort format. The receiver alsoAbortsaborts upon Inactivity Timer expiration.5.5.2.2. ACK-on-error7.5.3. ACK-on-Error The senders behavior for ACK-on-Error and ACK-Always are similar. TheACK-on-error sender is similar to ACK-Always, themain differencebeingis that inACK-on-errorACK-on-Error the ACK with the encoded Bitmap is not sent at the end of each window but only when at least one SCHC fragment of the current window has beenlost (with the exception oflost. Excepts for the lastwindow, see next paragraph).window where an ACK MUST be sent to finish the transmission. InAck-on-error,ACK-on-Error, the Retransmission Timer expiration will be considered as a positive acknowledgment.The Retransmission TimerThis timer is setwhenafter sending an All-0 or an All-1 fragment. When the All-1 fragment has been sent, then the on-goingfragmented packet transmissionSCHC fragmentation process is finished and the sender waits for the last ACK.At the receiver side, when the All-1 fragment is sent and the MIC check indicates successful packet reception, an ACK is also sent to confirm the end of a correct transmission.If the Retransmission Timerexpires,expires while waiting for the ACK for the last window, an All-1 empty MUST be sent to requestforthe last ACKMUST be sentby the sender to complete the SCHC fragmented packet transmission. When it expires the sender continue sending SCHC fragments of the next window. If the sender receives an ACK, it checks the window value. ACKs with an unexpected window number are discarded. If the window number on the received encoded Bitmap is correct, the sender verifies if the receiver has received all SCHC fragments of the current window. When at least one SCHC fragment has been lost, the counter Attempts is increased by one and the sender resends the missing SCHC fragments again. When Attempts reaches MAX_ACK_REQUESTS, the sender sends an Abort message and releases all resources for the on-going SCHC fragmented packet transmission. When the retransmission of the missing SCHC fragments is finished, the sender starts listening for an ACK (even if an All-0 or an All-1 has not been sent during the retransmission) and initializesand startsthe Retransmission Timer. After sending an All-1 fragment, the sender listens for an ACK, initializes Attempts, andinitializes andstarts the Retransmission Timer. If the Retransmission Timer expires, Attempts is increased by one and an empty All-1 fragment is sent to request the ACK for the last window. If Attempts reaches MAX_ACK_REQUESTS, the sender aborts the on-going SCHC fragmented packet transmissionis aborted.by transmitting the Sender-Abort fragment. Unlike the sender, the receiver forACK-on-errorACK-on-Error has a larger amount of differences compared with ACK-Always. First, an ACK is not sent unless there is a lost SCHC fragment or an unexpectedbehavior (withbehavior. With the exception of the last window, where an ACK is always sent regardless of SCHC fragment losses ornot).not. The receiver starts by expecting SCHC fragments from window 0 and maintains the information regarding which SCHC fragments it receives. After receivingaan SCHC fragment, the Inactivity Timer isset, ifset. If no further SCHC fragmenthas beenare received and the Inactivity Timerexpiresexpires, the SCHC fragment receiver aborts the on-going SCHC fragmented packet transmissionis aborted.by transmitting the Receiver-Abort data unit. Any SCHC fragment not belonging to the current window is discarded. The actual SCHC fragment number is computed based on the FCN value. When an All-0 fragment is received and all SCHC fragments have been received, the receiver updates the expected windowvalue. If an All-0 fragment is received, even if another fragment is missing, all fragments from the current window have been sent. Since the sender is not obligated to send a full window, a fragment number not used may not necessarily correspond to losses. As the receiver does not know if the missing fragments are lost or not, it sends an ACKvalue andreinitialises the Inactivity Timer. On the other hand, after receiving an All-0 fragment, the receiverexpects a new window and waits for the next SCHC fragment. If the window value of the next SCHC fragment has not changed, the received SCHC fragment is a retransmission. A receiver that has already receivedaan SCHC fragmentshoulddiscard it. If all SCHC fragments of a window (that is not the last one) have been received, the receiver does not send an ACK. While the receiver waits for the next window and if the window value is set to the next value, and if an All-1 fragment with the next value window arrived the receiveraborts the on-going fragmented packet transmission, and it drops the fragments of the aborted packet transmission. If the receiver receives an All-1 fragment, this meansknows that thetransmission should be finished. If the MIC is incorrect some fragments have been lost. Regardless of fragment losses, the receiver sends an ACK and initializes the Inactivity Timer. Reception of an All-1 fragment indicates thelast SCHC fragment of the packet has been sent. Since the last window is not always full, the MIC will be used to detect if all SCHC fragments of the window have been received. A correct MIC check indicates the end of the SCHC fragmented packet transmission. An ACK is sent by the SCHC fragment receiver. In case of an incorrect MIC, the receiver waits for SCHC fragments belonging to the same window or the expiration of the Inactivity Timer. The latter will lead the receiver to abort the on-going SCHC fragmented packet transmission.5.5.3. Bitmap Optimization The Bitmap is transmitted by a receiver as part of the ACK format when there are some missing fragments in a window. An ACK message may introduce padding at the end to align transmitted data to a byte boundary. The first byte boundary includes one or more complete bytes, depending on the size of Rule ID and DTag. Note that the ACK sent in response toIf after receiving anAll-1All-0 fragmentincludestheC bit. Therefore, the window size and thus the Bitmap size need to be determined taking into account the available space inreceiver missed some SCHC fragments, thelayer two frame payload, where there will be 1 bit less forreceiver uses an ACKsent in response to an All-1 fragment than in other ACKs. <---- Bitmap bits ----> | Rule ID | DTag |W|C|0|1|1|1|1|1|1|1|1|1|1|1|1|1|1|1|1| |--- byte boundary ----| 1 byte next | 1 byte next | Figure 18: Bitmap The Bitmap, when transmitted, MUST be optimized in size to reduce the resulting frame size. The right-most byteswithall Bitmap bits set to 1 MUST NOT be transmitted. As the receiver knows the Bitmap size, it can reconstruct the original Bitmap without this optimization. In the example Figure 19, the last 2 bytes ofthe encoded Bitmapshown in Figure 18 comprise all bits setto1, therefore,ask thelast 2 bytesretransmission of theBitmap are not sent. In the last window, when checked bit C value is 1, it means that the received MIC matches the one computed by the receiver,missing fragments andthus the Bitmap is not sent. Otherwise, the Bitmap needsexpect tobe sent afterreceive SCHC fragments with theC bit. Note thatactual window. While waiting theintroduction of a C bit may force to reduceretransmission an All-0 empty fragment is received, thenumber of fragments in a window to allowreceiver sends again thebitmap to fit in a frame. <------- R -------> <- T -> 1 +---- ... --+-... -+-+-+-+ | Rule ID | DTag |W|1|0| +---- ... --+-... -+-+-+-+ |---- byte boundary -----| Figure 19: Bitmap transmitted fragment format Figure 20 shows an example of anACK(for N=3), where the Bitmap indicates thatwith thesecond andencoded Bitmap, if thefifthSCHC fragmentshave not been correctly received. <------ R ------>6 5 4 3 2 1 0 (*) <- T -> 1 | Rule ID | DTag |W|1|0|1|1|0|1|all-0|padding| Bitmap (before tx) |--- byte boundary ----| 1 byte next | (*)=(FCN values indicating the order) +---- ... --+-... -+-+-+-+-+-+-+-+-+-+ | Rule ID | DTag |W|1|0|1|1|0|1|1|P| transmitted Bitmap +---- ... --+-... -+-+-+-+-+-+-+-+-+-+ |--- byte boundary ----| 1 byte next | Figure 20: Example of a Bitmap before transmission, and the transmitted one, in anyreceived belongs to another windowexcept the last one, for N=3 Figure 21 shows an example ofor anACK (for N=3), where the Bitmap indicates thatAll-1 fragment is received, theMIC checktransmission is aborted by sending a Receiver-Abort fragment. Once it hasfailed but there are no missing fragments. <------- R -------> 6 5 4 3 2 1 7 (*) <- T -> 1 1 | Rule ID | DTag |W|0|1|1|1|1|1|1|1|padding| Bitmap (before tx) |---- byte boundary ----| 1 byte next | 1 byte next | C +---- ... --+-... -+-+-+-+ | Rule ID | DTag |W|0|1| transmitted Bitmap +---- ... --+-... -+-+-+-+ |---- byte boundary -----| (*) = (FCN values indicating the order) Figure 21: Example ofreceived all theBitmap in Window modemissing fragments it waits for thelast window, for N=3) 5.6.next window fragments. 7.6. Supporting multiple window sizes For ACK-Always orACK-on-error,ACK-on-Error, implementersmayMAY opt to support a single window size or multiple window sizes. The latter, when feasible, may provide performance optimizations. For example, a large window sizemaySHOULD be used for packets that need to be carried by a large number of SCHC fragments. However, when the number of SCHC fragments required to carry a packet is low, a smaller window size, and thus a shorter Bitmap,mayMAY be sufficient to provide feedback on all SCHC fragments. If multiple window sizes are supported, the Rule IDmayMAY be used to signal the window size in use for a specific packet transmission. Note that the same window size MUST be used for the transmission of all SCHC fragments that belong toathe same SCHC packet.5.7.7.7. Downlink SCHC fragment transmission In some LPWAN technologies, as part of energy-saving techniques, downlink transmission is only possible immediately after an uplink transmission. In order to avoid potentially high delayfor fragmented datagram transmissionin thedownlink,downlink transmission of a SCHC fragmented datagram, the SCHC fragment receiver MAY perform an uplink transmission as soon as possible after reception of a SCHC fragment that is not the last one. Such uplink transmissionmayMAY be triggered by the L2 (e.g. an L2 ACK sent in response to a SCHC fragment encapsulated in a L2 frame that requires an L2 ACK) or itmayMAY be triggered from an upper layer. For downlink transmission of a SCHC fragmented packettransmissionin ACK-Always mode, thedownlink, and when ACK Always is used, theSCHC fragment receiver MAY support timer-basedACK retransmission.ACKretransmission. In this mechanism, the SCHC fragment receiver initializes and starts a timer (the Inactivity Timer is used) after the transmission of an ACK, except when the ACK is sent in response to the last SCHC fragment of a packet (All-1 fragment). In the latter case, the SCHC fragment receiver does not start a timer after transmission of the ACK. If, after transmission of an ACK that is not an All-1 fragment, and before expiration of the corresponding Inactivity timer, the SCHC fragment receiver receives a SCHC fragment that belongs to the current window (e.g. a missing SCHC fragment from the current window) or to the next window, the Inactivity timer for the ACK is stopped. However, if the Inactivity timer expires, the ACK is resent and the Inactivity timer is reinitialized and restarted. The default initial value for the Inactivity timer, as well as the maximum number of retries for a specific ACK, denoted MAX_ACK_RETRIES, are not defined in this document, and need to be defined in other documents (e.g. technology-specific profiles). The initial value of the Inactivity timer is expected to be greater than that of the Retransmission timer, in order to make sure that a (buffered) SCHC fragment to be retransmitted can find an opportunity for that transmission. When the SCHC fragment sender transmits the All-1 fragment, itinitializes andstarts itsretransmission timer toRetransmission Timer with alonglarge timeout value (e.g. several times that of the initial Inactivity timer). If an ACK is received before expiration of this timer, the SCHC fragment sender retransmits any lost SCHC fragments reported by the ACK, or if the ACK confirms successful reception of all SCHC fragments of the last window, the transmission of the SCHC fragmented packetends.is considered complete. If the timer expires, and no ACK has been received since the start of the timer, the SCHC fragment sender assumes that the All-1 fragment has been successfully received (and possibly, the last ACK has been lost: this mechanism assumes that the retransmission timer for the All-1 fragment is long enough to allow several ACK retries if the All-1 fragment has not been received by the SCHC fragment receiver, and it also assumes that it is unlikely that several ACKs become all lost).6.8. Padding managementSCHC header, eitherDefault padding is defined for L2 frame with a variable length of bytes. Padding is done twice, after compression and in the all-1 fragmentation. In compression,fragmentation or acknowledgment doesthe rule and the compression residues are notpreservealigned on a byte, but payload following the residue is always a multiple of 8 bits. In that case, padding bits can be added after the payload to reach the first bytealignment.boundary. Sincemostthe rule and the residue give the length of theLPWAN network technologiesSCHC header and payload isexpressed in an integer numberalways a multiple ofbytes;8 bits, thesender will introduce atreceiver can without ambiguity remove theend somepadding bitswhile the receiver must be able to eliminate them. The algorithm for padding bit elimination for compressed or fragmented frames is simple. Basedwhich never excide 7 bits. SCHC fragmentation works onthe following principle: * Thea byte aligned (i.e. padded SCHC packet). Fragmentation headerismay not be aligned onabyte boundary, butits size ineach fragment except the last one (All-1 fragment) must sent the maximum bitsis given byas possible. Only therule. o The data sizelast fragment need to introduce padding to reach the next boundary limit. Since the SCHC isvariable, but alwaysknown to be a multiple of 8bits. o Padding bits MUST never exceed 7 bits. In that case, abits, the receiverafter decodingcan remove theSCHC header, must takeextra bit to reach this limit. Default padding mechanism do not need to send the padding length and can lead to a maximummultipleof8 bits as data. The remaining14 bitsare padding bits. 7.of padding. 9. SCHC Compression for IPv6 and UDP headers This section lists the different IPv6 and UDP header fields and how they can be compressed.7.1.9.1. IPv6 version field This field always holds the same value. Therefore, in the rule, TV is set to 6,theMOisto "equal" andthe "CDACDA to "not-sent".7.2.9.2. IPv6 Traffic class field If the DiffServ fieldidentified by the rest of the ruledoes not vary and is known by both sides, theTV shouldField Descriptor in the rule SHOULD contain a TV with thiswell- knownwell-known value,the MO should bean "equal" MO andthe CDA must be "not-sent. If the DiffServ field identified by the rest of the rule varies over time or is not known by both sides, then there area "not-sent" CDA. Otherwise, two possibilities can be considered depending on the variability of the value:The first oneo One possibility is todonotcompressedcompress the field andsendssend the original value. In thesecond, where the values can be computed by sending only the LSB bits: orule, TV is not set to any particular value, MO is set to "ignore" and CDA is set to"value-sent""value-sent". o If some upper bits in the field are constant and known, a better option is to only send the LSBs. In the rule, TVcontainsis set to a value with the stablevalue,known upper part, MO isMSB(X)set to MSB(x) and CDAis settoLSB 7.3.LSB(y). 9.3. Flow label field If the Flow Label fieldidentified by the rest of the ruledoes not vary and is known by both sides, theTV shouldField Descriptor in the rule SHOULD contain a TV with thiswell- knownwell-known value,the MO should bean "equal" MO andthe CDA shoulda "not-sent" CDA. Otherwise, two possibilities can be"not- sent". If the Flow Label field identified by the rest of the rule varies during time orconsidered: o One possibility is to notknown by both sides, there are two possibilities depending on the variability ofcompress thevalue: The first one is without compressionfield andthensend thevalue is sent.original value. In thesecond, only part of the value is sent and the decompressor needs to compute the original value: orule, TV is notset,set to any particular value, MO is set to "ignore" and CDA is set to"value- sent""value-sent". o If some upper bits in the field are constant and known, a better option is to only send the LSBs. In the rule, TVcontainsis set to a value with the stablevalue,known upper part, MO isMSB(X)set to MSB(x) and CDAis settoLSB 7.4.LSB(y). 9.4. Payload Length fieldIf the LPWAN technology does not add padding, thisThis field can be elided for the transmission on the LPWAN network. The SCHC C/D recomputes the original payload length value.TheIn the Field Descriptor, TV is not set,theMO is set to "ignore" andtheCDA is "compute-IPv6-length". If the payload length needs to be sent and does not need to be coded in 16 bits, the TV can be set to 0x0000, the MO set to"MSB (16-s)" andMSB(16-s) where 's' is theCDAnumber of bits to"LSB". The 's' parameter depends oncode theexpectedmaximumpacket length. In other cases, the payload length field must be sentlength, andtheCDA isreplaced by "value-sent". 7.5.set to LSB(s). 9.5. Next Header field If the Next Header fieldidentified by the rest of the ruledoes not vary and is known by both sides, theTV shouldField Descriptor in the rule SHOULD contain a TV with this Next Header value, the MOshouldSHOULD be "equal" and the CDAshouldSHOULD be "not- sent".If the Next Header field identified by the rest of the rule varies during time or is not known by both sides, thenOtherwise, TV is notset,set in the Field Descriptor, MO is set to "ignore" and CDA is set to "value-sent".A matching-list mayAlternatively, a matching- list MAY also be used.7.6.9.6. Hop Limit field TheEnd System is generally a device and does not forward packets. Therefore, the Hop Limit value is constant. So, the TV is set with a default value, the MO is set to "equal" and the CDA is set to "not- sent". Otherwise the value is sent on the LPWAN: TV is not set, MO is set to ignore and CDA is set to "value-sent". Note that thefield behaviordiffers in upstreamfor this field is different for Uplink anddownstream.Downlink. Inupstream,Uplink, since there is no IP forwarding between the Dev and the SCHC C/D, the value is relatively constant. On the other hand, thedownstreamDownlink value depends of Internet routing andmayMAY change more frequently. Onesolution could beneat way of processing this field is to use the Direction Indicator (DI) to distinguish bothdirections todirections: o in the Uplink, elide thefieldfield: the TV in theupstream directionField Descriptor is set to the known constant value, the MO is set to "equal" andsendthevalueCDA is set to "not-sent". o in thedownstream direction. 7.7.Downlink, send the value: TV is not set, MO is set to "ignore" and CDA is set to "value-sent". 9.7. IPv6 addresses fields As in 6LoWPAN [RFC4944], IPv6 addresses aresplittedsplit into two 64-bit long fields; one for the prefix and one for the Interface Identifier (IID). These fieldsshouldSHOULD be compressed. To allow for a singlerule,rule being used for both directions, these values are identified by their role (DEV or APP) and not by their position in the frame (source or destination).The SCHC C/D must be aware of the traffic direction (upstream, downstream) to select the appropriate field. 7.7.1.9.7.1. IPv6 source and destination prefixes Both endsmustMUST be synchronized with the appropriate prefixes. For a specific flow, the source and destination prefixes can be unique and stored in the context. It can be either a link-local prefix or a global prefix. In that case, the TV for the source and destination prefixes contain the values, the MO is set to "equal" and the CDA is set to "not-sent".In caseIf the ruleallows several prefixes, mapping-list mustis intended to compress packets with different prefix values, match-mapping SHOULD be used. The different prefixes are listed in theTV associated with a short ID. TheTV, the MO is set to "match-mapping" and the CDA is set to"mapping- sent". Otherwise"mapping-sent". See Figure 25 Otherwise, the TV contains the prefix, the MO is set to "equal" and the CDA is set to "value-sent".7.7.2.9.7.2. IPv6 source and destination IID If the DEV or APP IID are based on an LPWAN address, then the IID can be reconstructed with information coming from the LPWAN header. In that case, the TV is not set, the MO is set to "ignore" and the CDA is set to "DEViid" or "APPiid". Note that the LPWAN technologyisgenerallycarryingcarries a singledeviceidentifier corresponding to the DEV.The SCHC C/D may also notTherefore Appiid cannot beaware of these values. Ifused. For privacy reasons or if the DEV addresshasis changing over time, a static value that is notderived from an IEEE EUI-64, thenequal to the DEV address SHOULD be used. In that case, the TV contains theactual Dev addressstatic value, the MO operator is set to "equal" and theCDACDF is set to "not-sent". [RFC7217] provides some methods that MAY be used to derive this static identifier. If several IIDs are possible, then the TV contains the list of possible IIDs, the MO is set to "match-mapping" and the CDA is set to "mapping-sent".Otherwise the value variation ofIt MAY also happen that the IIDmay be reduced tovariability only expresses itself on a few bytes. In that case, the TV is set to the stable part of the IID, the MO is set to "MSB" and the CDA is set to "LSB". Finally, the IID can be sent in extenso on the LPWAN. In that case, the TV is not set, the MO is set to "ignore" and the CDA is set to"value- sent". 7.8."value-sent". 9.8. IPv6 extensions Noextension rules arerule is currentlydefined. Theydefined that processes IPv6 extensions. If such extensions are needed, their compression/decompression rules can be based on the MOs and CDAs described above.7.9.9.9. UDP source and destination port To allow for a singlerule,rule being used for both directions, the UDP port values are identified by their role (DEV or APP) and not by their position in the frame (source or destination). The SCHC C/DmustMUST be aware of the traffic direction(upstream, downstream)(Uplink, Downlink) to select the appropriate field. The following rules apply for DEV and APP port numbers. If both ends know the port number, it can be elided. The TV contains the port number, the MO is set to "equal" and the CDA is set to "not- sent". If the port variation is on few bits, the TV contains the stable part of the port number, the MO is set to "MSB" and the CDA is set to "LSB". If some well-known values are used, the TV can contain the list of these values, the MO is set to "match-mapping" and the CDA is set to "mapping-sent". Otherwise the port numbers are sentonover the LPWAN. The TV is not set, the MO is set to "ignore" and the CDA is set to "value-sent".7.10.9.10. UDP length fieldIf the LPWAN technology does not introduce padding, theThe UDP length can be computed from the received data. In that case, the TV is not set, the MO is set to "ignore" and the CDA is set to"compute-UDP- length"."compute-length". If the payload is small, the TV can be set to 0x0000, the MO set to "MSB" and the CDA to "LSB".OnIn other cases, the lengthmustSHOULD be sent and the CDA is replaced by "value-sent".7.11.9.11. UDP Checksum field IPv6 mandates a checksum in the protocol above IP. Nevertheless, if a more efficient mechanism such as L2 CRC or MIC is carried by or over the L2 (such as in the LPWAN SCHC fragmentation process (see Section5)),7)), the UDP checksum transmission can be avoided. In that case, the TV is not set, the MO is set to "ignore" and the CDA is set to"compute-UDP-checksum"."compute-checksum". In other cases, the checksummustSHOULD be explicitly sent. The TV is not set, the MO is set to "ignore" and the CDF is set to"value-sent". 8."value- sent". 10. Security considerations8.1.10.1. Security considerations for header compression A malicious header compression could cause the reconstruction of a wrong packet that does not match with the originalone, suchone. Such a corruptionmayMAY be detected with end-to-end authentication and integrity mechanisms.Denial of Service may be produced but its arise otherHeader Compression does not add more securityproblems that may be solved with or without header compression. 8.2.problem than what is already needed in a transmission. For instance, to avoid an attack, never re-construct a packet bigger than some configured size (with 1500 bytes as generic default). 10.2. Security considerations for SCHC fragmentation This subsection describes potential attacks to LPWAN SCHC fragmentation and suggests possible countermeasures. A node can perform a buffer reservation attack by sending a first SCHC fragment to a target. Then, the receiver will reserve buffer space for the IPv6 packet. Other incoming SCHC fragmented packets will be dropped while the reassembly buffer is occupied during the reassembly timeout. Once that timeout expires, the attacker can repeat the same procedure, and iterate, thus creating a denial of service attack. The (low) cost to mount this attack is linear with the number of buffers at the target node. However, the cost for an attacker can be increased if individual SCHC fragments of multiple packets can be stored in the reassembly buffer. To further increase the attack cost, the reassembly buffer can be splitted into SCHC fragment-sized buffer slots. Once a packet is complete, it is processed normally. If buffer overload occurs, a receiver can discard packets based on the sender behavior, whichmayMAY help identify which SCHC fragments have been sent by an attacker. In another type of attack, the malicious node is required to have overhearing capabilities. If an attacker can overhear a SCHC fragment, it can send a spoofed duplicate (e.g. with random payload) to the destination. If the LPWAN technology does not support suitable protection (e.g. source authentication and frame counters to prevent replay attacks), a receiver cannot distinguish legitimate from spoofed SCHC fragments. Therefore, the original IPv6 packet will be considered corrupt and will be dropped. To protect resource- constrained nodes from this attack, it has been proposed to establish a binding among the SCHC fragments to be transmitted by a node, by applying content-chaining to the different SCHC fragments, based on cryptographic hash functionality. The aim of this technique is to allow a receiver to identify illegitimate SCHC fragments. Further attacksmayMAY involve sending overlapped fragments (i.e. comprising some overlapping parts of the original IPv6 datagram). ImplementersshouldSHOULD make sure that the correct operation is not affected by such event. In Window mode - ACK on error, a malicious nodemayMAY force a SCHC fragment sender to resend a SCHC fragment a number of times, with the aim to increase consumption of the SCHC fragment sender's resources. To this end, the malicious nodemayMAY repeatedly send a fake ACK to the SCHC fragment sender, with a Bitmap that reports that one or more SCHC fragments have been lost. In order to mitigate this possible attack,MAX_FRAG_RETRIES mayMAX_ACK_RETRIES MAY be set to a safe value which allows to limit the maximum damage of the attack to an acceptable extent. However, note that a high setting forMAX_FRAG_RETRIESMAX_ACK_RETRIES benefits SCHC fragmentdelivery reliability,reliability modes, therefore the trade-off needs to be carefully considered.9.11. Acknowledgements Thanks to Dominique Barthel, Carsten Bormann, Philippe Clavier, Eduardo Ingles Sanchez, Arunprabhu Kandasamy, Rahul Jadhav, Sergio Lopez Bernal, Antony Markovski, Alexander Pelov, Pascal Thubert, Juan CarlosZuniga andZuniga, DiegoDujovneDujovne, Edgar Ramos, and Shoichi Sakane for useful design consideration and comments.10.12. References10.1.12.1. Normative References [RFC2460] Deering, S. and R. Hinden, "Internet Protocol, Version 6 (IPv6) Specification", RFC 2460, DOI 10.17487/RFC2460, December 1998, <https://www.rfc-editor.org/info/rfc2460>. [RFC3385] Sheinwald, D., Satran, J., Thaler, P., and V. Cavanna, "Internet Protocol Small Computer System Interface (iSCSI) Cyclic Redundancy Check (CRC)/Checksum Considerations", RFC 3385, DOI 10.17487/RFC3385, September 2002, <https://www.rfc-editor.org/info/rfc3385>. [RFC4944] Montenegro, G., Kushalnagar, N., Hui, J., and D. Culler, "Transmission of IPv6 Packets over IEEE 802.15.4 Networks", RFC 4944, DOI 10.17487/RFC4944, September 2007, <https://www.rfc-editor.org/info/rfc4944>. [RFC5795] Sandlund, K., Pelletier, G., and L-E. Jonsson, "The RObust Header Compression (ROHC) Framework", RFC 5795, DOI 10.17487/RFC5795, March 2010, <https://www.rfc-editor.org/info/rfc5795>. [RFC7136] Carpenter, B. and S. Jiang, "Significance of IPv6 Interface Identifiers", RFC 7136, DOI 10.17487/RFC7136, February 2014, <https://www.rfc-editor.org/info/rfc7136>.10.2.[RFC7217] Gont, F., "A Method for Generating Semantically Opaque Interface Identifiers with IPv6 Stateless Address Autoconfiguration (SLAAC)", RFC 7217, DOI 10.17487/RFC7217, April 2014, <https://www.rfc-editor.org/info/rfc7217>. 12.2. Informative References [I-D.ietf-lpwan-overview] Farrell, S., "LPWAN Overview", draft-ietf-lpwan-overview-07overview-10 (work in progress),October 2017.February 2018. Appendix A. SCHC Compression Examples This section gives some scenarios of the compression mechanism for IPv6/UDP. The goal is to illustrate theSCHC behavior.behavior of SCHC. The most common case using the mechanisms defined in this document will be a LPWAN Dev that embeds some applications running over CoAP. In this example, three flows are considered. The first flow is for the device management based on CoAP using Link Local IPv6 addresses and UDP ports 123 and 124 for Dev and App, respectively. The second flow will be a CoAP server for measurements done by the Device (using ports 5683) and Global IPv6 Address prefixes alpha::IID/64 to beta::1/64. The last flow is for legacy applications using different ports numbers, the destination IPv6 address prefix is gamma::1/64. Figure2224 presents the protocol stack for this Device. IPv6 and UDP are represented with dotted lines since these protocols are compressed on the radio link. Management Data +----------+---------+---------+ | CoAP | CoAP | legacy | +----||----+---||----+---||----+ . UDP . UDP | UDP | ................................ . IPv6 . IPv6 . IPv6 . +------------------------------+ | SCHC Header compression | | and fragmentation | +------------------------------+ | LPWAN L2 technologies | +------------------------------+ DEV or NGW Figure22:24: Simplified Protocol Stack for LP-WAN Note that in some LPWAN technologies, only the Devs have a device ID. Therefore, when such technologies are used, it is necessary todefinestatically define an IID for the Link Local address for the SCHC C/D. Rule 0 +----------------+--+--+--+---------+--------+------------++------+ | Field |FL|FP|DI| Value | Match | Comp Decomp|| Sent | | | | | | | Opera. | Action ||[bits]| +----------------+--+--+--+---------+---------------------++------+ |IPv6 version |4 |1 |Bi|6 | equal | not-sent || | |IPv6 DiffServ |8 |1 |Bi|0 | equal | not-sent || | |IPv6 Flow Label |20|1 |Bi|0 | equal | not-sent || | |IPv6 Length |16|1 |Bi| | ignore | comp-length|| | |IPv6 Next Header|8 |1 |Bi|17 | equal | not-sent || | |IPv6 Hop Limit |8 |1 |Bi|255 | ignore | not-sent || | |IPv6 DEVprefix |64|1 |Bi|FE80::/64| equal | not-sent || | |IPv6 DEViid |64|1 |Bi| | ignore | DEViid || | |IPv6 APPprefix |64|1 |Bi|FE80::/64| equal | not-sent || | |IPv6 APPiid |64|1 |Bi|::1 | equal | not-sent || | +================+==+==+==+=========+========+============++======+ |UDP DEVport |16|1 |Bi|123 | equal | not-sent || | |UDP APPport |16|1 |Bi|124 | equal | not-sent || | |UDP Length |16|1 |Bi| | ignore | comp-length|| | |UDP checksum |16|1 |Bi| | ignore | comp-chk || | +================+==+==+==+=========+========+============++======+ Rule 1 +----------------+--+--+--+---------+--------+------------++------+ | Field |FL|FP|DI| Value | Match | Action || Sent | | | | | | | Opera. | Action ||[bits]| +----------------+--+--+--+---------+--------+------------++------+ |IPv6 version |4 |1 |Bi|6 | equal | not-sent || | |IPv6 DiffServ |8 |1 |Bi|0 | equal | not-sent || | |IPv6 Flow Label |20|1 |Bi|0 | equal | not-sent || | |IPv6 Length |16|1 |Bi| | ignore | comp-length|| | |IPv6 Next Header|8 |1 |Bi|17 | equal | not-sent || | |IPv6 Hop Limit |8 |1 |Bi|255 | ignore | not-sent || | |IPv6 DEVprefix |64|1 |Bi|[alpha/64, match- |mapping-sent|| [1] | | | | | |fe80::/64] mapping| || | |IPv6 DEViid |64|1 |Bi| | ignore | DEViid || | |IPv6 APPprefix |64|1 |Bi|[beta/64,| match- |mapping-sent|| [2] | | | | | |alpha/64,| mapping| || | | | | | |fe80::64]| | || | |IPv6 APPiid |64|1 |Bi|::1000 | equal | not-sent || | +================+==+==+==+=========+========+============++======+ |UDP DEVport |16|1 |Bi|5683 | equal | not-sent || | |UDP APPport |16|1 |Bi|5683 | equal | not-sent || | |UDP Length |16|1 |Bi| | ignore | comp-length|| | |UDP checksum |16|1 |Bi| | ignore | comp-chk || | +================+==+==+==+=========+========+============++======+ Rule 2 +----------------+--+--+--+---------+--------+------------++------+ | Field |FL|FP|DI| Value | Match | Action || Sent | | | | | | | Opera. | Action ||[bits]|+----------------+--+--+--+---------+--------+-------------++------++----------------+--+--+--+---------+--------+------------++------+ |IPv6 version |4 |1 |Bi|6 | equal | not-sent || | |IPv6 DiffServ |8 |1 |Bi|0 | equal | not-sent || | |IPv6 Flow Label |20|1 |Bi|0 | equal | not-sent || | |IPv6 Length |16|1 |Bi| | ignore | comp-length|| | |IPv6 Next Header|8 |1 |Bi|17 | equal | not-sent || | |IPv6 Hop Limit |8 |1 |Up|255 | ignore | not-sent || | |IPv6 Hop Limit |8 |1 |Dw| | ignore | value-sent || [8] | |IPv6 DEVprefix |64|1 |Bi|alpha/64 | equal | not-sent || | |IPv6 DEViid |64|1 |Bi| | ignore | DEViid || | |IPv6 APPprefix |64|1 |Bi|gamma/64 | equal | not-sent || | |IPv6 APPiid |64|1 |Bi|::1000 | equal | not-sent || | +================+==+==+==+=========+========+============++======+ |UDP DEVport |16|1 |Bi|8720 | MSB(12)| LSB(4) || [4] | |UDP APPport |16|1 |Bi|8720 | MSB(12)| LSB(4) || [4] | |UDP Length |16|1 |Bi| | ignore | comp-length|| | |UDP checksum |16|1 |Bi| | ignore | comp-chk || | +================+==+==+==+=========+========+============++======+ Figure23:25: Context rules All the fields described in the three rules depicted on Figure2325 are present in the IPv6 and UDP headers. The DEViid-DID value is found in the L2 header. The second and third rules use global addresses. The way the Dev learns the prefix is not in the scope of the document. The third rule compresses port numbers to 4 bits. Appendix B. Fragmentation Examples This section provides examplesoffor the different fragmentdeliveryreliabilityoptions possible on the basis ofmodes specified in thisspecification.document. Figure2426 illustrates the transmission in No-ACK mode of an IPv6 packet that needs 11fragments in the No ACK option. Wherefragments. FCN isalways1bit.bit wide. Sender Receiver |-------FCN=0-------->| |-------FCN=0-------->| |-------FCN=0-------->| |-------FCN=0-------->| |-------FCN=0-------->| |-------FCN=0-------->| |-------FCN=0-------->| |-------FCN=0-------->| |-------FCN=0-------->| |-------FCN=0-------->||-------FCN=1-------->|MIC checked|-----FCN=1 + MIC --->|MIC checked: success => Figure24:26: Transmission in No-ACK mode of an IPv6 packet carried by 11 fragmentsinIn theNo ACK optionfollowing examples, N (i.e. the size if the FCN field) is 3 bits. Therefore, the All-1 FCN value is 7. Figure2527 illustrates the transmission in ACK-on-Error of an IPv6 packet that needs 11fragments in ACK-on-error, for N=3, without losses.fragments, with MAX_WIND_FCN=6 and no fragment loss. Sender Receiver |-----W=0, FCN=6----->| |-----W=0, FCN=5----->| |-----W=0, FCN=4----->| |-----W=0, FCN=3----->| |-----W=0, FCN=2----->| |-----W=0, FCN=1----->| |-----W=0, FCN=0----->| (no ACK) |-----W=1, FCN=6----->| |-----W=1, FCN=5----->| |-----W=1, FCN=4----->||-----W=1, FCN=7----->|MIC checked|--W=1, FCN=7 + MIC-->|MIC checked: success => |<---- ACK, W=1 ------| Figure25:27: Transmission in ACK-on-Error mode of an IPv6 packet carried by 11fragments in ACK-on-error, for N=3fragments, with MAX_WIND_FCN=6 andMAX_WIND_FCN=6, without losses.no loss. Figure2628 illustrates the transmission in ACK-on-Error mode of an IPv6 packet that needs 11fragments ACK-on-error, for N=3,fragments, with MAX_WIND_FCN=6 and threelosses.lost fragments. Sender Receiver |-----W=0, FCN=6----->| |-----W=0, FCN=5----->| |-----W=0, FCN=4--X-->| |-----W=0, FCN=3----->| |-----W=0, FCN=2--X-->| 7 |-----W=0, FCN=1----->| / |-----W=0, FCN=0----->| 6543210 |<-----ACK, W=0-------|Bitmap:1101011 |-----W=0, FCN=4----->| |-----W=0, FCN=2----->| (no ACK) |-----W=1, FCN=6----->| |-----W=1, FCN=5----->| |-----W=1, FCN=4--X-->||-----W=1, FCN=7----->|MIC checked|- W=1, FCN=7 + MIC ->|MIC checked: failed |<-----ACK, W=1-------|C=0 Bitmap:1100001 |-----W=1, FCN=4----->|MICcheckedchecked: success => |<---- ACK, W=1------|------|C=1, no Bitmap Figure26:28: Transmission in ACK-on-Error mode of an IPv6 packet carried by 11fragments in ACK-on-error, for N=3fragments, with MAX_WIND_FCN=6 andMAX_WIND_FCN=6,threelosses.lost fragments. Figure2729 illustrates the transmission in ACK-Always mode of an IPv6 packet that needs 11fragments in ACK-Always, for N=3fragments, with MAX_WIND_FCN=6 andMAX_WIND_FCN=6, without losses. Note: in Window mode, an additional bit will be needed to number windows.no loss. Sender Receiver |-----W=0, FCN=6----->| |-----W=0, FCN=5----->| |-----W=0, FCN=4----->| |-----W=0, FCN=3----->| |-----W=0, FCN=2----->| |-----W=0, FCN=1----->| |-----W=0, FCN=0----->| |<-----ACK, W=0-------| Bitmap:1111111 |-----W=1, FCN=6----->| |-----W=1, FCN=5----->| |-----W=1, FCN=4----->||-----W=1, FCN=7----->|MIC checked|--W=1, FCN=7 + MIC-->|MIC checked: success => |<-----ACK, W=1-------| C=1 no Bitmap (End) Figure27:29: Transmission in ACK-Always mode of an IPv6 packet carried by 11fragments in ACK-Always, for N=3fragments, with MAX_WIND_FCN=6 andMAX_WIND_FCN=6,nolosses.lost fragment. Figure2830 illustrates the transmission in ACK-Always mode of an IPv6 packet that needs 11fragments in ACK-Always, for N=3 and MAX_WIND_FCN=6,fragments, with MAX_WIND_FCN=6 and threelosses.lost fragments. Sender Receiver |-----W=1, FCN=6----->| |-----W=1, FCN=5----->| |-----W=1, FCN=4--X-->| |-----W=1, FCN=3----->| |-----W=1, FCN=2--X-->| 7 |-----W=1, FCN=1----->| / |-----W=1, FCN=0----->| 6543210 |<-----ACK, W=1-------|Bitmap:1101011 |-----W=1, FCN=4----->| |-----W=1, FCN=2----->| |<-----ACK, W=1-------|Bitmap: |-----W=0, FCN=6----->| |-----W=0, FCN=5----->| |-----W=0, FCN=4--X-->||-----W=0, FCN=7----->|MIC checked|--W=0, FCN=7 + MIC-->|MIC checked: failed |<-----ACK, W=0-------| C= 0 Bitmap:11000001 |-----W=0, FCN=4----->|MICcheckedchecked: success => |<-----ACK, W=0-------| C= 1 no Bitmap (End) Figure28:30: Transmission in ACK-Always mode of an IPv6 packet carried by 11fragments in ACK-Always, for N=3, and MAX_WIND_FCN=6,fragments, with MAX_WIND_FCN=6 and threelosses.lost fragments. Figure2931 illustrates the transmission in ACK-Always mode of an IPv6 packet that needs 6fragments in ACK-Always, for N=3 and MAX_WIND_FCN=6,fragments, with MAX_WIND_FCN=6, threelosses,lost fragments and only one retryisneededforto recover each lost fragment.Note that, since a single window is needed for transmission of the IPv6 packet in this case, the example illustrates behavior when losses happen in the last window.Sender Receiver |-----W=0,CFN=6----->| |-----W=0, CFN=5----->|FCN=6----->| |-----W=0,CFN=4--X-->|FCN=5----->| |-----W=0,CFN=3--X-->|FCN=4--X-->| |-----W=0,CFN=2--X-->|FCN=3--X-->| |-----W=0,CFN=7----->|MIC checkedFCN=2--X-->| |--W=0, FCN=7 + MIC-->|MIC checked: failed |<-----ACK, W=0-------|C= 0 Bitmap:1100001 |-----W=0,CFN=4----->|MICFCN=4----->|MIC checked: failed |-----W=0,CFN=3----->|MICFCN=3----->|MIC checked: failed |-----W=0,CFN=2----->|MICFCN=2----->|MIC checked: success |<-----ACK, W=0-------|C=1 no Bitmap (End) Figure29:31: Transmission in ACK-Always mode of an IPv6 packet carried by 11fragments in ACK-Always, for N=3, and MAX_WIND_FCN=6,fragments, with MAX_WIND_FCN=6, threelosses,lost framents and only one retryisneeded for each lost fragment. Figure3032 illustrates the transmission in ACK-Always mode of an IPv6 packet that needs 6fragments in ACK-Always, for N=3 and MAX_WIND_FCN=6,fragments, with MAX_WIND_FCN=6, threelosses,lost fragments, and the second ACKislost.Note that, since a single window is needed for transmission of the IPv6 packet in this case, the example illustrates behavior when losses happen in the last window.Sender Receiver |-----W=0,CFN=6----->| |-----W=0, CFN=5----->|FCN=6----->| |-----W=0,CFN=4--X-->|FCN=5----->| |-----W=0,CFN=3--X-->|FCN=4--X-->| |-----W=0,CFN=2--X-->|FCN=3--X-->| |-----W=0,CFN=7----->|MIC checkedFCN=2--X-->| |--W=0, FCN=7 + MIC-->|MIC checked: failed |<-----ACK, W=0-------|C=0 Bitmap:1100001 |-----W=0,CFN=4----->|MICFCN=4----->|MIC checked:wrongfailed |-----W=0,CFN=3----->|MICFCN=3----->|MIC checked:wrongfailed |-----W=0,CFN=2----->|MICFCN=2----->|MIC checked:rightsuccess | X---ACK, W=0-------|C= 1 no Bitmap timeout | ||-----W=0, CFN=7----->||--W=0, FCN=7 + MIC-->| |<-----ACK, W=0-------|C= 1 no Bitmap (End) Figure30:32: Transmission in ACK-Always mode of an IPv6 packet carried by 11fragments in ACK-Always, for N=3, and MAX_WIND_FCN=6,fragments, with MAX_WIND_FCN=6, threelosses,lost fragments, and the second ACKislost. Figure3133 illustrates the transmission in ACK-Always mode of an IPv6 packet that needs 6fragments in ACK-Always, for N=3 andfragments, with MAX_WIND_FCN=6, with threelosses,lost fragments, and one retransmitted fragmentis lost. Note that, since a single window is needed for transmission of the IPv6 packet in this case, the example illustrates behavior when losses happen in the last window.lost again. Sender Receiver |-----W=0,CFN=6----->| |-----W=0, CFN=5----->|FCN=6----->| |-----W=0,CFN=4--X-->|FCN=5----->| |-----W=0,CFN=3--X-->|FCN=4--X-->| |-----W=0,CFN=2--X-->|FCN=3--X-->| |-----W=0,CFN=7----->|MIC checkedFCN=2--X-->| |--W=0, FCN=7 + MIC-->|MIC checked: failed |<-----ACK, W=0-------|C=0 Bitmap:1100001 |-----W=0,CFN=4----->|MICFCN=4----->|MIC checked:wrongfailed |-----W=0,CFN=3----->|MICFCN=3----->|MIC checked:wrongfailed |-----W=0,CFN=2--X-->|FCN=2--X-->| timeout| ||-----W=0, CFN=7----->|All-0|--W=0, FCN=7 + MIC-->|All-0 empty |<-----ACK, W=0-------|C=0 Bitmap: 1111101 |-----W=0,CFN=2----->|MICFCN=2----->|MIC checked:rightsuccess |<-----ACK, W=0-------|C=1 no Bitmap (End) Figure31:33: Transmission in ACK-Always mode of an IPv6 packet carried by 11fragments in ACK-Always, for N=3, andfragments, with MAX_WIND_FCN=6, with threelosses,lost fragments, and one retransmitted fragmentis lost. Appendix Clost again. Figure 34 illustrates the transmission in ACK-Always mode of an IPv6 packet that needs 28fragments in ACK-Always, for N=5 and MAX_WIND_FCN=23,fragments, with N=5, MAX_WIND_FCN=23 and twolosses.lost fragments. Note that MAX_WIND_FCN=23 may be useful when the maximum possible Bitmap size, considering the maximum lower layer technology payload size and the value of R, is 3 bytes. Note also that the FCN of the last fragment of the packet is the one with FCN=31 (i.e. FCN=2^N-1 for N=5, or equivalently, all FCN bits set to 1). Sender Receiver |-----W=0,CFN=23----->|FCN=23----->| |-----W=0,CFN=22----->|FCN=22----->| |-----W=0,CFN=21--X-->|FCN=21--X-->| |-----W=0,CFN=20----->|FCN=20----->| |-----W=0,CFN=19----->|FCN=19----->| |-----W=0,CFN=18----->|FCN=18----->| |-----W=0,CFN=17----->|FCN=17----->| |-----W=0,CFN=16----->|FCN=16----->| |-----W=0,CFN=15----->|FCN=15----->| |-----W=0,CFN=14----->|FCN=14----->| |-----W=0,CFN=13----->|FCN=13----->| |-----W=0,CFN=12----->|FCN=12----->| |-----W=0,CFN=11----->|FCN=11----->| |-----W=0,CFN=10--X-->|FCN=10--X-->| |-----W=0,CFN=9FCN=9 ----->| |-----W=0,CFN=8FCN=8 ----->| |-----W=0,CFN=7FCN=7 ----->| |-----W=0,CFN=6FCN=6 ----->| |-----W=0,CFN=5FCN=5 ----->| |-----W=0,CFN=4FCN=4 ----->| |-----W=0,CFN=3FCN=3 ----->| |-----W=0,CFN=2FCN=2 ----->| |-----W=0,CFN=1FCN=1 ----->| |-----W=0,CFN=0FCN=0 ----->| | |lcl-Bitmap:110111111111101111111111 |<------ACK,W=0-------|W=0-------|encoded Bitmap:1101111111111011 |-----W=0,CFN=21----->|FCN=21----->| |-----W=0,CFN=10----->|FCN=10----->| |<------ACK, W=0-------|no Bitmap |-----W=1,CFN=23----->|FCN=23----->| |-----W=1,CFN=22----->|FCN=22----->| |-----W=1,CFN=21----->| |-----W=1, CFN=31----->|MIC checkedFCN=21----->| |--W=1, FCN=31 + MIC-->|MIC checked: sucess => |<------ACK, W=1-------|no Bitmap (End) Figure 34: Transmission in ACK-Always mode of an IPv6 packet carried by 28 fragments, with N=5, MAX_WIND_FCN=23 and two lost fragments. Appendix C. Fragmentation State Machines The fragmentation state machines of the sender and thereceiver inreceiver, one for each of the different reliabilityoptionsmodes, arenextdescribed in the following figures: +===========+ +------------+ Init | | FCN=0 +===========+ | No Window | No Bitmap | +-------+ | +========+==+ | More Fragments | | | <--+ ~~~~~~~~~~~~~~~~~~~~ +--------> | Send | send Fragment (FCN=0) +===+=======+ | last fragment | ~~~~~~~~~~~~ | FCN = 1 v send fragment+MIC +============+ | END | +============+ Figure32:35: Sender State Machine for theNo ACKNo-ACK Mode +------+ Not All-1 +==========+=+ | ~~~~~~~~~~~~~~~~~~~ | + <--+ set Inactivity Timer | RCV Frag +-------+ +=+===+======+ |All-1 & All-1 & | | |MIC correct MIC wrong | |Inactivity | | |Timer Exp. | v | | +==========++ | v | Error |<-+ +========+==+ +===========+ | END | +===========+ Figure33:36: Receiver State Machine for theNo ACKNo-ACK Mode +=======+ | INIT | FCN!=0 & more frags | | ~~~~~~~~~~~~~~~~~~~~~~ +======++ +--+ send Window + frag(FCN) W=0 | | | FCN- Clear local Bitmap | | v set local Bitmap FCN=max value | ++==+========+ +> | | +---------------------> | SEND | |+==+=====+===++==+===+=====+ | FCN==0 & more frags | | last frag | ~~~~~~~~~~~~~~~~~~~~~ | | ~~~~~~~~~~~~~~~ | set local-Bitmap | | set local-Bitmap | send wnd + frag(all-0) | | send wnd+frag(all-1)+MIC | set Retrans_Timer | | set Retrans_Timer | | | |Recv_wnd == wnd & | | |Lcl_Bitmap==recv_Bitmap& | |+------------------------++----------------------+ |more frag | ||local-Bitmap!=rcv-Bitmap||lcl-Bitmap!=rcv-Bitmap| |~~~~~~~~~~~~~~~~~~~~~~ | | | ~~~~~~~~~ | |Stop Retrans_Timer | | | Attemp++ v |clear local_Bitmap v v |+======+++=====+=+ |window=next_window+====+=====+==+==++====+===+==+===+ |Resend | +---------------------+ | |Missing| +----+ Wait | |Frag | not expected wnd | | Bitmap |+======+++=======+ ~~~~~~~~~~~~~~~~ +--->++-+Retrans_Timer++Retrans_Timer Exp | discard frag+==+=+===+=+===+=+ |~~~~~~~~~~~~~~~~~+==+=+===+=+==+=+| ~~~~~~~~~~~~~~~~~ | | | | ^ ^ |reSend(empty)All-* | | | | | | |Set Retrans_Timer | MIC_bit==1 & | | | |+---+Attemp+++--+Attemp++ | Recv_window==window & | | |+---------------------------++-------------------------+ Lcl_Bitmap==recv_Bitmap &| | | all missing frag sent no more frag| | | ~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~~~~~~~| | | Set Retrans_Timer Stop Retrans_Timer| | | +=============+ | | | | END +<--------+ | | Attemp > MAX_ACK_REQUESTS +=============+ | | ~~~~~~~~~~~~~~~~~~ All-1 Window | v Send Abort ~~~~~~~~~~~~ | +=+===========+ MIC_bit ==0 & +>| ERROR | Lcl_Bitmap==recv_Bitmap +=============+ Figure34:37: Sender State Machine for theACK AlwaysACK-Always Mode Not All- & w=expected +---+ +---+w = Not expected ~~~~~~~~~~~~~~~~~~~~~ | | | |~~~~~~~~~~~~~~~~ Set local_Bitmap(FCN) | v v |discard ++===+===+===+=+ +---------------------+ Rcv +--->* ABORT | +------------------+ Window | | | +=====+==+=====+ | | All-0 & w=expect | ^ w =next & not-All | | ~~~~~~~~~~~~~~~~~~ | |~~~~~~~~~~~~~~~~~~~~~ | | set lcl_Bitmap(FCN)| |expected = next window | | send local_Bitmap | |Clear local_Bitmap | | | | | | w=expct & not-All | | | | ~~~~~~~~~~~~~~~~~~ | | | | set lcl_Bitmap(FCN)+-+ | | +--+ w=next & All-0 | | if lcl_Bitmap full | | | | | | ~~~~~~~~~~~~~~~ | | send lcl_Bitmap | | | | | | expct = nxt wnd | | v | vv v| | | Clear lcl_Bitmap | | w=expct & All-1 +=+=+=+==+=++ |Clear lcl_Bitmapset lcl_Bitmap(FCN) | | ~~~~~~~~~~~ +->+ Wait +<+set lcl_Bitmap(FCN)send lcl_Bitmap | | discard +--| Next |send lcl_Bitmap| | All-0 +---------+ Window +--->* ABORT | | ~~~~~ +-------->+========+=++ | | snd lcl_bm All-1 & w=next| | All-1 & w=nxt | | & MIC wrong| | & MIC right | | ~~~~~~~~~~~~~~~~~| | ~~~~~~~~~~~~~~~~~~ | | set local_Bitmap(FCN)| |set lcl_Bitmap(FCN) | | send local_Bitmap| |send local_Bitmap | | | +----------------------+ | |All-1 & w=expct | | | |& MIC wrong v +---+ w=expctd & | | |~~~~~~~~~~~~~~~~~~~~ +====+=====+ | MIC wrong | | |set local_Bitmap(FCN) | +<+ ~~~~~~~~~~~~~~ | | |send local_Bitmap | Wait End | set lcl_btmp(FCN)| | +--------------------->+ +--->* ABORT | | +===+====+=+-+ All-1&MIC wrong| | | ^ | ~~~~~~~~~~~~~~~| | w=expected & MIC right | +---+ send lcl_btmp | |w=expected & MIC right|~~~~~~~~~~~~~~~~~~~~~~ | | | set local_Bitmap(FCN) |~~~~~~~~~~~~~~~~~~~~~~|+-+ Not All-1 | |set local_Bitmap(FCN)| | | ~~~~~~~~~ | |sendlocal_Bitmap|local_Bitmap | |discard| ~~~~~~~~~ | | | | | discard | |All-1 & w=expctd & MIC right | | |+-+ All-1| |~~~~~~~~~~~~~~~~~~~~~~~~~~~~ v | v| v ~~~~~~~~~+----+All-1 | |set local_Bitmap(FCN)+=+=+=+=+=++Send lcl_btmp+=+=+=+=+==+ |~~~~~~~~~ | |send local_Bitmap ||+<+Send lcl_btmp | +-------------------------->+ END+<---------------+ ++==+======+| | +==========+<---------------+ --->* ABORT ~~~~~~~ Inactivity_Timer = expires When DWN_Link IF Inactivity_Timer expires Send DWL Request Attemp++ Figure35:38: Receiver State Machine for theACK AlwaysACK-Always Mode +=======+ | | | INIT | | | FCN!=0 & more frags +======++ +--+ ~~~~~~~~~~~~~~~~~~~~~~ W=0 | | | send Window + frag(FCN) ~~~~~~~~~~~~~~~~~~ | | | FCN- Clear local Bitmap | | v set local Bitmap FCN=max value | ++=============+ +> | | | SEND | +-------------------------> | | | ++=====+=======+ | FCN==0 & more frags| |last frag | ~~~~~~~~~~~~~~~~~~~~~~~||~~~~~~~~~~~~~~~~~~~~~~~~|~~~~~~~~~~~~~~~~~ | set local-Bitmap| |set local-Bitmap | send wnd + frag(all-0)| |send wnd+frag(all-1)+MIC | set Retrans_Timer| |set Retrans_Timer | | | |Retrans_Timer expires & | |local-Bitmap!=rcv-Bitmaplcl-Bitmap!=rcv-Bitmap |more fragments | |+-----------------+~~~~~~~~~~~~~~~~~~~~~~ |~~~~~~~~~~~~~~~~~~~~ | || ~~~~~~~~~~~~~ |Attemp++ |stop Retrans_Timer | || Attemp++ |+-----------------+ |clear local-Bitmap v v | v |window = next window +=====+=====+==+==+ +====+====+ +----------------------+ + | Resend | +--------------------->+ Wait Bitmap | | Missing | | +-- + | | Frag | | not expected wnd | ++=+===+===+===+==+ +======+==+ | ~~~~~~~~~~~~~~~~ | ^ | | | ^ | | discard frag +----+ | | | +-------------------+ | | | | all missing frag sent |Retrans_Timer expires & | | | ~~~~~~~~~~~~~~~~~~~~~ | No more Frag | | | Set Retrans_Timer | ~~~~~~~~~~~~~~~~~~~~~~~ | | | | Stop Retrans_Timer | | | | Send ALL-1-empty | | | +-------------------------+ | | | | Local_Bitmap==Recv_Bitmap| | ~~~~~~~~~~~~~~~~~~~~~~~~~| |Attemp > MAX_ACK_REQUESTS +=========+Stop Retrans_Timer | |~~~~~~~~~~~~~~~~~~~~~~~ | END +<------------------+ v Send Abort +=========+ +=+=========+ | ERROR | +===========+ Figure36:39: Sender State Machine for theACK on errorACK-on-Error Mode Not All- & w=expected +---+ +---+w = Not expected ~~~~~~~~~~~~~~~~~~~~~ | | | |~~~~~~~~~~~~~~~~ Set local_Bitmap(FCN) | v v |discard ++===+===+===+=+ +-----------------------+ +--+ All-0 & full | ABORT *<---+ Rcv Window | | ~~~~~~~~~~~~ | +--------------------+ +<-+ w =next | |+===+===+======+All-0 empty +->+=+=+===+======+ clear lcl_Bitmap | | ~~~~~~~~~~~ | | | ^ | |All-0 & w=expect|send bitmap +----+ | |w=expct & not-All & full | |& no_full Bitmap|| |~~~~~~~~~~~~~~~~~~~~~~~~ | |~~~~~~~~~~~~~~~~~| |clear| |set lcl_Bitmap; w =nxt | |send local_Bitmap|| | | || +========+All-0 & w=expect | | w=next | |+---------->+& no_full Bitmap | | ~~~~~~~~ +========+ | | ~~~~~~~~~~~~~~~~~ ||w=next| Send abort| Error/ | | | send local_Bitmap | ||~~~~~~~~ |+---------->+ Abort | | | | ||Send abort ++=======+ ||v+-------->+========+ | |^ w=expctv | |All-0 +=+===+==+======+|&all-1 ^ | |~~~~~~~~~~~~~<---+ Wait +------+All-0 empty +====+===+==+=+=+ ~~~~~~~ | |send lcl_btmp|Next Window~~~~~~~~~~~~~ +--+ Wait | Send abort | |+=======+===+==++ | | All-1 & w=next & MIC wrong | | +---->* ABORT| send lcl_btmp +->| Missing Fragm.| |~~~~~~~~~~~~~~~~~~~~~~~~~~|+----------------+| +==============++ |set local_Bitmap(FCN)|All-1 & w=next|| +--------------+ |send local_Bitmap| Uplink Only &MIC right|| | Inactivity_Timer = expires |~~~~~~~~~~~~~~~~~~|| ~~~~~~~~~~~~~~~~~~~~~~~~~~ | |set lcl_Bitmap(FCN)|Send Abort | |All-1 & w=expect & MIC wrong || ||~~~~~~~~~~~~~~~~~~~~~~~~~~~~|+-+ All-1 |||set local_Bitmap(FCN)v| v ~~~~~~~~~~ |||send local_Bitmap+=======+==+===++===========+==+ sndlcl_btmp|lcl_btmp | +--------------------->+ Wait End +-+ || +=====+=+===+=++=====+=+====+=+ | w=expct & ||w=expected & MIC right | | ^ | MIC wrong ||~~~~~~~~~~~~~~~~~~~~~~ | | +---+ ~~~~~~~~~ ||set & send local_Bitmap(FCN) | | setlcl_Bitmap(FCN)| |lcl_Bitmap(FCN) | | | |All-1 & w=expected & MIC right | +-->* ABORT||~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ v||set & send local_Bitmap(FCN) +=+==========+|+---------------------------->+ END+<----------+| +============+ --->* ABORT Only UplinkABORT ~~~~~~~~Inactivity_Timer = expires ~~~~~~~~~~~~~~~~~~~~~~~~~~ Send Abort Figure37:40: Receiver State Machine for theACK on errorACK-on-Error Mode Appendix D.Allocation of Rule IDs for fragmentation A set of Rule IDs are allocated to support different aspects of fragmentation functionality as per this document. The allocation of IDs is to be defined in other documents. The set MAY include: o one ID or a subset of IDs to identify a fragment as well as its reliability option and its window size, if multiple of these are supported. o one ID to identify the ACK message. o one ID to identify the Abort message as per Section 9.8. Appendix E.Note Carles Gomez has been funded in part by the Spanish Government (Ministerio de Educacion, Cultura y Deporte) through the Jose Castillejo grant CAS15/00336, and by the ERDF and the Spanish Government through project TEC2016-79988-P. Part of his contribution to this work has been carried out during his stay as a visiting scholar at the Computer Laboratory of the University of Cambridge. Authors' Addresses Ana Minaburo Acklio 2bis rue de la Chataigneraie 35510 Cesson-Sevigne Cedex France Email: ana@ackl.io Laurent Toutain IMT-Atlantique 2 rue de la Chataigneraie CS 17607 35576 Cesson-Sevigne Cedex France Email: Laurent.Toutain@imt-atlantique.fr Carles Gomez Universitat Politecnica de Catalunya C/Esteve Terradas, 7 08860 Castelldefels Spain Email: carlesgo@entel.upc.edu