RFC 7400
6LoWPAN-GHC: Generic Header Compression for IPv6 over Low-Power Wireless Personal Area Networks (6LoWPANs)
Rewriting RFC 7400 π (Part 1 of 5)
RFC 7400 is a Standards Track document from November 2014, written by C. Bormann at Universitaet Bremen TZI. It's published under ISSN 2070-1721, and its title is 6LoWPAN-GHC: Generic Header Compression for IPv6 over Low-Power Wireless Personal Area Networks (6LoWPANs) π. The title block doesn't list anything it obsoletes or updates, so this one stands on its own β¨.
Abstract
okay so RFC 6282 is the one that defines header compression in 6LoWPAN packets π¦ (6LoWPAN means "IPv6 over Low-Power Wireless Personal Area Network"). This document adds a simple extra piece πΈ that lets you compress generic headers and header-like payloads. You don't have to invent a brand new compression scheme for every single new header, and that's giving efficiency π .
Status of This Memo
this is an Internet Standards Track document π₯.
it's a product of the Internet Engineering Task Force (IETF) π. it represents the consensus of the IETF community, got public review, and was approved for publication by the Internet Engineering Steering Group (IESG). for more on Internet Standards, check Section 2 of RFC 5741 π§.
info about the current status, any errata, and how to give feedback lives at http://www.rfc-editor.org/info/rfc7400 π.
Copyright Notice
Copyright (c) 2014 IETF Trust and the persons identified as the document authors. All rights reserved π.
this document is subject to BCP 78 and the IETF Trust's Legal Provisions Relating to IETF Documents (http://trustee.ietf.org/license-info) in effect on the date of publication. please read these carefully because they describe your rights and restrictions π. code components pulled out of this document must include Simplified BSD License text as described in Section 4.e of the Trust Legal Provisions, and they come without warranty as described in the Simplified BSD License π.
Table of Contents
1. Introduction ....................................................2
1.1. The Header Compression Coupling Problem ....................2
1.2. Compression Approach .......................................3
1.3. Terminology ................................................3
1.4. Notation ...................................................4
2. 6LoWPAN-GHC .....................................................4
3. Integrating 6LoWPAN-GHC into 6LoWPAN-HC .........................6
3.1. Compressing Payloads (UDP and ICMPv6) ......................6
3.2. Compressing Extension Headers ..............................6
3.3. Indicating GHC Capability ..................................7
3.4. Using the 6CIO .............................................8
4. IANA Considerations .............................................9
5. Security Considerations ........................................10
6. References .....................................................11
6.1. Normative References ......................................11
6.2. Informative References ....................................12
Appendix A. Examples ..............................................14
Acknowledgements ..................................................24
Author's Address ..................................................24
1. Introduction β¨
1.1. The Header Compression Coupling Problem
okay bestie, so [RFC6282] defines a scheme for header compression in 6LoWPAN [RFC4944] packets πΈ. in this doc we call that scheme 6LoWPAN Header Compression, or 6LoWPAN-HC (where "6LoWPAN" means "IPv6 over Low-Power Wireless Personal Area Network") π¦. like most header compression schemes, every new kind of header that needs compressing needs its own new specification π. and [RFC6282] doesn't have an extensibility scheme like the Robust Header Compression (ROHC) profiles from ROHC [RFC3095] [RFC5795] π.
so this led to a messy situation where 6LoWPAN-HC kept getting reopened and reexamined every time a new header came up (or an old one got changed and reconsidered) across the 6LoWPAN/roll/CoRE cluster of IETF working groups π. [RFC6282] was finally completed and published, but the underlying problem is still unsolved ππ«Ά.
the goal of this contribution is to plug into [RFC6282] as is, using its Next Header Compression (NHC) concept π . we add a slightly less efficient but vastly more general form of compression for headers of any kind, and even for header-like payloads such as the ones routing protocols, DHCP, and so on produce: Generic Header Compression (GHC) π₯. the objective is an extremely simple spec that fits on a single page and can be implemented in a small number of lines of code π. that's very different from a general data compression scheme like the one in [RFC1951] π.
1.2. Compression Approach
the basic idea behind GHC's compression function is a bytecode for LZ77-style compression [LZ77] π. the bytecode is a series of simple instructions that tell the decompressor how to rebuild the uncompressed payload β¨. these instructions include:
- appending bytes to the reconstituted payload that are literally given with the instruction in the compressed data
- appending a given number of zero bytes to the reconstituted payload
- appending bytes to the reconstituted payload by copying a contiguous sequence from the payload being reconstituted ("backreferencing")
- an ancillary instruction for setting up parameters for the backreferencing instruction in "decompression variables"
- a stop code (optional; see Section 3.2)
the buffer for the reconstituted payload ("destination buffer") starts with a predefined dictionary π§. you can use that dictionary in backreferencing as if it were a prefix of the payload. this predefined dictionary is built from the IPv6 addresses of the packet being reconstituted, followed by a static component called the "static dictionary" πΈ.
as usual, this spec defines the decompressor's operation in detail but leaves the compressor's detailed operation up to implementers π . the compressor can work like a classical LZ77 compressor, or it can be a simple protocol encoder that just takes advantage of known compression opportunities π¦.
1.3. Terminology
The key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT", "SHOULD", "SHOULD NOT", "RECOMMENDED", "NOT RECOMMENDED", "MAY", and "OPTIONAL" in this document are to be interpreted as described in RFC 2119 [RFC2119] π.
the term "byte" is used in its now-customary sense as a synonym for "octet" π.
terms from [RFC7228] are used in Section 5 β¨.
1.4. Notation
this spec uses a trivial notation for code bytes and the bitfields inside them π. the meaning should be mostly obvious, but here's the more formal version π€:
potential values for the code bytes are written as templates that represent 8-bit most-significant-bit-first binary numbers (with no special prefix) π . a 0 stands for 0 and a 1 stands for 1 π₯. variable segments in these templates are shown as runs of the same letter, like kkkkkkk or ssss, and the length of the run tells you how many bits that variable segment is π§.
in notation for values derived from the code bytes, 0b is the prefix for binary numbers written most-significant-bit-first π¦ (it's like how 0x works for most-significant-digit-first hexadecimal in C π). when the letter sequences show up in a binary number later in the text, that means you should drop in the value from those bitfields in the actual code byte π«Ά.
example: the code byte template
101nssss
stands for a byte that starts (most-significant-bit-first) with the bits 1, 0, and 1, and then continues with five variable bits πΈ. the first of those is called "n" and the next four are called "ssss" π. based on this template, a reference to
0b0ssss000
means a binary number made of a zero bit, then the four bits in the "ssss" field of the actual byte you encountered (for 101nssss, that's the four least significant bits) kept in the same order, and then three more zero bits π.
2. 6LoWPAN-GHC π
the format of a GHC-compressed header or payload is a simple bytecode π₯. a compressed header is a sequence of pieces, and each piece starts with a code byte that may be followed by zero or more bytes as its argument π. some code bytes lay bytes out in the destination buffer, and some just tweak decompression variables π.
when you start decompressing a header or payload inside an L2 packet (= fragment), the decompression variables "sa" and "na" are both initialized to zero β¨.
the code bytes are defined like this (Table 1) π:
+----------+---------------------------------------------+----------+
| code | Action | Argument |
| byte | | |
+----------+---------------------------------------------+----------+
| 0kkkkkkk | Append k = 0b0kkkkkkk bytes of data in the | k bytes |
| | bytecode argument (k < 96) | of data |
| | | |
| 1000nnnn | Append 0b0000nnnn+2 bytes of zeroes | |
| | | |
| 10010000 | stop code (end of compressed data; see | |
| | Section 3.2) | |
| | | |
| 101nssss | Set up extended arguments for a | |
| | backreference: sa += 0b0ssss000, | |
| | na += 0b0000n000 | |
| | | |
| 11nnnkkk | Backreference: n = na+0b00000nnn+2; | |
| | s = 0b00000kkk+sa+n; append n bytes from | |
| | previously output bytes, starting s bytes | |
| | to the left of the current output pointer; | |
| | set sa = 0, na = 0 | |
+----------+---------------------------------------------+----------+
Table 1: Bytecodes for Generic Header Compression
heads up, the following bit combinations are reserved for now π:
- 011xxxxx
- 1001nnnn (where 0b0000nnnn > 0)
for backreferences, the expansion buffer starts out with a predefined dictionary π§. the reconstituted payload begins right at the end of that dictionary π. this dictionary is made of the source and destination IPv6 addresses of the packet being reconstituted, followed by a 16-byte static dictionary (Figure 1) πΈ. those 48 dictionary bytes can be used for backreferencing, but they are not copied into the final reconstituted payload π.
16 fe fd 17 fe fd 00 01 00 00 00 00 00 01 00 00
Figure 1: The 16 Bytes of Static Dictionary (in Hex)
3. Integrating 6LoWPAN-GHC into 6LoWPAN-HC π¦
6LoWPAN-GHC plugs in as an NHC format for 6LoWPAN-HC [RFC6282] β¨.
That's the end of part 1 π. Part 2 picks up from here π«Ά.
3.1. Compressing Payloads (UDP and ICMPv6) π
okay so GHC is generic by definition π§, which means it works on all kinds of packets! Lots of the examples in Appendix A are ICMPv6 packets, and a single NHC value is enough to define an NHC format for ICMPv6 based on GHC β¨
It's also lowkey useful to have an NHC format for UDP, because so many header-like payloads (think DHCPv6 and Datagram Transport Layer Security (DTLS)) ride along inside UDP π¦ [RFC6282] already has one for UDP (11110CPP), and GHC uses an analogous NHC byte, shown in Figure 2. The main difference is that for 11010CPP NHC bytes, the UDP payload isn't sent literally. It gets compressed by 6LoWPAN-GHC instead π₯
0 1 2 3 4 5 6 7
+---+---+---+---+---+---+---+---+
| 1 | 1 | 0 | 1 | 0 | C | P |
+---+---+---+---+---+---+---+---+
Figure 2: NHC Byte for UDP GHC (11010CPP)
To stay in the same general numbering space, we use 11011111 as the NHC byte for ICMPv6 GHC (Figure 3) πΈ
0 1 2 3 4 5 6 7
+---+---+---+---+---+---+---+---+
| 1 | 1 | 0 | 1 | 1 | 1 | 1 | 1 |
+---+---+---+---+---+---+---+---+
Figure 3: NHC Byte for ICMPv6 GHC (11011111)
3.2. Compressing Extension Headers π
Compressing specific extension headers works in a similar way (Figure 4), though probably only Extension Header ID (EID) 0 to 3 [RFC6282] need to be assigned π . Here's the tea: there's no easy way to pull the Length field out of a GHC-encoded header before decoding it, so detecting where the extension header ends would get super messy π. The easiest and most efficient move is to completely elide the Length field (the same way NHC already drops the Next Header field in certain cases) and rebuild it only on decompression. To act as a terminator for the extension header, the bytecode 0b10010000 has been assigned as a stop code.
The stop code is only needed for extension headers, not for the final payloads from the previous subsection. Decompression of those stops automatically at the end of the packet, so no stop code needed there π
0 1 2 3 4 5 6 7
+---+---+---+---+---+---+---+---+
| 1 | 0 | 1 | 1 | EID |NH |
+---+---+---+---+---+---+---+---+
Figure 4: NHC Byte for Extension Header GHC
3.3. Indicating GHC Capability π§
The 6LoWPAN baseline includes just [RFC4944], [RFC6282], and [RFC6775] (see [Roadmap-6LoWPAN]) π. To use GHC toward a neighbor, a 6LoWPAN node needs to know that the neighbor implements it. Administratively requiring this is one option, but a transition strategy and a way to support mixed networks are both required, so that's a must-have π«Ά
One way to know a neighbor implements GHC is by receiving a packet from it that has GHC in it ("implicit capability detection") π. The catch is that there needs to be a way to bootstrap this, because nobody would ever start sending GHC packets otherwise π
To keep the impact on [RFC6775] minimal, we define a Neighbor Discovery (ND) option called the 6LoWPAN Capability Indication Option (6CIO), shown in Figure 5. (For the fields marked by an underscore in Figure 5, see Section 3.4.) β¨
0 1 2 3
0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| Type | Length = 1 |_____________________________|G|
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|_______________________________________________________________|
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
Figure 5: 6LoWPAN Capability Indication Option (6CIO)
The G bit tells you whether the node sending the option is GHC capable π.
Once a node gets an explicit or implicit indication of GHC capability from another node, it may send GHC-compressed packets to that node π¦. Where that capability hasn't been recently confirmed, a node SHOULD make use of Neighbor Unreachability Detection (NUD) failures to switch back to basic 6LoWPAN header compression [RFC6282]. It's similar to how Packetization Layer Path MTU Discovery (PLPMTUD) [RFC4821] finds out about changes in the network, so the vibes are very on-brand π
3.4. Using the 6CIO π
The 6CIO will typically only be sent in 6LoWPAN-ND Router Solicitation (RS) packets. Those can't be GHC compressed themselves unless the host wants to limit itself to talking to GHC-capable routers π. The resulting 6LoWPAN-ND Router Advertisement (RA) can then already use GHC, which indicates GHC capability implicitly. That in turn lets both nodes use GHC in the 6LoWPAN-ND Neighbor Solicitation / Neighbor Advertisement (NS/NA) exchange π₯
The 6CIO can also carry future options that need to be negotiated between 6LoWPAN peers. An IANA registry is used to assign the flags π. The bits marked by underscores in Figure 5 are unassigned and available for future assignment. They MUST be sent as zero, and they MUST be ignored on reception until IANA assigns them. Length values larger than 1 MUST be accepted by implementations so future extensions can happen. The additional bits in the option are then treated as unassigned in the same way π§.
For the purposes of the IANA registry, the bits are numbered in most-significant-bit-first order, starting from the 16th bit of the option. The 16th bit is flag number 0, and the 31st bit (the G bit) is flag number 15, going all the way up to the 63rd bit for flag number 47. (A follow-on version of this document may also use additional bits, if some bit combinations left unassigned here are used in an upward-compatible manner πΈ.)
Flag numbers 0 to 7 are reserved for experimental use. They MUST NOT be used for actual deployments π«
Where other specifications, or experimental use, plan to use this option, keep these things in mind:
- The option can be used in any ND packet.
- Specific bits are set in the option to indicate that a capability is present in the sender. (There may be other ways to infer this information, as is the case in this specification.) Bit combinations may be used as desired. The absence of the capability indication is signaled by setting these bits to zero, and that does not necessarily mean the capability is absent π.
- The intention is not to modify the semantics of the specific ND packet carrying the option. The goal is to provide the general capability indication described above.
- Specifications have to be designed so that receivers that don't receive or don't process such a capability indication can still interoperate (presumably without exploiting the indicated capability) π«Ά.
- The option is meant to be used sparsely. Once a sender has reason to believe the capability indication has been received, there's no longer a need to keep sending it π .
4. IANA Considerations β¨
IANA has added the assignments listed in Figure 6 to the "LOWPAN_NHC Header Type" registry (under "IPv6 Low Power Personal Area Network Parameters") π.
10110EEN: Extension header GHC [RFC7400]
11010CPP: UDP GHC [RFC7400]
11011111: ICMPv6 GHC [RFC7400]
Figure 6: IANA Assignments for the NHC Byte
IANA has allocated ND option number 36 for the "6LoWPAN Capability Indication Option (6CIO)" ND option format in the "IPv6 Neighbor Discovery Option Formats" registry [RFC4861] π.
IANA has created a subregistry for "6LoWPAN capability Bits" under the "Internet Control Message Protocol version 6 (ICMPv6) Parameters" registry π. The bits are assigned by giving their numbers as small, non-negative integers, as defined in Section 3.4, in the range 0-47. The policy is "IETF Review" or "IESG Approval" [RFC5226]. The initial content of the registry is shown in Figure 7 π§.
0-7: Reserved for Experimental Use [RFC7400]
8-14: Unassigned
15: GHC capable bit (G bit) [RFC7400]
16-47: Unassigned
Figure 7: IANA Assignments for the 6LoWPAN Capability Bits
5. Security Considerations πβ¨
okay bestie, security time ππ The security considerations of [RFC4944] and [RFC6282] apply, so go read those too π As usual with protocols that parse and build packets, you gotta be careful in implementations to avoid buffer overflows and, in particular (with respect to the backreferencing), out-of-area references during decompression. ngl the out-of-area references are the scary part π
One more thing: an attacker may send a forged packet that makes a second node believe a third victim node is GHC capable. If the victim isn't GHC capable, this may stop packets sent by the second node from reaching the third node (at least until robustness features such as those discussed in Section 3.3 kick in). π± Imagine getting ghosted by a router that thinks you're something you're not π
No mitigation is proposed (or known) for this attack, except that a victim node that does implement GHC is not vulnerable. π‘οΈ However, with unsecured ND, a bunch of attacks with similar outcomes are already possible, so there's little incentive to use this extra attack. With secured ND, the 6CIO is also secured. So nodes relying on secured ND therefore should use the 6CIO bidirectionally (and limit the implicit capability detection to secured ND packets carrying GHC), instead of basing their neighbor capability assumptions on receiving any kind of unprotected packet. It's giving "trust, but verify" π«Ά
As with any LZ77 scheme, decompression bombs (compressed packets crafted to expand so much that the decompressor gets overloaded) are a problem. π£ An attacker can't keep a GHC decompressor in a tight loop for too long, because the MTU gets reached quickly. Some amplification of an attack from inside the compressed link is possible, though. Using a constrained node in a constrained network as a DoS attack source is usually not very useful, though, except maybe against other nodes in that same constrained network. The worst case for an attack on the outside is a not-so-constrained device using a (typically not-so-constrained) edge router, which attacks by forwarding out of its Ethernet interface. The worst-case amplification of GHC is 17, so an MTU-size packet can be generated from a 6LoWPAN packet of 76 bytes. The 6LoWPAN network is still constrained, though, so the amplification at the edge router turns an entire 250 kbit/s 802.15.4 network (assuming a theoretical upper bound of 225 kbit/s throughput to a single-hop adjacent node) into a 3.8 Mbit/s attacker. π¬
The amplification may matter more inside the 6LoWPAN, if there's a way to get reflection (otherwise, the packet is likely to just stay compressed on the way and do little damage) πͺ. For example, you could ping a node using a decompression bomb, and somehow keep that node from re-compressing the ping response (which would probably take something more complex than simple runs of zeroes, so the worst-case amplification is likely closer to 9). Or, if there are nodes that don't support GHC, those can be attacked via a router that then gets forced to decompress. π
All these attacks are mitigated by some form of network access control. πβ¨
In a 6LoWPAN stack, sensitive information will normally be protected by transport-layer or application-layer (or even IP-layer) security. Those all sit above the adaptation layer, so there's no sensitive information left to compress at the GHC level. π However, a 6LoWPAN deployment that entirely depends on Media Access Control (MAC) layer security may be vulnerable to attacks that exploit redundancy information disclosed by compression to recover information about secret values. The attacker would need to be in radio range to observe the compressed packets. Since compression is stateless, the attacker would need to entice the party sending the secret value to also send some value controlled (or at least usefully varying and knowable) by the attacker, inside (what becomes the first adaptation-layer fragment of) the same packet. π΅οΈββοΈ This attack is fully mitigated by not exposing secret values to the adaptation layer, or by not using GHC in deployments where that happens. Periodt π
6. References ππΈ
6.1. Normative References
[RFC2119] Bradner, S., "Key words for use in RFCs to Indicate Requirement Levels", BCP 14, RFC 2119, March 1997, http://www.rfc-editor.org/info/rfc2119.
[RFC4861] Narten, T., Nordmark, E., Simpson, W., and H. Soliman, "Neighbor Discovery for IP version 6 (IPv6)", RFC 4861, September 2007, http://www.rfc-editor.org/info/rfc4861.
[RFC4944] Montenegro, G., Kushalnagar, N., Hui, J., and D. Culler, "Transmission of IPv6 Packets over IEEE 802.15.4 Networks", RFC 4944, September 2007, http://www.rfc-editor.org/info/rfc4944.
[RFC5226] Narten, T. and H. Alvestrand, "Guidelines for Writing an IANA Considerations Section in RFCs", BCP 26, RFC 5226, May 2008, http://www.rfc-editor.org/info/rfc5226.
[RFC6282] Hui, J. and P. Thubert, "Compression Format for IPv6 Datagrams over IEEE 802.15.4-Based Networks", RFC 6282, September 2011, http://www.rfc-editor.org/info/rfc6282.
[RFC6775] Shelby, Z., Chakrabarti, S., Nordmark, E., and C. Bormann, "Neighbor Discovery Optimization for IPv6 over Low-Power Wireless Personal Area Networks (6LoWPANs)", RFC 6775, November 2012, http://www.rfc-editor.org/info/rfc6775.
6.2. Informative References
[ICMPv6-ND] O'Flynn, C., "ICMPv6/ND Compression for 6LoWPAN Networks", Work in Progress, draft-oflynn-6lowpan-icmphc-00, July 2010.
[LZ77] Ziv, J. and A. Lempel, "A Universal Algorithm for Sequential Data Compression", IEEE Transactions on Information Theory, Vol. 23, No. 3, pp. 337-343, May 1977.
[RFC1951] Deutsch, P., "DEFLATE Compressed Data Format Specification version 1.3", RFC 1951, May 1996, http://www.rfc-editor.org/info/rfc1951.
[RFC3095] Bormann, C., Burmeister, C., Degermark, M., Fukushima, H., Hannu, H., Jonsson, L-E., Hakenberg, R., Koren, T., Le, K., Liu, Z., Martensson, A., Miyazaki, A., Svanbro, K., Wiebke, T., Yoshimura, T., and H. Zheng, "RObust Header Compression (ROHC): Framework and four profiles: RTP, UDP, ESP, and uncompressed", RFC 3095, July 2001, http://www.rfc-editor.org/info/rfc3095.
[RFC4821] Mathis, M. and J. Heffner, "Packetization Layer Path MTU Discovery", RFC 4821, March 2007, http://www.rfc-editor.org/info/rfc4821.
[RFC5795] Sandlund, K., Pelletier, G., and L-E. Jonsson, "The RObust Header Compression (ROHC) Framework", RFC 5795, March 2010, http://www.rfc-editor.org/info/rfc5795.
[RFC6550] Winter, T., Thubert, P., Brandt, A., Hui, J., Kelsey, R., Levis, P., Pister, K., Struik, R., Vasseur, JP., and R. Alexander, "RPL: IPv6 Routing Protocol for Low-Power and Lossy Networks", RFC 6550, March 2012, http://www.rfc-editor.org/info/rfc6550.
[RFC7228] Bormann, C., Ersue, M., and A. Keranen, "Terminology for Constrained-Node Networks", RFC 7228, May 2014, http://www.rfc-editor.org/info/rfc7228.
[Roadmap-6LoWPAN] Bormann, C., "6LoWPAN Roadmap and Implementation Guide", Work in Progress, draft-bormann-6lo-6lowpan-roadmap-00, October 2013.
Appendix A. Examples π§π
This section shows some relatively realistic examples, taken from actual packet captures at previous interops. πΈ
For the Routing Protocol for Low-Power and Lossy Networks (RPL) [RFC6550], Figure 8 shows a Destination-Oriented Directed Acyclic Graph (DODAG) Information Solicitation (DIS). It's a quite short RPL message that obviously can't be improved much π₯Ή
IP header:
60 00 00 00 00 08 3a ff fe 80 00 00 00 00 00 00
02 1c da ff fe 00 20 24 ff 02 00 00 00 00 00 00
00 00 00 00 00 00 00 1a
Payload:
9b 00 6b de 00 00 00 00
Dictionary:
fe 80 00 00 00 00 00 00 02 1c da ff fe 00 20 24
ff 02 00 00 00 00 00 00 00 00 00 00 00 00 00 1a
16 fe fd 17 fe fd 00 01 00 00 00 00 00 01 00 00
copy: 04 9b 00 6b de
4 nulls: 82
Compressed:
04 9b 00 6b de 82
Was 8 bytes; compressed to 6 bytes, compression factor 1.33
Figure 8: A Simple RPL Example
Figure 9 shows a RPL DODAG Information Object, a longer RPL control message that gets improved a bit more. β¨ Note that the compressed output exposes an inefficiency in the simple-minded compressor used to generate it. This doesn't devalue the example, though, since constrained nodes are quite likely to use simple-minded compressors π€·ββοΈ
IP header:
60 00 00 00 00 5c 3a ff fe 80 00 00 00 00 00 00
02 1c da ff fe 00 30 23 ff 02 00 00 00 00 00 00
00 00 00 00 00 00 00 1a
Payload:
9b 01 7a 5f 00 f0 01 00 88 00 00 00 20 02 0d b8
00 00 00 00 00 00 00 ff fe 00 fa ce 04 0e 00 14
09 ff 00 00 01 00 00 00 00 00 00 00 08 1e 80 20
ff ff ff ff ff ff ff ff 00 00 00 00 20 02 0d b8
00 00 00 00 00 00 00 ff fe 00 fa ce 03 0e 40 00
ff ff ff ff 20 02 0d b8 00 00 00 00
Dictionary:
fe 80 00 00 00 00 00 00 02 1c da ff fe 00 30 23
ff 02 00 00 00 00 00 00 00 00 00 00 00 00 00 1a
16 fe fd 17 fe fd 00 01 00 00 00 00 00 01 00 00
copy: 06 9b 01 7a 5f 00 f0
ref(9): 01 00 -> ref 11nnnkkk 0 7: c7
copy: 01 88
3 nulls: 81
copy: 04 20 02 0d b8
7 nulls: 85
ref(60): ff fe 00 -> ref 101nssss 0 7/11nnnkkk 1 1: a7 c9
copy: 08 fa ce 04 0e 00 14 09 ff
ref(39): 00 00 01 00 00 -> ref 101nssss 0 4/11nnnkkk 3 2: a4 da
5 nulls: 83
copy: 06 08 1e 80 20 ff ff
ref(2): ff ff -> ref 11nnnkkk 0 0: c0
ref(4): ff ff ff ff -> ref 11nnnkkk 2 0: d0
4 nulls: 82
ref(48): 20 02 0d b8 00 00 00 00 00 00 00 ff fe 00 fa ce
-> ref 101nssss 1 4/11nnnkkk 6 0: b4 f0
copy: 03 03 0e 40
ref(9): 00 ff -> ref 11nnnkkk 0 7: c7
ref(28): ff ff ff -> ref 101nssss 0 3/11nnnkkk 1 1: a3 c9
ref(24): 20 02 0d b8 00 00 00 00
-> ref 101nssss 0 2/11nnnkkk 6 0: a2 f0
Compressed:
06 9b 01 7a 5f 00 f0 c7 01 88 81 04 20 02 0d b8
85 a7 c9 08 fa ce 04 0e 00 14 09 ff a4 da 83 06
08 1e 80 20 ff ff c0 d0 82 b4 f0 03 03 0e 40 c7
a3 c9 a2 f0
Was 92 bytes; compressed to 52 bytes, compression factor 1.77
Figure 9: A Longer RPL Example
Similarly, Figure 10 shows a RPL Destination Advertisement Object (DAO) message. π One of the embedded addresses is copied right out of the pseudo-header. The other one is effectively converted from global to local by providing the prefix FE80 literally, inserting a number of nulls, and copying (some of) the Interface Identifier part again out of the pseudo-header. Note that a simple implementation would probably emit fewer nulls and copy the entire Interface Identifier. There are multiple ways to encode this 50-byte payload into 27 bytes, which is very on-brand for RPL π§
Okay bestie, let's look at a RPL DAO message getting squished down π
Figure 10: A RPL DAO Message π¦
IP header:
60 00 00 00 00 32 3a ff 20 02 0d b8 00 00 00 00
00 00 00 ff fe 00 33 44 20 02 0d b8 00 00 00 00
00 00 00 ff fe 00 11 22
Payload:
9b 02 58 7d 01 80 00 f1 05 12 00 80 20 02 0d b8
00 00 00 00 00 00 00 ff fe 00 33 44 06 14 00 80
f1 00 fe 80 00 00 00 00 00 00 00 00 00 ff fe 00
11 22
Dictionary:
20 02 0d b8 00 00 00 00 00 00 00 ff fe 00 33 44
20 02 0d b8 00 00 00 00 00 00 00 ff fe 00 11 22
16 fe fd 17 fe fd 00 01 00 00 00 00 00 01 00 00
copy: 0c 9b 02 58 7d 01 80 00 f1 05 12 00 80
ref(60): 20 02 0d b8 00 00 00 00 00 00 00 ff fe 00 33 44
-> ref 101nssss 1 5/11nnnkkk 6 4: b5 f4
copy: 08 06 14 00 80 f1 00 fe 80
9 nulls: 87
ref(66): ff fe 00 11 22 -> ref 101nssss 0 7/11nnnkkk 3 5: a7 dd
Compressed:
0c 9b 02 58 7d 01 80 00 f1 05 12 00 80 b5 f4 08
06 14 00 80 f1 00 fe 80 87 a7 dd
Was 50 bytes; compressed to 27 bytes, compression factor 1.85
Figure 11 shows what happens when you compress a simple ND neighbor solicitation. Spoiler: it's giving tidy. β¨
Figure 11: An ND Neighbor Solicitation πΈ
IP header:
60 00 00 00 00 30 3a ff 20 02 0d b8 00 00 00 00
00 00 00 ff fe 00 3b d3 fe 80 00 00 00 00 00 00
02 1c da ff fe 00 30 23
Payload:
87 00 a7 68 00 00 00 00 fe 80 00 00 00 00 00 00
02 1c da ff fe 00 30 23 01 01 3b d3 00 00 00 00
1f 02 00 00 00 00 00 06 00 1c da ff fe 00 20 24
Dictionary:
20 02 0d b8 00 00 00 00 00 00 00 ff fe 00 3b d3
fe 80 00 00 00 00 00 00 02 1c da ff fe 00 30 23
16 fe fd 17 fe fd 00 01 00 00 00 00 00 01 00 00
copy: 04 87 00 a7 68
4 nulls: 82
ref(40): fe 80 00 00 00 00 00 00 02 1c da ff fe 00 30 23
-> ref 101nssss 1 3/11nnnkkk 6 0: b3 f0
copy: 04 01 01 3b d3
4 nulls: 82
copy: 02 1f 02
5 nulls: 83
copy: 02 06 00
ref(24): 1c da ff fe 00 -> ref 101nssss 0 2/11nnnkkk 3 3: a2 db
copy: 02 20 24
Compressed:
04 87 00 a7 68 82 b3 f0 04 01 01 3b d3 82 02 1f
02 83 02 06 00 a2 db 02 20 24
Was 48 bytes; compressed to 26 bytes, compression factor 1.85
Next up, the ND neighbor advertisement. Same energy, different vibes. π
Figure 12: An ND Neighbor Advertisement π
IP header:
60 00 00 00 00 30 3a fe fe 80 00 00 00 00 00 00
02 1c da ff fe 00 30 23 20 02 0d b8 00 00 00 00
00 00 00 ff fe 00 3b d3
Payload:
88 00 26 6c c0 00 00 00 fe 80 00 00 00 00 00 00
02 1c da ff fe 00 30 23 02 01 fa ce 00 00 00 00
1f 02 00 00 00 00 00 06 00 1c da ff fe 00 20 24
Dictionary:
fe 80 00 00 00 00 00 00 02 1c da ff fe 00 30 23
20 02 0d b8 00 00 00 00 00 00 00 ff fe 00 3b d3
16 fe fd 17 fe fd 00 01 00 00 00 00 00 01 00 00
copy: 05 88 00 26 6c c0
3 nulls: 81
ref(56): fe 80 00 00 00 00 00 00 02 1c da ff fe 00 30 23
-> ref 101nssss 1 5/11nnnkkk 6 0: b5 f0
copy: 04 02 01 fa ce
4 nulls: 82
copy: 02 1f 02
5 nulls: 83
copy: 02 06 00
ref(24): 1c da ff fe 00 -> ref 101nssss 0 2/11nnnkkk 3 3: a2 db
copy: 02 20 24
Compressed:
05 88 00 26 6c c0 81 b5 f0 04 02 01 fa ce 82 02
1f 02 83 02 06 00 a2 db 02 20 24
Was 48 bytes; compressed to 27 bytes, compression factor 1.78
Figure 13 shows an ND router solicitation getting compressed. Now, the good compression here is NOT because of the pile of zero bytes in the link-layer address of this capture π. Those zeros are unlikely to show up in the real world. The real magic is that 7 of those 8 bytes get copied straight from the pseudo-header. The 8th byte can't be copied, because the universal/local bit has to be flipped.
Figure 13: An ND Router Solicitation π
IP header:
60 00 00 00 00 18 3a ff fe 80 00 00 00 00 00 00
ae de 48 00 00 00 00 01 ff 02 00 00 00 00 00 00
00 00 00 00 00 00 00 02
Payload:
85 00 90 65 00 00 00 00 01 02 ac de 48 00 00 00
00 01 00 00 00 00 00 00
Dictionary:
fe 80 00 00 00 00 00 00 ae de 48 00 00 00 00 01
ff 02 00 00 00 00 00 00 00 00 00 00 00 00 00 02
16 fe fd 17 fe fd 00 01 00 00 00 00 00 01 00 00
copy: 04 85 00 90 65
ref(11): 00 00 00 00 01 -> ref 11nnnkkk 3 6: de
copy: 02 02 ac
ref(50): de 48 00 00 00 00 01
-> ref 101nssss 0 5/11nnnkkk 5 3: a5 eb
6 nulls: 84
Compressed:
04 85 00 90 65 de 02 02 ac a5 eb 84
Was 24 bytes; compressed to 12 bytes, compression factor 2.00
Now the ND router advertisement, which is the biggest one here. β¨ The indefinite lifetime squishes down to four bytes by backreferencing. The authors note this could get even better (at the cost of a little extra decompressor complexity) by adding some simple runlength mechanism. Lowkey smart. π§
Figure 14: An ND Router Advertisement π
IP header:
60 00 00 00 00 60 3a ff fe 80 00 00 00 00 00 00
10 34 00 ff fe 00 11 22 fe 80 00 00 00 00 00 00
ae de 48 00 00 00 00 01
Payload:
86 00 55 c9 40 00 0f a0 1c 5a 38 17 00 00 07 d0
01 01 11 22 00 00 00 00 03 04 40 40 ff ff ff ff
ff ff ff ff 00 00 00 00 20 02 0d b8 00 00 00 00
00 00 00 00 00 00 00 00 20 02 40 10 00 00 03 e8
20 02 0d b8 00 00 00 00 21 03 00 01 00 00 00 00
20 02 0d b8 00 00 00 00 00 00 00 ff fe 00 11 22
Dictionary:
fe 80 00 00 00 00 00 00 10 34 00 ff fe 00 11 22
fe 80 00 00 00 00 00 00 ae de 48 00 00 00 00 01
16 fe fd 17 fe fd 00 01 00 00 00 00 00 01 00 00
copy: 0c 86 00 55 c9 40 00 0f a0 1c 5a 38 17
2 nulls: 80
copy: 06 07 d0 01 01 11 22
4 nulls: 82
copy: 06 03 04 40 40 ff ff
ref(2): ff ff -> ref 11nnnkkk 0 0: c0
ref(4): ff ff ff ff -> ref 11nnnkkk 2 0: d0
4 nulls: 82
copy: 04 20 02 0d b8
12 nulls: 8a
copy: 04 20 02 40 10
ref(38): 00 00 03 -> ref 101nssss 0 4/11nnnkkk 1 3: a4 cb
copy: 01 e8
ref(24): 20 02 0d b8 00 00 00 00
-> ref 101nssss 0 2/11nnnkkk 6 0: a2 f0
copy: 02 21 03
ref(84): 00 01 00 00 00 00
-> ref 101nssss 0 9/11nnnkkk 4 6: a9 e6
ref(40): 20 02 0d b8 00 00 00 00 00 00 00
-> ref 101nssss 1 3/11nnnkkk 1 5: b3 cd
ref(128): ff fe 00 11 22
-> ref 101nssss 0 15/11nnnkkk 3 3: af db
Compressed:
0c 86 00 55 c9 40 00 0f a0 1c 5a 38 17 80 06 07
d0 01 01 11 22 82 06 03 04 40 40 ff ff c0 d0 82
04 20 02 0d b8 8a 04 20 02 40 10 a4 cb 01 e8 a2
f0 02 21 03 a9 e6 b3 cd af db
Was 96 bytes; compressed to 58 bytes, compression factor 1.66
Next is a DTLS application data packet. The net payload is 13 bytes of cleartext plus 8 bytes of authenticator. (The IP header isn't relevant for this one, so it's just set to 0s π«Ά.) This one makes great use of the static dictionary and crunches the TLS_PSK_WITH_AES_128_CCM_8 header super well, for a net reduction of 15 bytes. π₯
Figure 15: A DTLS Application Data Packet π
IP header:
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00
Payload:
17 fe fd 00 01 00 00 00 00 00 01 00 1d 00 01 00
00 00 00 00 01 09 b2 0e 82 c1 6e b6 96 c5 1f 36
8d 17 61 e2 b5 d4 22 d4 ed 2b
Dictionary:
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
16 fe fd 17 fe fd 00 01 00 00 00 00 00 01 00 00
ref(13): 17 fe fd 00 01 00 00 00 00 00 01 00
-> ref 101nssss 1 0/11nnnkkk 2 1: b0 d1
copy: 01 1d
ref(10): 00 01 00 00 00 00 00 01 -> ref 11nnnkkk 6 2: f2
copy: 15 09 b2 0e 82 c1 6e b6 96 c5 1f 36 8d 17 61 e2
copy: b5 d4 22 d4 ed 2b
Compressed:
b0 d1 01 1d f2 15 09 b2 0e 82 c1 6e b6 96 c5 1f
36 8d 17 61 e2 b5 d4 22 d4 ed 2b
Was 42 bytes; compressed to 27 bytes, compression factor 1.56
Figure 16 is a subsequent packet, and the compression is a tiny bit worse this time π₯Ί. It carries 6 bytes of cleartext plus 8 bytes of authenticator, for a net compression of 13 bytes. Still, the total overhead stays at a pretty acceptable 8 bytes. πΈ
Figure 16: Another DTLS Application Data Packet π§
IP header:
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00
Payload:
17 fe fd 00 01 00 00 00 00 00 05 00 16 00 01 00
00 00 00 00 05 ae a0 15 56 67 92 4d ff 8a 24 e4
cb 35 b9
Dictionary:
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
16 fe fd 17 fe fd 00 01 00 00 00 00 00 01 00 00
ref(13): 17 fe fd 00 01 00 00 00 00 00
-> ref 101nssss 1 0/11nnnkkk 0 3: b0 c3
copy: 03 05 00 16
ref(10): 00 01 00 00 00 00 00 05 -> ref 11nnnkkk 6 2: f2
copy: 0e ae a0 15 56 67 92 4d ff 8a 24 e4 cb 35 b9
Compressed:
b0 c3 03 05 00 16 f2 0e ae a0 15 56 67 92 4d ff
8a 24 e4 cb 35 b9
Was 35 bytes; compressed to 22 bytes, compression factor 1.59
Last figure, and it's a DTLS handshake message: a client hello π. There's not much to squish in the 32 bytes of randomness, but the net reduction still comes out to 14 bytes. Respect. π
Figure 17: A DTLS Handshake Packet (Client Hello) π
IP header:
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00
Payload:
16 fe fd 00 00 00 00 00 00 00 00 00 36 01 00 00
2a 00 00 00 00 00 00 00 2a fe fd 51 52 ed 79 a4
20 c9 62 56 11 47 c9 39 ee 6c c0 a4 fe c6 89 2f
32 26 9a 16 4e 31 7e 9f 20 92 92 00 00 00 02 c0
a8 01 00
Dictionary:
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
16 fe fd 17 fe fd 00 01 00 00 00 00 00 01 00 00
ref(16): 16 fe fd -> ref 101nssss 0 1/11nnnkkk 1 5: a1 cd
9 nulls: 87
copy: 01 36
ref(16): 01 00 00 -> ref 101nssss 0 1/11nnnkkk 1 5: a1 cd
copy: 01 2a
7 nulls: 85
copy: 23 2a fe fd 51 52 ed 79 a4 20 c9 62 56 11 47 c9
copy: 39 ee 6c c0 a4 fe c6 89 2f 32 26 9a 16 4e 31 7e
copy: 9f 20 92 92
3 nulls: 81
copy: 05 02 c0 a8 01 00
Compressed:
a1 cd 87 01 36 a1 cd 01 2a 85 23 2a fe fd 51 52
ed 79 a4 20 c9 62 56 11 47 c9 39 ee 6c c0 a4 fe
c6 89 2f 32 26 9a 16 4e 31 7e 9f 20 92 92 81 05
02 c0 a8 01 00
Was 67 bytes; compressed to 53 bytes, compression factor 1.26
Acknowledgements π«Ά
Colin O'Flynn has repeatedly insisted that some form of compression for ICMPv6 and ND packets might be beneficial. He actually wrote his own document, [ICMPv6-ND], which compresses better, but that document only addresses basic ICMPv6/ND and needs a much longer specification (around 17 pages of detailed specification, as compared to the single page of core specification here). This motivated the author to try something simple, yet general. Special thanks go to Colin for indicating that he indeed considers his document superseded by this one. π
The examples given are based on packet capture files that Colin O'Flynn, Owen Kirby, Olaf Bergmann, and others provided. π¦
Using these files as a corpus, the static dictionary was developed, and the bit allocations validated, based on research by Sebastian Dominik. π
Erik Nordmark provided input that helped shape the 6CIO. Thomas Bjorklund proposed simplifying the predefined dictionary. π·
Yoshihiro Ohba insisted on clarifying the notation used for the definition of the bytecodes and their bitfields. Ulrich Herberg provided some additional review and suggested expanding the introductory material, and with Hannes Tschofenig and Brian Haberman he helped come up with the IANA policy for the "6LoWPAN capability bits" assignments in the 6CIO. π§
The IESG reviewers Richard Barnes and Stephen Farrell contributed topics to the Security Considerations section; they and Barry Leiba, as well as GEN-ART reviewer Vijay K. Gurbani, also provided editorial improvements. Everyone who helped here is absolutely iconic. π
Author's Address π
okay bestie, last stop! π¦ this is where you find the author, Carsten Bormann, over at Universitaet Bremen TZI in Germany. here's his full contact info so you can slide into his inbox if you have questions πβ¨
Carsten Bormann
Universitaet Bremen TZI
Postfach 330440
D-28359 Bremen
Germany
Phone: +49-421-218-63921
EMail: cabo@tzi.org
that's the whole doc, babe! πΈπ
π¦ where this page comes from
- ietf: rfc7400 2014-11
- π girlified by claude-haiku-5-5 on : a language model's rewrite of the original, under its terms