6LoWPAN Working Group C. Bormann Internet-Draft Universitaet Bremen TZI Intended status: Standards Track October 18, 2010 Expires: April 21, 2011 6LoWPAN Generic Compression of Headers and Header-like Payloads draft-bormann-6lowpan-ghc-00 Abstract This short I-D provides a basic design for a an addition to 6lowpan Header Compression that enables the compression of generic headers and header-like payloads. 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 http://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 on April 21, 2011. Copyright Notice Copyright (c) 2010 IETF Trust and the persons identified as the document authors. All rights reserved. This document is subject to BCP 78 and the IETF Trust's Legal Provisions Relating to IETF Documents (http://trustee.ietf.org/license-info) in effect on the date of publication of this document. Please review these documents carefully, as they describe your rights and restrictions with respect to this document. Code Components extracted from this document must include Simplified BSD License text as described in Section 4.e of the Trust Legal Provisions and are provided without warranty as described in the Simplified BSD License. Bormann Expires April 21, 2011 [Page 1] Internet-Draft 6lowpan-ghc October 2010 Table of Contents 1. The Header Compression Coupling Problem . . . . . . . . . . . 3 1.1. Terminology . . . . . . . . . . . . . . . . . . . . . . . 3 2. 6lowpan-ghc . . . . . . . . . . . . . . . . . . . . . . . . . 4 3. Examples . . . . . . . . . . . . . . . . . . . . . . . . . . . 5 4. Acknowledgements . . . . . . . . . . . . . . . . . . . . . . . 9 5. Security Considerations . . . . . . . . . . . . . . . . . . . 10 6. References . . . . . . . . . . . . . . . . . . . . . . . . . . 11 6.1. Normative References . . . . . . . . . . . . . . . . . . . 11 6.2. Informative References . . . . . . . . . . . . . . . . . . 11 Author's Address . . . . . . . . . . . . . . . . . . . . . . . . . 12 Bormann Expires April 21, 2011 [Page 2] Internet-Draft 6lowpan-ghc October 2010 1. The Header Compression Coupling Problem [I-D.ietf-6lowpan-hc] defines a scheme for header compression in 6LoWPAN [RFC4944] packets. As with most header compression schemes, a new specification is needed for every new kind of header that needs to be compressed. In addition, [I-D.ietf-6lowpan-hc] does not define an extensibility scheme like the ROHC profiles defined in ROHC [RFC3095] [RFC5795]. This leads to the difficult situation that [I-D.ietf-6lowpan-hc] tends to be reopened and reexamined each time a new header receives consideration (or an old header is changed and reconsidered) in the 6lowpan/roll/core cluster of IETF working groups. At this rate, [I-D.ietf-6lowpan-hc] will never get completed (fortunately, by now it has passed WGLC, but the underlying problem remains unsolved). The purpose of the present contribution is to plug into [I-D.ietf-6lowpan-hc] as is, using its NHC (next header compression) 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 those exhibited by routing protocols, DHCP, etc. The objective is to arrive at something that can be defined on a single page and implemented in a couple of lines of code, as opposed to a general data compression scheme such as that defined in [RFC1951]. 1.1. Terminology In this document, the key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT", "SHOULD", "SHOULD NOT", "RECOMMENDED", "MAY", and "OPTIONAL" are to be interpreted as described in BCP 14 [RFC2119] and indicate requirement levels for compliant CoAP implementations. The term "byte" is used in its now customary sense as a synonym for "octet". Bormann Expires April 21, 2011 [Page 3] Internet-Draft 6lowpan-ghc October 2010 2. 6lowpan-ghc The format of a compressed header or payload is a simple bytecode. A compressed header consists of a sequence of pieces, each of which begins with a code byte, which may be followed by zero or more bytes as its argument. Some code bytes cause bytes to be laid out in the destination buffer, some simply modify some decompression variables. At the start of decompressing an L2 packet (= fragment), variable s is initialized as zero. The code bytes are defined as follows: +----------+--------------------------------------------+-----------+ | code | Action | Argument | | byte | | | +----------+--------------------------------------------+-----------+ | 0kkkkkkk | Copy k+1 bytes of actual data (k < 96) | The k+1 | | | | bytes of | | | | data | | | | | | 011sssss | s = (sssss * 8) | | | | | | | 10000nnn | reserved | | | | | | | 10001kkk | Insert 8 bytes copied from previous bytes, | | | | at k + s bytes distance; s += 8 | | | | | | | 1001nnnn | Insert n+2 bytes of zeroes | | | | | | | 1010iiii | Insert all bytes (possibly filling an | | | | incomplete byte with zero bits) from | | | | Context i | | | | | | | 1011iiii | Insert 8 bytes from Context i; i.e., the | | | | context value truncated/extended to 8 | | | | bytes, and then insert 0000 00FF FE00 | | | | | | | 11nnnkkk | Insert n+2 bytes from previous bytes, k + | | | | s bytes distance; s = 0 | | +----------+--------------------------------------------+-----------+ For the purposes of the backreferences, the expansion buffer is initialized with the pseudo-header as defined in [RFC2460], at the end of which the target buffer begins. These pseudo-header bytes are therefore available for backreferencing, but not copied into the final result. Bormann Expires April 21, 2011 [Page 4] Internet-Draft 6lowpan-ghc October 2010 3. Examples This section demonstrates a couple of realistic examples derived from actual PCAP dumps taken at previous interops. Unfortunately, for these dumps, no context information was available, so the relatively powerful effect of context-based compression is not shown. (TBD: Add a couple more general ICMP, ND, DHCP and RPL examples that show how nifty all this is.) Figure 1 shows a quite short RPL control message that obviously cannot 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 Pseudoheader: 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 00 00 00 08 00 00 00 3a copy: 04 9b 00 6b de 4 nulls: 92 Compressed: 04 9b 00 6b de 92 Was 8 bytes; compressed to 6 bytes, 75 % Figure 1: A simple RPL example Figure 2 shows a longer RPL control message that is improved a bit more (but would likely benefit additionally from a context reference). Note that the compressed output exposes an inefficiency in the simple-minded compressor used to generate it; this does not devalue the example since constrained nodes are quite likely to make use of simple-minded compressors. Bormann Expires April 21, 2011 [Page 5] Internet-Draft 6lowpan-ghc October 2010 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 0a Pseudoheader: 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 00 00 00 5d 00 00 00 3a copy: 09 9b 01 7a 5f 00 f0 01 00 88 3 nulls: 91 copy: 04 20 02 0d b8 7 nulls: 95 ref(52): ff fe 00 -> ref 011sssss 6/11nnnkkk 1 4: 66 cc copy: 08 fa ce 04 0e 00 14 09 ff 2 nulls: 90 copy: 01 01 7 nulls: 95 copy: 06 08 1e 80 20 ff ff ref(2): ff ff -> ref 11nnnkkk 0 2: c2 ref(4): ff ff ff ff -> ref 11nnnkkk 2 4: d4 4 nulls: 92 ref(48): 20 02 0d b8 00 00 00 00 00 00 00 ff fe 00 fa ce -> ref 011sssss 6/10001kkk 0/11nnnkkk 6 0: 66 88 f0 copy: 03 03 0e 40 ref(9): 00 ff -> ref 011sssss 1/11nnnkkk 0 1: 61 c1 ref(28): ff ff ff -> ref 011sssss 3/11nnnkkk 1 4: 63 cc ref(24): 20 02 0d b8 00 00 00 00 -> ref 011sssss 3/11nnnkkk 6 0: 63 f0 copy: 01 0a Compressed: 09 9b 01 7a 5f 00 f0 01 00 88 91 04 20 02 0d b8 95 66 cc 08 fa ce 04 0e 00 14 09 ff 90 01 01 95 06 08 1e 80 20 ff ff c2 d4 92 66 88 f0 03 03 0e 40 61 c1 63 cc 63 f0 01 0a Was 93 bytes; compressed to 57 bytes, 61 % Figure 2: A longer RPL example Bormann Expires April 21, 2011 [Page 6] Internet-Draft 6lowpan-ghc October 2010 Figure 3 shows an the effect of compressing a simple ND neighbor solicitation (again, no context-based compression). 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 Pseudoheader: 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 00 00 00 30 00 00 00 3a copy: 04 87 00 a7 68 4 nulls: 92 ref(32): fe 80 00 00 00 00 00 00 02 1c da ff fe 00 30 23 -> ref 011sssss 4/10001kkk 0/11nnnkkk 6 0: 64 88 f0 copy: 04 01 01 3b d3 4 nulls: 92 copy: 02 1f 02 5 nulls: 93 copy: 02 06 00 ref(24): 1c da ff fe 00 -> ref 011sssss 3/11nnnkkk 3 0: 63 d8 copy: 02 20 24 Compressed: 04 87 00 a7 68 92 64 88 f0 04 01 01 3b d3 92 02 1f 02 93 02 06 00 63 d8 02 20 24 Was 48 bytes; compressed to 27 bytes, 56 % Figure 3: An ND neighbor solicitation Bormann Expires April 21, 2011 [Page 7] Internet-Draft 6lowpan-ghc October 2010 Figure 4 shows the compression of an ND neighbor advertisement. No RS or RA examples were available at this time; note that particularly RA messages might improve (even if they often will not be able to make use of context-based compression). 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 Pseudoheader: 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 00 00 00 30 00 00 00 3a copy: 05 88 00 26 6c c0 3 nulls: 91 ref(48): fe 80 00 00 00 00 00 00 02 1c da ff fe 00 30 23 -> ref 011sssss 6/10001kkk 0/11nnnkkk 6 0: 66 88 f0 copy: 04 02 01 fa ce 4 nulls: 92 copy: 02 1f 02 5 nulls: 93 copy: 02 06 00 ref(24): 1c da ff fe 00 -> ref 011sssss 3/11nnnkkk 3 0: 63 d8 copy: 02 20 24 Compressed: 05 88 00 26 6c c0 91 66 88 f0 04 02 01 fa ce 92 02 1f 02 93 02 06 00 63 d8 02 20 24 Was 48 bytes; compressed to 28 bytes, 58 % Figure 4: An ND neighbor advertisement Bormann Expires April 21, 2011 [Page 8] Internet-Draft 6lowpan-ghc October 2010 4. Acknowledgements Colin O'Flynn has repeatedly insisted that some form of compression for ICMPv6 and ND packets might be beneficial. He actually has his own draft, [I-D.oflynn-6lowpan-icmphc], which compresses better, but addresses basic ICMPv6/ND only and needs a much longer spec (around 17 pages of detailed spec, as compared to the single page here). This motivated the author to try something simple, yet general. Bormann Expires April 21, 2011 [Page 9] Internet-Draft 6lowpan-ghc October 2010 5. Security Considerations (To be worked out.) Bormann Expires April 21, 2011 [Page 10] Internet-Draft 6lowpan-ghc October 2010 6. References 6.1. Normative References [I-D.ietf-6lowpan-hc] Hui, J. and P. Thubert, "Compression Format for IPv6 Datagrams in 6LoWPAN Networks", draft-ietf-6lowpan-hc-13 (work in progress), September 2010. [RFC2119] Bradner, S., "Key words for use in RFCs to Indicate Requirement Levels", BCP 14, RFC 2119, March 1997. [RFC2460] Deering, S. and R. Hinden, "Internet Protocol, Version 6 (IPv6) Specification", RFC 2460, December 1998. [RFC4944] Montenegro, G., Kushalnagar, N., Hui, J., and D. Culler, "Transmission of IPv6 Packets over IEEE 802.15.4 Networks", RFC 4944, September 2007. 6.2. Informative References [I-D.oflynn-6lowpan-icmphc] O'Flynn, C., "ICMPv6/ND Compression for 6LoWPAN Networks", draft-oflynn-6lowpan-icmphc-00 (work in progress), July 2010. [RFC1951] Deutsch, P., "DEFLATE Compressed Data Format Specification version 1.3", RFC 1951, May 1996. [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. [RFC5795] Sandlund, K., Pelletier, G., and L-E. Jonsson, "The RObust Header Compression (ROHC) Framework", RFC 5795, March 2010. Bormann Expires April 21, 2011 [Page 11] Internet-Draft 6lowpan-ghc October 2010 Author's Address Carsten Bormann Universitaet Bremen TZI Postfach 330440 Bremen D-28359 Germany Phone: +49-421-218-63921 Fax: +49-421-218-7000 Email: cabo@tzi.org Bormann Expires April 21, 2011 [Page 12]