idnits 2.17.1 draft-degermark-ipv6-hc-06.txt: Checking boilerplate required by RFC 5378 and the IETF Trust (see https://trustee.ietf.org/license-info): ---------------------------------------------------------------------------- ** Cannot find the required boilerplate sections (Copyright, IPR, etc.) in this document. Expected boilerplate is as follows today (2024-04-25) according to https://trustee.ietf.org/license-info : IETF Trust Legal Provisions of 28-dec-2009, Section 6.a: This Internet-Draft is submitted in full conformance with the provisions of BCP 78 and BCP 79. IETF Trust Legal Provisions of 28-dec-2009, Section 6.b(i), paragraph 2: Copyright (c) 2024 IETF Trust and the persons identified as the document authors. All rights reserved. IETF Trust Legal Provisions of 28-dec-2009, Section 6.b(i), paragraph 3: 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. Checking nits according to https://www.ietf.org/id-info/1id-guidelines.txt: ---------------------------------------------------------------------------- ** Missing expiration date. The document expiration date should appear on the first and last page. ** The document seems to lack a 1id_guidelines paragraph about Internet-Drafts being working documents. ** The document seems to lack a 1id_guidelines paragraph about 6 months document validity -- however, there's a paragraph with a matching beginning. Boilerplate error? ** The document seems to lack a 1id_guidelines paragraph about the list of current Internet-Drafts. ** The document seems to lack a 1id_guidelines paragraph about the list of Shadow Directories. == No 'Intended status' indicated for this document; assuming Proposed Standard Checking nits according to https://www.ietf.org/id-info/checklist : ---------------------------------------------------------------------------- ** The document seems to lack an Introduction section. (A line matching the expected section header was found, but with an unexpected indentation: ' 1. Introduction' ) ** The document seems to lack an IANA Considerations section. (See Section 2.2 of https://www.ietf.org/id-info/checklist for how to handle the case when there are no actions for IANA.) ** The document seems to lack separate sections for Informative/Normative References. All references will be assumed normative when checking for downward references. ** There are 11 instances of too long lines in the document, the longest one being 1 character in excess of 72. ** The abstract seems to contain references ([RFC-1144]), which it shouldn't. Please replace those with straight textual mentions of the documents in question. Miscellaneous warnings: ---------------------------------------------------------------------------- -- The document seems to lack a disclaimer for pre-RFC5378 work, but may have content which was first submitted before 10 November 2008. If you have contacted all the original authors and they are all willing to grant the BCP78 rights to the IETF Trust, then this is fine, and you can ignore this comment. If not, you may need to add the pre-RFC5378 disclaimer. (See the Legal Provisions document at https://trustee.ietf.org/license-info for more information.) -- The document date (June 8, 1998) is 9453 days in the past. Is this intentional? Checking references for intended status: Proposed Standard ---------------------------------------------------------------------------- (See RFCs 3967 and 4897 for information about using normative references to lower-maturity documents in RFCs) == Missing Reference: 'RFC 1144' is mentioned on line 871, but not defined == Unused Reference: 'RFC-791' is defined on line 1946, but no explicit reference was found in the text == Unused Reference: 'RFC-1700' is defined on line 1957, but no explicit reference was found in the text == Unused Reference: 'RFC-1826' is defined on line 1960, but no explicit reference was found in the text == Unused Reference: 'RFC-1827' is defined on line 1963, but no explicit reference was found in the text == Unused Reference: 'ICMPv6' is defined on line 1972, but no explicit reference was found in the text == Unused Reference: 'RFC-2004' is defined on line 1976, but no explicit reference was found in the text ** Obsolete normative reference: RFC 761 (ref. 'RFC-768') (Obsoleted by RFC 793, RFC 7805) ** Obsolete normative reference: RFC 793 (Obsoleted by RFC 9293) ** Downref: Normative reference to an Historic RFC: RFC 1553 ** Obsolete normative reference: RFC 1700 (Obsoleted by RFC 3232) ** Obsolete normative reference: RFC 1826 (Obsoleted by RFC 2402) ** Obsolete normative reference: RFC 1827 (Obsoleted by RFC 2406) ** Downref: Normative reference to an Historic RFC: RFC 1828 ** Obsolete normative reference: RFC 1883 (ref. 'IPv6') (Obsoleted by RFC 2460) ** Obsolete normative reference: RFC 1885 (ref. 'ICMPv6') (Obsoleted by RFC 2463) -- Possible downref: Non-RFC (?) normative reference: ref. 'CRTP' Summary: 20 errors (**), 0 flaws (~~), 8 warnings (==), 3 comments (--). Run idnits with the --verbose option for more detailed information about the items above. -------------------------------------------------------------------------------- 1 Network Working Group Mikael Degermark /Lulea University 2 INTERNET-DRAFT Bjorn Nordgren /Telia Research AB 3 Expires: Dec 1998 Stephen Pink /Swedish Institute of Computer Science 4 Sweden 5 June 8, 1998 7 IP Header Compression 8 10 Status of this Memo 12 Distribution of this memo is unlimited. 14 This document is an Internet-Draft. Internet-Drafts are working 15 documents of the Internet Engineering Task Force (IETF), its areas, 16 and its working groups. Note that other groups may also distribute 17 working documents as Internet-Drafts. 19 Internet-Drafts are draft documents valid for a maximum of six months 20 and may be updated, replaced, or obsoleted by other documents at any 21 time. It is inappropriate to use Internet- Drafts as reference 22 material or to cite them other than as ``work in progress.'' 24 To learn the current status of any Internet-Draft, please check the 25 ``1id-abstracts.txt'' listing contained in the Internet- Drafts 26 Shadow Directories on ftp.is.co.za (Africa), nic.nordu.net (Europe), 27 munnari.oz.au (Pacific Rim), ftp.ietf.org (US East Coast), or 28 ftp.isi.edu (US West Coast). 30 Abstract 32 This document describes how to compress multiple IP headers and TCP 33 and UDP headers per-hop over point-to-point links. The methods can be 34 applied to of IPv6 base and extension headers, IPv4 headers, TCP and 35 UDP headers, and encapsulated IPv6 and IPv4 headers. 37 Headers of typical UDP or TCP packets can be compressed down to 4-7 38 octets including the 2 octet UDP or TCP checksum. This largely 39 removes the negative impact of large IP headers and allows efficient 40 use of bandwidth on low- and medium-speed links. 42 The compression algorithms are specifically designed to work well 43 over links with nontrivial packet-loss rates. Several wireless and 44 modem technologies result in such links. 46 TABLE OF CONTENTS 47 1. Introduction..............................................3 48 2. Terminology...............................................5 49 3. Compression method........................................7 50 3.1. Packet types.......................................8 51 3.2. Lost packets in TCP packet streams.................9 52 3.3. Lost packets in UDP and non-TCP packet streams.....9 53 4. Grouping packets into packet streams.....................13 54 4.1. Guidelines for grouping packets...................14 55 5. Size Issues..............................................16 56 5.1. Context identifiers...............................16 57 5.2. Size of the context...............................17 58 5.3. Size of full headers..............................17 59 5.3.1. Length fields in full TCP headers............19 60 5.3.2. Length fields in full non-TCP headers........19 61 6. Compressed Header Formats................................20 62 7. Compression of subheaders................................22 63 7.1. IPv6 Header.......................................24 64 7.2. IPv6 Extension Headers............................24 65 7.3. Options...........................................25 66 7.4. Hop-by-hop Options Header.........................26 67 7.5. Routing Header....................................27 68 7.6. Fragment Header...................................28 69 7.7. Destination Options Header........................29 70 7.8. No Next Header....................................29 71 7.9. Authentication Header.............................30 72 7.10. Encapsulating Security Payload Header.............30 73 7.11. UDP Header........................................31 74 7.12. TCP Header........................................32 75 7.13. IPv4 Header.......................................34 76 7.14 Minimal Encapsulation header......................36 77 8. Changing context identifiers.............................36 78 9. Rules for dropping or temporarily storing packets........36 79 10. Low-loss header compression for TCP .....................37 80 10.1. The "twice" algorithm............................38 81 10.2. Header Requests..................................38 82 11. Links that reorder packets...............................39 83 11.1. Reordering in non-TCP packet streams.............40 84 11.2. Reordering in TCP packet streams.................40 85 12. Hooks for additional header compression..................41 86 13. Demultiplexing...........................................41 87 14. Configuration Parameters.................................43 88 15. Implementation Status....................................44 89 16. Acknowledgments..........................................44 90 17. Security Considerations..................................44 91 18. Author's Addresses.......................................45 92 19. References...............................................45 94 1. Introduction 96 There are several reasons to do header compression on low- or 97 medium-speed links. Header compression can 99 * Improve interactive response time 101 For very low-speed links, echoing of characters may take longer 102 than 100-200 ms because of the time required to transmit large 103 headers. 100-200 ms is the maximum time people can tolerate 104 without feeling that the system is sluggish. 106 * Allow using small packets for bulk data with good line 107 efficiency 109 This is important when interactive (for example Telnet) and 110 bulk traffic (for example FTP) is mixed because the bulk data 111 should be carried in small packets to decrease the waiting time 112 when a packet with interactive data is caught behind a bulk 113 data packet. 115 Using small packet sizes for the FTP traffic in this case is a 116 global solution to a local problem. It will increase the load 117 on the network as it has to deal with many small packets. A 118 better solution might be to locally fragment the large packets 119 over the slow link. 121 * Allow using small packets for delay sensitive low data-rate 122 traffic 124 For such applications, for example voice, the time to fill a 125 packet with data is significant if packets are large. To get 126 low end-to-end delay small packets are preferred. Without 127 header compression, the smallest possible IPv6/UDP headers (48 128 octets) consume 19.2 kbit/s with a packet rate of 50 packets/s. 129 50 packets/s is equivalent to having 20 ms worth of voice 130 samples in each packet. IPv4/UDP headers consumes 11.2 kbit/s 131 at 50 packets/s. Tunneling or routing headers, for example to 132 support mobility, will increase the bandwidth consumed by 133 headers by 10-20 kbit/s. This should be compared with the 134 bandwidth required for the actual sound samples, for example 13 135 kbit/s with GSM encoding. Header compression can reduce the 136 bandwidth needed for headers significantly, in the example to 137 about 1.7 kbit/s. This enables higher quality voice 138 transmission over 14.4 and 28.8 kbit/s modems. 140 * Decrease header overhead. 142 A common size of TCP segments for bulk transfers over medium- 143 speed links is 512 octets today. When TCP segments are 144 tunneled, for example because Mobile IP is used, the header is 145 100 octets. Header compression will decrease the header 146 overhead for IPv6/TCP from 19.5 per cent to less than 1 per 147 cent, and for tunneled IPv4/TCP from 11.7 to less than 1 per 148 cent. This is a significant gain for line-speeds as high as a 149 few Mbit/s. 151 The IPv6 specification prescribes path MTU discovery, so with 152 IPv6 bulk TCP transfers should use segments larger than 512 153 octets when possible. Still, with 1400 octet segments (RFC 894 154 Ethernet encapsulation allows 1500 octet payloads, of which 100 155 octets are used for IP headers), header compression reduces 156 IPv6 header overhead from 7.1% to 0.4%. 158 * Reduce packet loss rate over lossy links. 160 Because fewer bits are sent per packet, the packet loss rate 161 will be lower for a given bit-error rate. This results in 162 higher throughput for TCP as the sending window can open up 163 more between losses, and in fewer lost packets for UDP. 165 The mechanisms described here are intended for a point-to-point link. 166 However, care has been taken to allow extensions for multi-access 167 links and multicast. 169 Headers that can be compressed include TCP, UDP, IPv4, and IPv6 base 170 and extension headers. For TCP packets, the mechanisms of Van 171 Jacobson [RFC-1144] are used to recover from loss. Two additional 172 mechanisms that increase the efficiency of VJ header compression over 173 lossy links are also described. For non-TCP packets, compression 174 slow-start and periodic header refreshes allow minimal periods of 175 packet discard after loss of a header that changes the context. There 176 are hooks for adding header compression schemes on top of UDP, for 177 example compression of RTP headers. 179 Header compression relies on many fields being constant or changing 180 seldomly in consecutive packets belonging to the same packet stream. 181 Fields that do not change between packets need not be transmitted at 182 all. Fields that change often with small and/or predictable values, 183 e.g., TCP sequence numbers, can be encoded incrementally so that the 184 number of bits needed for these fields decrease significantly. Only 185 fields that change often and randomly, e.g., checksums or 186 authentication data, need to be transmitted in every header. 188 The general principle of header compression is to occasionally send a 189 packet with a full header; subsequent compressed headers refer to the 190 context established by the full header and may contain incremental 191 changes to the context. 193 2. Terminology 195 This section explains some terms used in this document. 197 Subheader 199 An IPv6 base header, an IPv6 extension header, an IPv4 header, 200 a UDP header, or a TCP header. 202 Header 204 A chain of subheaders. 206 Compress 208 The act of reducing the size of a header by removing header 209 fields or reducing the size of header fields. This is done in a 210 way such that a decompressor can reconstruct the header if its 211 context state is identical to the context state used when 212 compressing the header. 214 Decompress 216 The act of reconstructing a compressed header. 218 Context identifier (CID) 220 A small unique number identifying the context that should be 221 used to decompress a compressed header. Carried in full 222 headers and compressed headers. 224 Context 226 The state which the compressor uses to compress a header and 227 the decompressor uses to decompress a header. The context is 228 the uncompressed version of the last header sent (compressor) 229 or received (decompressor) over the link, except for fields in 230 the header that are included "as-is" in compressed headers or 231 can be inferred from, e.g., the size of the link-level frame. 233 The context for a packet stream is associated with a context 234 identifier. The context for non-TCP packet streams is also 235 associated with a generation. 237 Generation 239 For non-TCP packet streams, each new version of the context for 240 a given CID is associated with a generation: a small number 241 that is incremented whenever the context associated with that 242 CID changes. Carried by full and compressed non-TCP headers. 244 Packet stream 246 A sequence of packets whose headers are similar and share 247 context. For example, headers in a TCP packet stream have the 248 same source and final destination address, and the same port 249 numbers in the TCP header. Similarly, headers in a UDP packet 250 stream have the same source and destination address, and the 251 same port numbers in the UDP header. 253 Full header (header refresh) 255 An uncompressed header that updates or refreshes the context 256 for a packet stream. It carries a CID that will be used to 257 identify the context. 259 Full headers for non-TCP packet streams also carry the 260 generation of the context they update or refresh. 262 Regular header 264 A normal, uncompressed, header. Does not carry CID or 265 generation association. 267 Incorrect decompression 269 When a compressed and then decompressed header is different 270 from the uncompressed header. Usually due to mismatching 271 context between the compressor and decompressor or bit errors 272 during transmission of the compressed header. 274 Differential coding 276 A compression technique where the compressed value of a header 277 field is the difference between the current value of the field 278 and the value of the same field in the previous header 279 belonging to the same packet stream. A decompressor can thus 280 obtain the value of the field by adding the value in the 281 compressed header to its context. This technique is used for 282 TCP streams but not for non-TCP streams. 284 3. Compression method 286 Much of the header information stays the same over the life-time of a 287 packet stream. For non-TCP packet streams almost all fields of the 288 headers are constant. For TCP many fields are constant and others 289 change with small and predictable values. 291 To initiate compression of the headers of a packet stream, a full 292 header carrying a context identifier, CID, is transmitted over the 293 link. The compressor and decompressor store most fields of this full 294 header as context. The context consists of the fields of the header 295 whose values are constant and thus need not be sent over the link at 296 all, or change little between consecutive headers so that it uses 297 fewer bits to send the difference from the previous value compared to 298 sending the absolute value. 300 Any change in fields that are expected to be constant in a packet 301 stream will cause the compressor to send a full header again to 302 update the context at the decompressor. As long as the context is the 303 same at compressor and decompressor, headers can be decompressed to 304 be exactly as they were before compression. However, if a full header 305 or compressed header is lost during transmission, the context of the 306 decompressor may become obsolete as it is not updated properly. 307 Compressed headers will then be decompressed incorrectly. 309 IPv6 is not meant to be used over links that can deliver a 310 significant fraction of damaged packets to the IPv6 module. This 311 means that links must have a very low bit-error rate or that link- 312 level frames must be protected by strong checksums, forward error 313 correction or something of that nature. Header compression should 314 not be used for IPv4 without strong link-level checksums. Damaged 315 frames will thus be discarded by the link layer. The link layer 316 implementation might indicate to the header compression module that a 317 frame was damaged, but it cannot say what packet stream it belonged 318 to as it might be the CID that is damaged. Moreover, frames may 319 disappear without the link layer implementation's knowledge, for 320 example if the link is a multi-hop link where frames can be dropped 321 due to congestion at each hop. The kind of link errors that a header 322 compression module should deal with and protect against will thus be 323 packet loss. 325 So a header compression scheme needs mechanisms to update the context 326 at the decompressor and to detect or avoid incorrect decompression. 327 These mechanisms are very different for TCP and non-TCP streams, and 328 are described in sections 3.2 and 3.3. 330 The compression mechanisms in this document assume that packets are 331 not reordered between the compressor and decompressor. If the link 332 does reorder, section 11 describes mechanisms for ordering the 333 packets before decompression. It is also assumed that the link-layer 334 implementation can provide the length of packets, and that there is 335 no padding in UDP packets or tunneled packets. 337 3.1. Packet types 339 This compression method uses four packet types in addition to the 340 IPv4 and IPv6 packet types. The combination of link-level packet 341 type and the value of the first four bits of the packet uniquely 342 determines the packet type. Details on how these packet types are 343 represented are in section 13. 345 FULL_HEADER - indicates a packet with an uncompressed header, 346 including a CID and, if not a TCP packet, a generation. It 347 establishes or refreshes the context for the packet stream 348 identified by the CID. 350 COMPRESSED_NON_TCP - indicates a non-TCP packet with a compressed 351 header. The compressed header consists of a CID identifying what 352 context to use for decompression, a generation to detect an 353 inconsistent context and the randomly changing fields of the 354 header. 356 COMPRESSED_TCP - indicates a packet with a compressed TCP header, 357 containing a CID, a flag octet indentifying what fields have 358 changed, and the changed fields encoded as the difference from the 359 previous value. 361 COMPRESSED_TCP_NODELTA - indicates a packet with a compressed TCP 362 header where all fields that are normally sent as the difference 363 to the previous value are instead sent as-is. This packet type is 364 only sent as the response to a header request from the 365 decompressor. It must not be sent as the result of a 366 retransmission. 368 In addition to the packet types used for compression, regular IPv4 369 and IPv6 packets are used whenever a compressor decides to not 370 compress a packet. An additional packet type may be used to speed up 371 repair of TCP streams over links where the decompressor can send 372 packets to the compressor. 374 CONTEXT_STATE - indicates a special packet sent from the 375 decompressor to the compressor to communicate a list of (TCP) CIDs 376 for which synchronization has been lost. This packet is only sent 377 over a single link so it requires no IP header. The format is 378 shown in section 10.2. 380 3.2. Lost packets in TCP packet streams 382 Since TCP headers are compressed using the difference from the 383 previous TCP header, loss of a packet with a compressed or full 384 header will cause subsequent compressed headers to be decompressed 385 incorrectly because the context used for decompression was not 386 incremented properly. 388 Loss of a compressed TCP header will cause the TCP sequence numbers 389 of subsequently decompressed TCP headers to be off by k, where k is 390 the size of the lost segment. Such incorrectly decompressed TCP 391 headers will be discarded by the TCP receiver as the TCP checksum 392 reliably catches "off-by-k" errors in the sequence numbers for 393 plausible k. 395 TCP's repair mechanisms will eventually retransmit the discarded 396 segment and the compressor peeks into the TCP headers to detect when 397 TCP retransmits. When this happens, the compressor sends a full 398 header on the assumption that the retransmission was due to 399 mismatching compression state at the decompressor. [RFC-1144] has a 400 good explanation of this mechanism. 402 The mechanisms of section 10 should be used to speed up the repair of 403 the context. This is important over medium speed links with high 404 packet loss rates, for example wireless. Losing a timeout's worth of 405 packets due to inconsistent context after each packet lost over the 406 link is not acceptable, especially when the TCP connection is over 407 the wide area. 409 3.3. Lost packets in UDP and other non-TCP packet streams 411 Incorrectly decompressed headers of UDP packets and other non-TCP 412 packets are not so well-protected by checksums as TCP packets. There 413 are no sequence numbers that become "off-by-k" and virtually 414 guarantees a failed checksum as there are for TCP. The UDP checksum 415 only covers payload, UDP header, and pseudo header. The pseudo 416 header includes the source and destination addresses, the transport 417 protocol type and the length of the transport packet. Except for 418 those fields, large parts of the IPv6 header are not covered by the 419 UDP checksum. Moreover, other non-TCP headers lack checksums 420 altogether, for example fragments. 422 In order to safely avoid incorrect decompression of non-TCP headers, 423 each version of the context for non-TCP packet streams is identified 424 by a generation, a small number that is carried by the full headers 425 that establish and refresh the context. Compressed headers carry the 426 generation value of the context that were used to compress them. 427 When a decompressor sees that a compressed header carries a 428 generation value other than the generation of its context for that 429 packet stream, the context is not up to date and the packet must be 430 discarded or stored until a full header establishes correct context. 432 Differential coding is not used for non-TCP streams, so compressed 433 non-TCP headers do not change the context. Thus, loss of a 434 compressed header does not invalidate subsequent packets with 435 compressed headers. Moreover, the generation changes only when the 436 context of a full header is different from the context of the 437 previous full header. This means that losing a full header will make 438 the context of the decompressor obsolete only when the full header 439 would actually have changed the context. 441 The generation field is 6 bits long so the generation value repeats 442 itself after 64 changes to the context. To avoid incorrect 443 decompression after error bursts or other temporary disruptions, the 444 compressor must not reuse the same generation value after a shorter 445 time than MIN_WRAP seconds. A decompressor which has been 446 disconnected MIN_WRAP seconds or more must wait for the next full 447 header before decompressing. A compressor must wait at least MIN_WRAP 448 seconds after booting before compressing non-TCP headers. Instead of 449 reusing a generation value too soon, a compressor may switch to 450 another CID or send regular headers until MIN_WRAP seconds have 451 passed. The value of MIN_WRAP is found in section 14. 453 3.3.1. Compression Slow-Start 455 To allow the decompressor to recover quickly from loss of a full 456 header that would have changed the context, full headers are sent 457 periodically with an exponentially increasing period after a change 458 in the context. This technique avoids an exchange of messages between 459 compressor and decompressor used by other compression schemes, such 460 as in [RFC-1553]. Such exchanges can be costly for wireless mobiles 461 as more power is consumed by the transmitter and delay can be 462 introduced by switching between sending and receiving. Moreover, 463 techniques that require an exchange of messages cannot be used over 464 simplex links, such as direct-broadcast satellite channels or cable 465 TV systems, and are hard to adapt to multicast over multi-access 466 links. 468 |.|..|....|........|................|.............................. 469 ^ 470 Change Sent packets: | with full header, . with compressed header 472 The picture shows how packets are sent after change. The compressor 473 keeps a variable for each non-TCP packet stream, F_PERIOD, that keeps 474 track of how many compressed headers may be sent between full 475 headers. When the headers of a non-TCP packet stream change so that 476 its context changes, a full header is sent and F_PERIOD is set to 477 one. After sending F_PERIOD compressed headers, a full header is 478 sent. F_PERIOD is doubled each time a full header is sent during 479 compression slow-start. 481 3.3.2. Periodic Header Refreshes 483 To avoid losing too many packets if a receiver has lost its context, 484 there is an upper limit, F_MAX_PERIOD, on the number of non-TCP 485 packets with compressed headers that may be sent between header 486 refreshes. If a packet is to be sent and F_MAX_PERIOD compressed 487 headers have been sent since the last full header for this packet 488 stream was sent, a full header must be sent. 490 To avoid long periods of disconnection for low data rate packet 491 streams, there is also an upper bound, F_MAX_TIME, on the time 492 between full headers in a non-TCP packet stream. If a packet is to be 493 sent and more than F_MAX_TIME seconds have passed since the last full 494 header was sent for this packet stream, a full header must be sent. 495 The values of F_MAX_PERIOD and F_MAX_TIME are found in section 14. 497 3.3.3. Rules for sending Full Headers 499 The following pseudo code can be used by the compressor to determine 500 when to send a full header for a non-TCP packet stream. The code 501 maintains two variables: 503 C_NUM -- a count of the number of compressed headers sent 504 since the last full header was sent. 505 F_LAST -- the time of sending the last full header. 507 and uses the functions 509 current_time() return the current time 510 min(a,b) return the smallest of a and b 512 the procedures send_full_header() and send_compressed_header() 513 do the obvious thing. 515 if ( ) 517 C_NUM := 0; 518 F_LAST := current_time(); 519 F_PERIOD := 1; 520 send_full_header(); -- generation value incremented 522 elseif ( C_NUM >= F_PERIOD ) 523 C_NUM := 0; 524 F_LAST := current_time(); 525 F_PERIOD := min(2 * F_PERIOD, F_MAX_PERIOD); 526 send_full_header(); -- generation value unchanged 528 elseif ( current_time() > F_LAST + F_MAX_TIME ) 530 C_NUM := 0; 531 F_LAST := current_time(); 532 send_full_header(); -- generation value unchanged 534 else 536 C_NUM := C_NUM + 1 537 send_compressed_header(); -- with current generation value 539 endif 541 3.3.4. Cost of sending Header Refreshes 543 If every f'th packet carries a full header, H is the size of a full 544 header, and C is the size of a compressed header, the average header 545 size is 547 (H-C)/f + C 549 For f > 1, the average header size is (H-C)/f larger than a 550 compressed header. 552 In a diagram where the average header size is plotted for various f 553 values, there is a distinct knee in the curve, i.e., there is a limit 554 beyond which further increasing f gives diminishing returns. 555 F_MAX_PERIOD should be chosen to be a frequency well to the right of 556 the knee of the curve. For typical sizes of H and C, say 48 octets 557 for the full header (IPv6/UDP) and 4 octets for the compressed 558 header, setting F_MAX_PERIOD > 44 means that full headers will 559 contribute less than an octet to the average header size. With a 560 four-address routing header, F_MAX_PERIOD > 115 will have the same 561 effect. 563 The default F_MAX_PERIOD value of 256 (section 14) puts the full 564 header frequency well to the right of the knee and means that full 565 headers will typically contribute considerably less than an octet to 566 the average header size. For H = 48 and C = 4, full headers 567 contribute about 1.4 bits to the average header size after reaching 568 the steady-state header refresh frequency determined by the default 569 F_MAX_PERIOD. 1.4 bits is a very small overhead. 571 After a change in the context, the exponential backoff scheme will 572 initially send full headers frequently. The default F_MAX_PERIOD 573 will be reached after nine full headers and 255 compressed headers 574 have been sent. This is equivalent to a little over 5 seconds for a 575 typical voice stream with 20 ms worth of voice samples per packet. 577 During the whole backoff period, full headers contribute 1.5 octets 578 to the average header size when H = 48 and C = 4. For 20 ms voice 579 samples, it takes less than 1.3 seconds until full headers contribute 580 less than one octet to the average header size, and during these 581 initial 1.3 seconds full headers add less than 4 octets to the 582 average header size. The cost of the exponential backoff is not 583 great and as the headers of non-TCP packet streams are expected to 584 change seldomly, it will be amortized over a long time. 586 The cost of header refreshes in terms of bandwidth are higher than 587 similar costs for hard state schemes like [RFC-1553] where full 588 headers must be acknowledged by the decompressor before compressed 589 headers may be sent. Such schemes typically send one full header plus 590 a few control messages when the context changes. Hard state schemes 591 require more types of protocol messages and an exchange of messages 592 is necessary. Hard state schemes also need to deal explicitly with 593 various error conditions that soft state handles automatically, for 594 instance the case of one party disappearing unexpectedly, a common 595 situation on wireless links where mobiles may go out of range of the 596 base station. 598 The major advantage of our soft state scheme is that no handshakes 599 are needed between compressor and decompressor, so the scheme can be 600 used over simplex links. The costs in terms of bandwidth are higher 601 than for hard state schemes, but we feel that the simplicity of the 602 decompressor, the simplicity of the protocol, and the lack of 603 handshakes between compressor and decompressor justifies this small 604 cost. Moreover, soft state schemes are more easily extended to 605 multicast over multi-access links, for example radio links. 607 4. Grouping packets into packet streams 609 This section explains how packets may be grouped together into packet 610 streams for compression. To achieve the best compression rates, 611 packets should be grouped together such that packets in the same 612 packet stream have similar headers. If this grouping fails, header 613 compression performance will be bad, since the compression algorithm 614 can rarely utilize the existing context for the packet stream and 615 full headers must be sent frequently. 617 Grouping is done by the compressor. A compressor may use whatever 618 criterion it finds appropriate to group packets into packet streams. 620 To determine what packet stream a packet belongs to, a compressor 621 might 623 a) examine the compressible chain of subheaders (see section 7), 625 b) examine the contents of an upper layer protocol header that 626 follows the compressible chain of subheaders, for example ICMP 627 headers, DVMRP headers, or tunneled IPX headers, 629 c) use information obtained from a resource manager, for example if a 630 resource manager requests compression for a particular packet 631 stream and provides a way to identify packets belonging to that 632 packet stream, 634 d) use any other relevant information, for example if routes flap and 635 the hop limit (TTL) field in a packet stream changes frequently 636 between n and n+k, a compressor may choose to group the packets 637 into two different packet streams. 639 A compressor is also free not to group packets into packet streams 640 for compression, letting some packets keep their regular headers and 641 passing them through unmodified. 643 As long as the rules for when to send full headers for a non-TCP 644 packet stream are followed and subheaders are compressed as specified 645 in this document, the decompressor is able to reconstruct a 646 compressed header correctly regardless of how packets are grouped 647 into packet streams. 649 4.1 Guidelines for grouping packets 651 In the absence of specific instructions as to which packet streams to 652 compress, we offer the following quidelines for how a compressor may 653 group packets into packet streams for compression. 655 Defining fields 657 The defining fields of a header should be present and identical 658 in all packets belonging to the same packet stream. These 659 fields are marked DEF in section 7. The defining fields include 660 the flow label, source and destination addresses of IP headers, 661 final destination address in routing headers, the next header 662 fields (for IPv6), the protocol field (IPv4), port numbers (UDP 663 and TCP), and the SPI in authentication and encryption headers. 665 Fragmented packets 667 Fragmented and unfragmented packets are never grouped together 668 in the same packet stream. The Identification field of the 669 Fragment header or IPv4 header is not used to identify the 670 packet stream. If it was, the first fragment of a new packet 671 would cause a compression slow-start. 673 No field after a Fragment Header, or an IPv4 header for a 674 fragment, should be used for grouping purposes. 676 Upper protocol identification 678 The first next header field identifying a header not described 679 in section 7 should be used for identifying packet streams, 680 i.e., all packets with the same DEF fields and the same upper 681 protocol should be grouped together. 683 TTL field (Hop Limit field) 685 A sophisticated implementation can monitor the TTL (Hop Limit) 686 field and if it changes frequently use it as a DEF field. This 687 can occur when there are frequent route flaps so that packets 688 traverse different paths through the internet. 690 Traffic Class field 692 It is possible that the Traffic Class field of the IPv6 header 693 can change frequently between packets with otherwise identical 694 DEF fields. A sophisticated implementation can watch out for 695 this and be prepared to use the Traffic Class field as a 696 defining field. 698 When IP packets are tunneled they are encapsulated with an additional 699 IP header at the tunnel entry point and then sent to the tunnel 700 endpoint. To group such packets into packet streams, the inner 701 headers should also be examined to determine the packet stream. If 702 this is not done, full headers will be sent each time the headers of 703 the inner IP packet changes. So when a packet is tunneled, the 704 identifying fields of the inner subheaders should be considered in 705 addition to the identifying fields of the initial IP header. 707 An implementation can use other fields for identification than the 708 ones described here. If too many fields are used for identification, 709 performance might suffer because more CIDs will be used and the wrong 710 CIDs might be reused when new flows need CIDs. If too few fields are 711 used for identification, performance might suffer because there are 712 too frequent changes to the context. 714 We stress that these guidelines are educated guesses, when IPv6 is 715 widely deployed and IPv6 traffic can be analyzed, we might find that 716 other grouping algorithms perform better. We also stress that if the 717 grouping fails, the result will be bad performance but not incorrect 718 decompression. The decompressor can do its task regardless of how the 719 grouping algorithm works. 721 5. Size Issues 723 5.1. Context Identifiers 725 Context identifiers can be 8 or 16 bits long. Their size is not 726 relevant for finding the context. An 8-bit CID with value two and a 727 16-bit CID with value two are equivalent. 729 The CID spaces for TCP and non-TCP are separate, so a TCP CID and a 730 non-TCP CID never identify the same context. even if they have the 731 same value. This doubles the available CID space while using the same 732 number of bits for CIDs. It is always possible to tell whether a 733 full or compressed header is for a TCP or non-TCP packet, so no 734 mixups can occur. 736 Non-TCP compressed headers encode the size of the CID using one bit 737 in the second octet of the compressed header. The 8-bit CID allows a 738 minimum compressed header size of 2 octets for non-TCP packets, the 739 CID uses the first octet and the size bit and the 6-bit Generation 740 value fit in the second octet. 742 For TCP the only available CID size is 8 bits as in [RFC-1144]. 8 743 bits is probably sufficient as TCP connections are always point-to- 744 point. 746 The 16 bit CID size may not be needed for point-to-point links; it is 747 intended for use on multi-access links where a larger CID space may 748 be needed for efficient selection of CIDs. 750 The major difficulty with multi-access links is that several 751 compressors share the CID space of a decompressor. CIDs can no 752 longer be selected independently by the compressors as collisions may 753 occur. This problem may be resolved by letting the decompressors 754 have a separate CID space for each compressor. Having separate CID 755 spaces requires that decompressors can identify which compressor sent 756 the compressed packet, perhaps by utilizing link-layer information as 757 to who sent the link-layer frame. If such information is not 758 available, all compressors on the multi-access link may be 759 enumerated, automatically or otherwise, and supply their number as 760 part of the CID. This latter method requires a large CID space. 762 5.2. Size of the context 764 The size of the context should be limited to simplify implementation 765 of compressor and decompressor, and put a limit on their memory 766 requirements. However, there is no upper limit on the size of an 767 IPv6 header as the chain of extension headers can be arbitrarily 768 long. This is a problem as the context is essentially a stored 769 header. 771 The configurable parameter MAX_HEADER (see section 14) represents the 772 maximum size of the context, expressed as the maximum sized header 773 that can be stored as context. When a header is larger than 774 MAX_HEADER, only part of it is stored as context. An implementation 775 must not compress more than the initial MAX_HEADER octets of a 776 header. An implementation must not partially compress a subheader. 777 Thus, the part of the header that is stored as context and is 778 compressed is the longest initial sequence of entire subheaders that 779 is not larger than MAX_HEADER octets. 781 5.3. Size of full headers 783 It is desirable to avoid increasing the size of packets with full 784 headers beyond their original size, as their size may be optimized 785 for the MTU of the link. Since we assume that the link layer 786 implementation provides the length of packets, we can use the length 787 fields in full headers to pass the values of the CID and the 788 generation to the decompressor. 790 This requires that the link-layer must not add padding to the 791 payload, at least not padding that can be delivered to the 792 destination link user. It is also required that no extra padding is 793 added after UDP data or in tunneled packets. This allows values of 794 length fields to be calculated from the length of headers and the 795 length of the link-layer frame. 797 The generation requires one octet and the CID may require up to 2 798 octets. There are length fields of 2 octets in the IPv6 Base Header, 799 the IPv4 header, and the UDP header. 801 A full TCP header will thus have at least 2 octets available in the 802 IP base header to pass the 8 bit CID, which is sufficient. [RFC- 803 1144] uses the 8 bit Protocol field of the IPv4 header to pass the 804 CID. We cannot use the corresponding method as the sequence of IPv6 805 extension headers is not fixed and CID values are not disjoint from 806 the legal values of Next Header fields. 808 An IPv6/UDP or IPv4/UDP packet will have 4 octets available to pass 809 the generation and the CID, so all CID sizes may be used. Fragmented 810 or encrypted packet streams may have only 2 octets available to pass 811 the generation and CID. Thus, 8-bit CIDs may be the only CID sizes 812 that can be used for such packet streams. When IPv6/IPv4 or 813 IPv4/IPv6 tunneling is used, there will be at least 4 octets 814 available, and both CID sizes may be used. 816 The generation value is passed in the higher order octet of the first 817 length field in the full header. When only one length field is 818 available, the 8-bit CID is passed in the low order octet. When two 819 length fields are available, the lowest two octets of the CID are 820 passed in the second length field and the low order octet of the 821 first length field carries the highest octet of the CID. 823 5.3.1. Use of length fields in full TCP headers 825 Use of first length field: 827 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 828 Length field | LSB of pkt nr | CID | 829 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 831 Use of second length field if available: 833 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 834 Second length field | MSB of pkt nr | 0 | 835 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 837 Pkt nr is short for packet sequence number, described in section 838 11.2. 840 5.3.2. Use of length fields in full non-TCP headers 842 Full non-TCP headers with 8-bit CID: 844 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 845 First length field |0|D| Generation| CID | 846 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 848 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 849 Second length field (if avail.) | 0 | Data (if D=1) | 850 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 852 Full non-TCP headers with 16-bit CID: 854 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 855 First length field |1|D| Generation| Data (if D=1) | 856 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 858 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 859 Second length field | CID | 860 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 862 The first bit in the first length field indicates the length of the 863 CID. The Data field is zero if D is zero. The use of the D bit and 864 Data field is explained in section 12. 866 6. Compressed Header Formats 868 This section uses some terminology (DELTA, RANDOM) defined in section 869 7. 871 a) COMPRESSED_TCP format (similar to [RFC 1144]): 873 +-+-+-+-+-+-+-+-+ 874 | CID | 875 +-+-+-+-+-+-+-+-+ 876 | O I P S A W U| 877 +-+-+-+-+-+-+-+-+ 878 | | 879 + TCP Checksum + 880 | | 881 +-+-+-+-+-+-+-+-+ 882 | RANDOM fields, if any (see section 7) (implied) 883 - - - - - - - - 884 | Urgent Pointer Value (if U=1) 885 - - - - - - - - 886 | Window Delta (if W=1) 887 - - - - - - - - 888 | Acknowledgment Number Delta (if A=1) 889 - - - - - - - - 890 | Sequence Number Delta (if S=1) 891 - - - - - - - - 892 | IPv4 Identification Delta (if I=1) 893 - - - - - - - - 894 | Options (if O=1) 895 - - - - - - - - 897 The latter flags in the second octet (IPSAWU) have the same meaning 898 as in [RFC-1144], regardless of whether the TCP segments are carried 899 by IPv6 or IPv4. The C bit has been eliminated because the CID is 900 always present. The context associated with the CID keeps track of 901 the IP version and what RANDOM fields are present. The order between 902 delta fields specified here is exactly as in [RFC-1144]. An 903 implementation will typically scan the context from the beginning and 904 insert the RANDOM fields in order. The RANDOM fields are thus placed 905 before the DELTA fields of the TCP header in the same order as they 906 occur in the original uncompressed header. 908 The I flag is zero unless an IPv4 header immediately precedes the TCP 909 header. The combined IPv4/TCP header is then compressed as a unit as 910 described in [RFC-1144]. Identification fields in IPv4 headers that 911 are not immediately followed by a TCP header are RANDOM. 913 If the O flag is set, the Options of the TCP header were not the same 914 as in the previous header. The entire Option field are placed last in 915 the compressed TCP header. The first bit in the flag octet is 916 reserved. It is always zero. 918 See section 7.12 and [RFC-1144] for further information on how to 919 compress TCP headers. 921 b) COMPRESSED_TCP_NODELTA header format 923 +-+-+-+-+-+-+-+-+ 924 | CID | 925 +-+-+-+-+-+-+-+-+ 926 | RANDOM fields, if any (see section 7) (implied) 927 +-+-+-+-+-+-+-+-+ 928 | Whole TCP header except for Port Numbers 929 +-+-+-+-+-+-+-+-+ 931 c) Compressed non-TCP header, 8 bit CID: 932 0 7 933 +-+-+-+-+-+-+-+-+ 934 | CID | 935 +-+-+-+-+-+-+-+-+ 936 |0|D| Generation| 937 +-+-+-+-+-+-+-+-+ 938 | data | (if D=1) 939 - - - - - - - - 940 | RANDOM fields, if any (section 7) (implied) 941 - - - - - - - - 943 d) Compressed non-TCP header, 16 bit CID: 944 0 7 945 +-+-+-+-+-+-+-+-+ 946 | msb of CID | 947 +-+-+-+-+-+-+-+-+ 948 |1|D| Generation| 949 +-+-+-+-+-+-+-+-+ 950 | lsb of CID | 951 +-+-+-+-+-+-+-+-+ 952 | data | (if D=1) 953 - - - - - - - - 954 | RANDOM fields, if any (section 7) (implied) 955 - - - - - - - - 957 The generation, CID and optional one octet data are followed by 958 relevant RANDOM fields (see section 7) as implied by the compression 959 state, placed in the same order as they occur in the original 960 uncompressed header, followed by the payload. 962 7. Compression of subheaders 964 This section gives rules for how the compressible chain of subheaders 965 is compressed. Subheaders that may be compressed include IPv6 base 966 and extension headers, TCP headers, UDP headers, and IPv4 headers. 967 The compressible chain of subheaders extends from the beginning of 968 the header 970 a) up to but not including the first header that is not an IPv4 971 header, an IPv6 base or extension header, a TCP header, or a UDP 972 header, or 974 b) up to and including the first TCP header, UDP header, Fragment 975 Header, Encapsulating Security Payload Header, or IPv4 header for 976 a fragment, 978 whichever gives the shorter chain. For example, rules a) and b) both 979 fit a chain of subheaders that contain a Fragment Header and ends at 980 a tunneled IPX packet. Since rule b) gives a shorter chain, the 981 compressible chain of subheaders stops at the Fragment Header. 983 The following subsections are a systematic classification of how all 984 fields in subheaders are expected to change. 986 NOCHANGE The field is not expected to change. Any change means 987 that a full header must be sent to update the context. 989 DELTA The field may change often but usually the difference 990 from the field in the previous header is small, so that 991 it is cheaper to send the change from the previous value 992 rather than the current value. This type of compression 993 is only used for TCP packet streams. 995 RANDOM The field should be included "as-is" in compressed 996 headers, usually because it changes unpredictably. 998 INFERRED The field contains a value that can be inferred from 999 other values, for example the size of the frame carrying 1000 the packet, and thus need not be included in the 1001 compressed header. 1003 The classification implies how a compressed header is constructed. No 1004 field that is NOCHANGE or INFERRED is present in a compressed header. 1005 A compressor obtains the values of NOCHANGE fields from the context 1006 identified by the compression identifier, and obtains the values of 1007 INFERRED fields from the link-layer implementation, e.g., from the 1008 size of the link-layer frame, or from other fields, e.g., by 1009 recalculating the IPv4 header checksum. DELTA fields are encoded as 1010 the difference to the value in the previous packet in the same packet 1011 stream, the decompressor adds the value in the compressed header to 1012 the value in its context to obtain the proper value. RANDOM fields 1013 are sent "as-is" in the compressed header. RANDOM fields occur in 1014 the same order in the compressed header as they occur in the full 1015 header. 1017 There is currently little experience with actual IPv6 traffic, so 1018 this classification may change as IPv6 traffic can be observed. 1020 Fields that may be used to identify what packet stream a packet 1021 belongs to according to section 4.1 are marked with the word DEF. To 1022 a compressor using the guidelines from section 4.1, any difference in 1023 corresponding DEF fields between two packets implies that they belong 1024 to different packet streams. Moreover, if a DEF field is present in 1025 one packet but not in another, the packets belong to different packet 1026 streams. 1028 7.1. IPv6 Header [IPv6, section 3] 1030 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 1031 |Version| Traffic Class | Flow Label | 1032 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 1033 | Payload Length | Next Header | Hop Limit | 1034 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 1035 | | 1036 + + 1037 | | 1038 + Source Address + 1039 | | 1040 + + 1041 | | 1042 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 1043 | | 1044 + + 1045 | | 1046 + Destination Address + 1047 | | 1048 + + 1049 | | 1050 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 1052 Version NOCHANGE (DEF) 1053 Traffic Class NOCHANGE (might be DEF, see sect 4.1) 1054 Flow Label NOCHANGE (DEF) 1055 Payload Length INFERRED 1056 Next Header NOCHANGE 1057 Hop Limit NOCHANGE (might be DEF, see sect 4.1) 1058 Source Address NOCHANGE (DEF) 1059 Destination Address NOCHANGE (DEF) 1061 The Payload Length field of encapsulated headers must correspond to 1062 the length value of the encapsulating header. If not, the header 1063 chain cannot be compressed. 1065 This classification implies that the entire IPv6 base header will be 1066 compressed away. 1068 7.2. IPv6 Extension Headers [IPv6, section 4] 1070 What extension headers are present and the relative order of them is 1071 not expected to change in a packet stream. Whenever there is a 1072 change, a full packet header must be sent. All Next Header fields in 1073 IPv6 base header and IPv6 extension headers are NOCHANGE. 1075 7.3. Options [IPv6, section 4.2] 1077 The contents of Hop-by-hop Options and Destination Options extension 1078 headers are encoded with TLV "options": 1080 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+- - - - - - - - - 1081 | Option Type | Opt Data Len | Option Data 1082 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+- - - - - - - - - 1084 Option Type and Opt Data Len fields are assumed to be fixed for a 1085 given packet stream, so they are classified as NOCHANGE. The Option 1086 data is RANDOM unless specified otherwise below. 1088 Padding 1090 Pad1 option 1092 +-+-+-+-+-+-+-+-+ 1093 | 0 | 1094 +-+-+-+-+-+-+-+-+ 1096 Entire option is NOCHANGE. 1098 PadN option 1100 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+- - - - - - - - - 1101 | 1 | Opt Data Len | Option Data 1102 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+- - - - - - - - - 1104 All fields are NOCHANGE. 1106 7.4. Hop-by-Hop Options Header [IPv6, section 4.3] 1108 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 1109 | Next Header | Hdr Ext Len | | 1110 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ + 1111 | | 1112 . . 1113 . Options . 1114 . . 1115 | | 1116 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 1118 Next Header NOCHANGE 1119 Hdr Ext Len NOCHANGE 1121 Options TLV coded values and padding. 1122 Classified according to 7.3 above, unless 1123 being a Jumbo Payload option (see below). 1125 Jumbo Payload option 1127 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 1128 | 194 |Opt Data Len=4 | 1129 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 1130 | Jumbo Payload Length | 1131 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 1133 First two fields are NOCHANGE and Jumbo Payload Length INFERRED. 1134 (frame length must be supplied by link layer implementation). 1136 NOTE: It is silly to compress the headers of a packet carrying 1137 a Jumbo Payload Option since the relative header overhead is 1138 negligible. Moreover, it is usually a bad idea to send such 1139 large packets over low- and medium-speed links. 1141 7.5. Routing Header [IPv6, section 4.4] 1143 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 1144 | Next Header | Hdr Ext Len | Routing Type | Segments Left | 1145 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 1146 | | 1147 . . 1148 . type-specific data . 1149 . . 1150 | | 1151 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 1153 All fields of the Routing Header are NOCHANGE. 1155 If the Routing Type is not recognized, it is impossible to determine 1156 the final Destination Address unless the Segments Left field has the 1157 value zero, in which case the Destination Address is the final 1158 Destination Address in the basic IPv6 header. 1160 In the Type 0 Routing Header, the last address is DEF if (Segments 1161 Left > 0). 1163 Routing Headers are compressed away completely. This is a big win as 1164 the maximum size of the Routing Header is 392 octets. Moreover, Type 1165 0 Routing Headers with one address, size 24 octets, are used by 1166 Mobile IP. 1168 7.6. Fragment Header [IPv6, section 4.5] 1170 The first fragment of a packet has Fragment Offset = 0 and the chain 1171 of subheaders extends beyond its Fragment Header. If a fragment is 1172 not the first (Fragment Offset not 0), there are no subsequent 1173 subheaders (unless the chain of subheaders in the first fragment 1174 didn't fit entirely in the first fragment). 1176 Since packets may be reordered before reaching the compression point, 1177 and some fragments may follow other routes through the network, a 1178 compressor cannot rely on seeing the first fragment before other 1179 fragments. This implies that information in subheaders following the 1180 Fragment Header of the first fragment cannot be examined to determine 1181 the proper packet stream for other fragments. 1183 It is possible to design compression schemes that can compress 1184 subheaders after the Fragment Header, at least in the first fragment, 1185 but to avoid complicating the rules for sending full headers and the 1186 rules for compression and decompression, the chain of subheaders that 1187 follow a Fragment Header must not be compressed. 1189 The fields of the Fragment Header are classified as follows. 1191 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 1192 | Next Header | Reserved | Fragment Offset |Res|M| 1193 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 1194 | Identification | 1195 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 1197 Next Header NOCHANGE 1198 Reserved NOCHANGE 1199 Res RANDOM 1200 M flag RANDOM 1201 Fragment Offset RANDOM 1202 Identification RANDOM 1204 This classification implies that a Fragment Header is compressed down 1205 to 6 octets. The minimum IPv6 MTU is 576 octets so most fragments 1206 will be at least 576 octets. Since the 6 octet overhead of the 1207 compressed fragment header is amortized over a fairly large packet, 1208 the additional complexity of more sophisticated compression schemes 1209 is not justifiable. 1211 NOTE: The Identification field is RANDOM instead of NOCHANGE to 1212 avoid one compression slow-start per original packet. 1214 Grouping of fragments according to the guidelines in section 4.1: 1216 Fragments and unfragmented packets should not be grouped together. 1218 Port numbers cannot be used to identify the packet stream because 1219 port numbers are not present in every fragment. To adhere to the 1220 uniqueness rules for the Identification value, a fragmented packet 1221 stream is identified by the combination of Source Address and 1222 (final) Destination Address. 1224 NOTE: The Identification value is NOT used to identify the 1225 packet stream. This avoids using a new CID for each packet 1226 and saves the cost of the associated compression slow-start. 1227 We hope that the unfragmentable part of the headers will not 1228 change too frequently, if it does thrashing may occur. 1230 7.7. Destination Options Header [IPv6, section 4.6] 1232 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 1233 | Next Header | Hdr Ext Len | | 1234 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ + 1235 | | 1236 . . 1237 . Options . 1238 . . 1239 | | 1240 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 1242 Next Header NOCHANGE 1243 Hdr Ext Len NOCHANGE 1245 Options TLV coded values and padding. 1246 Compressed according to 7.3 above. 1248 The only Destination Options defined in [IPv6] are the padding 1249 options. When further Destination Options are defined, more clever 1250 compression techniques may be defined. 1252 7.8. No Next Header [IPv6, section 4.7] 1254 Covered by rules for IPv6 Header Extensions (7.2). 1256 7.9. Authentication Header [RFC-1826, section 3.2] 1258 1 2 3 4 5 6 7 8 1 2 3 4 5 6 7 8 1 2 3 4 5 6 7 8 1 2 3 4 5 6 7 8 1259 +---------------+---------------+---------------+---------------+ 1260 | Next Header | Length | RESERVED | 1261 +---------------+---------------+---------------+---------------+ 1262 | Security Parameters Index (SPI) | 1263 +---------------+---------------+---------------+---------------+ 1264 | | 1265 + Authentication Data (variable number of 32-bit words) | 1266 | | 1267 +---------------+---------------+---------------+---------------+ 1269 Next Header NOCHANGE 1270 Length NOCHANGE 1271 Reserved NOCHANGE 1272 SPI NOCHANGE (DEF) 1273 Authentication Data RANDOM 1275 [RFC-1828] specifies how to do authentication with keyed MD5, the 1276 authentication method all IPv6 implementations must support. For 1277 this method, the Authentication Data is 16 octets. 1279 7.10. Encapsulating Security Payload Header [RFC-1827, section 3.1] 1281 This header implies that the subsequent parts of the packet are 1282 encrypted. Thus, no further header compression is possible on 1283 subsequent headers as encryption is typically already performed when 1284 the compressor sees the packet. 1286 However, when the ESP Header is used in tunnel mode an entire IP 1287 packet is encrypted, and the headers of that packet may be compressed 1288 before the packet is encrypted at the entry point of the tunnel. 1289 This means that it must be possible to feed an IP packet and its 1290 length to the decompressor, as if it came from the link-layer. The 1291 mechanisms for dealing with reordering described in section 11 must 1292 also be used, as packets are likely to be reordered in a tunnel. 1294 +---------------+---------------+---------------+---------------+ 1295 | Security Association Identifier (SPI), 32 bits | 1296 +===============+===============+===============+===============+ 1297 | Opaque Transform Data, variable length | 1298 +---------------+---------------+---------------+---------------+ 1300 SPI NOCHANGE (DEF) 1301 Opaque Transform Data RANDOM 1303 Everything after the SPI is encrypted and is not compressed. 1305 7.11. UDP Header 1307 The UDP header is described in [RFC-768]. 1309 The Next Header field (IPv6) or Protocol field (IPv4) in the 1310 preceding subheader is DEF. 1312 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 1313 | Source Port | Destination Port | 1314 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 1315 | Length | Checksum | 1316 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 1318 Source Port NOCHANGE (DEF) 1319 Destination Port NOCHANGE (DEF) 1320 Length INFERRED 1321 Checksum RANDOM, unless it is zero, 1322 in which case it is NOCHANGE. 1324 The Length field of the UDP header must match the Length field(s) of 1325 preceding subheaders, i.e, there must not be any padding after the 1326 UDP payload that is covered by the IP Length. 1328 The UDP header is typically compressed down to 2 octets, the UDP 1329 checksum. When the UDP checksum is zero (which it cannot be with 1330 IPv6), it is likely to be so for all packets in the flow and is 1331 defined to be NOCHANGE. This saves 2 octets in the compressed header. 1333 7.12. TCP Header 1335 The TCP header is described in [RFC-793]. 1337 The Next Header field (IbPv6) or Protocol field (IPv4) in the 1338 preceding subheader is DEF. 1340 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 1341 | Source Port | Destination Port | 1342 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 1343 | Sequence Number | 1344 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 1345 | Acknowledgment Number | 1346 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 1347 | Offset| Reserved |U|A|P|R|S|F| Window | 1348 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 1349 | Checksum | Urgent Pointer | 1350 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 1351 | Options | Padding | 1352 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 1354 U, A, P, R, S, and F stands for Urg, Ack, Psh, Rst, Syn, and Fin. 1356 There are two ways to compress the TCP header. 1358 7.12.1. Compressed with differential encoding 1360 Source Port NOCHANGE (DEF) 1361 Destination Port NOCHANGE (DEF) 1362 Sequence Number DELTA 1363 Acknowledgment Number DELTA 1364 Offset NOCHANGE 1365 Reserved NOCHANGE 1366 Urg,Psh RANDOM (placed in flag octet) 1367 Ack INFERRED to be 1 1368 Rst,Syn,Fin INFERRED to be 0 1369 Window DELTA (if change in Window, 1370 set W-flag in flag octet 1371 and send difference) 1372 Checksum RANDOM 1373 Urgent Pointer DELTA (if Urg is set, send 1374 absolute value) 1375 Options, Padding DELTA (if change in Options, 1376 set O-flag and send 1377 whole Options, Padding) 1379 A packet with a TCP header compressed according to the above must be 1380 indicated to be of type COMPRESSED_TCP. The compressed header is 1381 described in section 6. 1383 This method is essentially the differential encoding techniques of 1384 Jacobsson, described in [RFC-1144], the differences being the 1385 placement of the compressed TCP header fields (see section 6), the 1386 use of the O-flag, and elimination of the C-flag. The O-flag allows 1387 compression of the TCP header when the Timestamp option is used and 1388 the Options fields changes with each header. 1390 7.12.2. Without differential encoding 1392 Source Port NOCHANGE (DEF) 1393 Destination Port NOCHANGE (DEF) 1395 (all the rest) RANDOM 1397 The Identification field in a preceding IPv4 header is RANDOM. 1399 A packet with a TCP header compressed according to the above must be 1400 indicated to be of type COMPRESSED_TCP_NODELTA. It uses the same CID 1401 space as COMPRESSED_TCP packets, and the header is saved as 1402 compression state. The compressed header is described in section 6. 1404 This packet type can be sent as the response to a header request 1405 instead of sending a full header, can be used over links that reorder 1406 packets, and can be sent instead of a full header when there are 1407 changes that cannot be represented by a compressed header. A 1408 sophisticated compressor can switch to sending only 1409 COMPRESSED_TCP_NODELTA headers when the packet loss frequency is 1410 high. 1412 7.13. IPv4 header [RFC-791, section 3.1] 1414 0 1 2 3 1415 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 1416 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 1417 |Version| IHL |Type of Service| Total Length | 1418 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 1419 | Identification |Flags| Fragment Offset | 1420 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 1421 | Time to Live | Protocol | Header Checksum | 1422 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 1423 | Source Address | 1424 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 1425 | Destination Address | 1426 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 1427 | Options | Padding | 1428 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 1430 There are two ways to compress the IPv4 header 1432 a) If the IPv4 header is not for a fragment (MF flag is not set and 1433 Fragment Offset is zero) and there are no options (IHL is 5), it 1434 is classified as follows 1436 Version NOCHANGE (DEF) 1437 IHL NOCHANGE (DEF, must be 5) 1438 Type of Service NOCHANGE 1439 Total Length INFERRED (from link-layer implementation 1440 or encapsulating IP header) 1442 Identification DELTA/ (If the Protocol field has the 1443 value corresponding to TCP) 1444 DELTA/ (for UDP when UDP Checksum = 0) 1445 RANDOM (otherwise) 1447 Flags NOCHANGE (MF flag must not be set) 1448 Fragment Offset NOCHANGE (must be zero) 1449 Time to Live NOCHANGE (might be DEF, see sect 4.1) 1450 Protocol NOCHANGE 1451 Header Checksum INFERRED (calculated from other fields) 1452 Source Address NOCHANGE (DEF) 1453 Destination Address NOCHANGE (DEF) 1454 Options, Padding (not present) 1456 Note: When a TCP header immediately follows, the IPv4 and TCP 1457 header are compressed as a unit as described in section 7.12. 1459 Note: When the UDP Checksum is zero, the Identification field need 1460 not be maintained between compressor and decompressor, so the 1461 value of the Identification field is by default increased by 1 for 1462 each decompressed packet. 1464 b) If the IPv4 header is for a fragment (MF bit set or Fragment 1465 Offset nonzero), or there are options (IHL > 5), all fields are 1466 RANDOM (i.e., they are sent as-is and not compressed). If the 1467 IPv4 header is for a fragment it ends the compressible chain of 1468 subheaders, i.e., it is the last subheader to be compressed. If 1469 the IPv4 header has options but is not for a fragment it does not 1470 end the compressible chain of subheaders, so subsequent subheaders 1471 will be compressed. 1473 A compressor that follows the guidelines of section 4.1 will in case 1474 a) use the Version, Source Address and Destination Address to define 1475 the packet stream, together with the fact that there are no IPv4 1476 options and that this is not a fragment. 1478 Case b) can define two kinds of packet streams depending on whether 1479 the IPv4 header is for a fragment or not. 1481 If the IPv4 header in case b) is for a fragment, the compressor uses 1482 that fact together with the Version, Source Address, and Destination 1483 Address to determine the packet stream. 1485 If the IPv4 header in case b) is not for a fragment, it must have 1486 options. The compressor uses that fact, but not the size of the 1487 options, together with the Version, Source Address, and Destination 1488 Address to determine the packet stream. 1490 7.14. Minimal Encapsulation header [RFC-2004, section 3.1] 1492 0 1 2 3 1493 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 1494 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 1495 | Protocol |S| reserved | Header Checksum | 1496 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 1497 | Original Destination Address | 1498 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 1499 : (if present) Original Source Address : 1500 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 1502 Protocol NOCHANGE 1503 Original Source Address Present (S) NOCHANGE 1504 reserved NOCHANGE 1505 Header Checksum INFERRED (calculated from 1506 other values) 1507 Original Destination Address NOCHANGE 1508 Original Source Address NOCHANGE (present only 1509 if S=1) 1511 This header is likely to be used by Mobile IP. 1513 8. Changing context identifiers 1515 On a point-to-point link, the compressor has total knowledge of what 1516 CIDs are in use at the decompressor and can change what CID a packet 1517 stream uses or reuse CIDs at will. 1519 Each non-TCP CID is associated with a context with a generation 1520 value. To avoid too rapid generation wrap-around and potential 1521 incorrect decompression, an implementation must avoid wrap-around of 1522 the generation value in less than MIN_WRAP seconds (see section 14). 1524 To aid in avoiding wrap-around, the generation value associated with 1525 a CID must not be reset when changing to a new packet stream. 1526 Instead, a compressor must increment the generation value by one when 1527 using the CID for a new non-TCP packet stream. 1529 9. Rules for dropping or temporarily storing packets 1531 When a decompressor receives a packet with a compressed TCP header 1532 with CID C, it must be discarded when the context for C has not been 1533 initialized by a full header. 1535 When a decompressor receives a packet with a compressed non-TCP 1536 header with CID C and generation G, the header must not be 1537 decompressed using the current context when 1538 a) the decompressor has been disconnected from the compressor for 1539 more than MIN_WRAP seconds, because the context might be 1540 obsolete even if it has generation G. 1542 b) the context for C has a generation other than G. 1544 In case a) and b) the packet can either be 1546 i) discarded immediately, or else 1548 ii) stored temporarily until the context is updated by a packet 1549 with a full non-TCP header with CID C and generation G, after 1550 which the header can be decompressed. 1552 Packets stored in this manner must be discarded when 1554 *) receiving full or compressed non-TCP headers with CID C 1555 and a generation other than G, 1557 *) the decompressor has not received packets with CID C in 1558 the last MIN_WRAP seconds. 1560 When full headers are lost, a decompressor may receive compressed 1561 non-TCP headers with a generation value other than the generation of 1562 its context. Rule ii) allows the decompressor to store such headers 1563 until they can be decompressed using the correct context. 1565 10. Low-loss header compression for TCP 1567 Since fewer bits are transmitted per packet with header compression, 1568 the packet loss rate is lower with header compression than without, 1569 for a fixed bit-error rate. This is beneficial for links with high 1570 bit-error rates such as wireless links. 1572 However, since TCP headers are compressed using differential 1573 encoding, a single lost TCP segment can ruin an entire TCP sending 1574 window because the context is not incremented properly at the 1575 decompressor. Subsequent headers will therefore be decompressed to 1576 be different than before compression and discarded by the TCP 1577 receiver because the TCP checksum fails. 1579 A TCP connection in the wide area where the last hop is over a 1580 medium-speed lossy link, for example a wireless LAN, will then have 1581 poor performance with traditional header compression because the 1582 delay-bandwidth product is relatively large and the bit-error rate 1583 relatively high. For a 2 Mbit/s wireless LAN and a RTT of 200 ms, the 1584 delay-bandwidth product is 50 kbyte. That is equivalent to about 97 1585 512-octet segments with compressed headers. Each loss can thus be 1586 multiplied by a factor of 100. 1588 This section describes two simple mechanisms for quick repair of the 1589 context. With these mechanisms header compression will improve TCP 1590 throughput over lossy links as well as links with low bit-error 1591 rates. 1593 10.1. The "twice" algorithm 1595 The decompressor can compute the TCP checksum to determine if its 1596 contex is not updated properly. If the checksum fails, the error is 1597 assumed to be caused by a lost segment that did not update the 1598 context properly. The delta of the current segment is then added to 1599 the context again on the assumption that the lost segment contained 1600 the same delta as the current. By decompressing and computing the TCP 1601 checksum again, the decompressor checks if the repair succeeded or if 1602 the delta should be applied once more. 1604 Analysis of traces of various TCP bulk transfers show that applying 1605 the delta of the current segment one or two times will repair the 1606 context for between 83 and 99 per cent of all single-segment losses 1607 in the data stream. For the acknowledgment stream, the success rate 1608 is smaller due to the delayed ack mechanism of TCP. The "twice" 1609 mechanism repairs the context for 99 - 53 per cent of the losses in 1610 the acknowledgment stream. A sophisticated implementation of this 1611 idea would determine whether the TCP stream is an acknowledgment or 1612 data stream and determine the segment size by observing the stream of 1613 full and compressed headers. Trying deltas that are small multiples 1614 of the segment size will result in even higher rates of successful 1615 repairs for acknowledgment streams. 1617 10.2. Header Requests 1619 The relativley low success rate for the "twice" algorithm for TCP 1620 acknowledgment streams calls for an additional mechanism for 1621 repairing the context at the decompressor. When the decompressor 1622 fails to repair the context after a loss, the decompressor may 1623 optionally request a full header from the compressor. This is 1624 possible on links where the decompressor can identify the compressor 1625 and send packets to it. 1627 On such links, a decompressor may send a CONTEXT_STATE packet back to 1628 the compressor to indicate that one or more contexts are invalid. A 1629 decompressor should not transmit a CONTEXT_STATE packet every time a 1630 compressed packet refers to an invalid context, but instead should 1631 limit the rate of transmission of CONTEXT_STATE packets to avoid 1632 flooding the reverse channel. A CONTEXT_STATE packet can indicate 1633 that several contexts are out of date, this technique should be used 1634 instead of sending several separate packets. The following diagram 1635 shows the format of a CONTEXT_STATE packet. 1637 0 1 2 3 4 5 6 7 1638 +---+---+---+---+---+---+---+---+ 1639 | TCP header request = 3 | 1640 +---+---+---+---+---+---+---+---+ 1641 | CID count | 1642 +---+---+---+---+---+---+---+---+ 1643 | CID | 1644 +---+---+---+---+---+---+---+---+ 1645 | CID | 1646 +---+---+---+---+---+---+---+---+ 1647 ... 1648 +---+---+---+---+---+---+---+---+ 1649 | CID | 1650 +---+---+---+---+---+---+---+---+ 1652 The first octet is a type code to allow the CONTEXT_STATE packet type 1653 to be shared for other compression protocols that are (see [CRTP]) or 1654 may be defined in parallel with this one. When used for TCP header 1655 requests the type code has the value 3, and the remainder of the 1656 packet is a sequence of CIDs preceded by a one-octet count of the 1657 number of CIDs. 1659 On receipt of a CONTEXT_STATE packet, the compressor should mark the 1660 CIDs invalid to ensure that the next packet emitted in those packet 1661 streams are FULL_HEADER or COMPRESSED_TCP_NODELTA packets. 1663 Header requests are an optimization, so loss of a CONTEXT_STATE 1664 packet does not affect the correct operation of TCP header 1665 compression. When a CONTEXT_STATE packet is lost, eventually a new 1666 one will be transmitted or TCP will timeout and retransmit. The big 1667 advantage of using header requests is that TCP acknowledgment streams 1668 can be repaired after a roundtrip-time over the lossy link. This 1669 will typically avoid a TCP timeout and unnecessary retransmissions. 1670 The lower packet loss rate due to smaller packets will then result in 1671 higher throughput because the TCP window can grow larger between 1672 losses. 1674 11. Links that reorder packets 1676 Some links reorder packets, for example multi-hop radio links that 1677 use deflection routing to route around congested nodes. Packets 1678 routed different ways can then arrive at the destination in a 1679 different order than they were sent. 1681 11.1. Reordering in non-TCP packet streams 1683 Compressed non-TCP headers do not change the context, and neither do 1684 full headers that refresh it. There can be problems only when a full 1685 header that changes the context arrives out of order. There are two 1686 cases: 1688 - A packet with a full header with generation G arrives *after* a 1689 packet with a compressed header with generation G. This case 1690 is covered by rule b) ii) in section 9. 1692 - A packet with a full header with generation G arrives *before* a 1693 packet with a compressed header with generation G-1 (modulo 1694 64). The decompressor can then keep both versions of the 1695 context around for a while to be able to decompress subsequent 1696 compressed headers with generation G-1 (modulo 64). The old 1697 context must be discarded after MIN_WRAP seconds. 1699 11.2. Reordering in TCP packet streams 1701 A compressor can avoid sending COMPRESSED_TCP headers and only send 1702 COMPRESSED_TCP_NODELTA headers when there is reordering over the 1703 link. Compressed headers will typically be 17 octets with that 1704 method, significantly larger than the usual 4-7 octets. 1706 To achieve better compression rates the following method, adding only 1707 two octets to the compressed header for a total of 6-9 octets, can be 1708 used. A packet sequence number, incremented by one for every packet 1709 in the TCP stream, is associated with each compressed and full 1710 header. This allows the decompressor to place the packets in the 1711 correct sequence and apply their deltas to the context in the correct 1712 order. A simple sliding window scheme can be used to place the 1713 packets in the correct order. 1715 Two octets are needed for the packet sequence numbers. One octets 1716 gives only 256 sequence numbers. In a sliding window scheme the 1717 window should be no larger than half of the sequence number space, so 1718 packets can not arrive more than 127 positions out-of-sequence. This 1719 is equivalent to a delay of 260 ms on 2 Mbit/s links with 512 octet 1720 segments. Delays of that order are not uncommon over wide-are 1721 Internet connections. However, two octets giving 2^16 = 65536 values 1722 should be sufficient. 1724 Full TCP headers will only have space for one octet of sequence 1725 number when there is no tunneling. It is not feasible to increase the 1726 size of full headers since the packet size might be optimized for the 1727 MTU of the link. Therefore only the least significant octet of the 1728 packet sequence number can be placed in such full headers. We believe 1729 that such full headers can be positioned correctly frequently enough 1730 with only the least significant octet of the packet sequence number 1731 available. 1733 The packet sequence number zero is skipped over. Avoiding zero takes 1734 care of a problem that can occur when the TCP window scale option is 1735 used to enlarge the TCP window. When exactly 2^16 octets of TCP data 1736 is lost, a compressed header will be decompressed incorrectly without 1737 being detected by the TCP checksum. TCP segments are often a power of 1738 two. So by using a packet sequence number space that is not a power 1739 of two either the sequence number or the packet sequence number will 1740 differ when 2^16 octets are lost. Whenever a compressor sees the 1741 window scale option on a SYN segment, it must use packet sequence 1742 numbers when subsequently compressing that packet stream. 1744 In compressed TCP headers the two octet packet sequence number is 1745 placed immediately after the TCP Checksum. See section 5.3 for 1746 placement of packet sequence numbers in full headers. 1748 12. Hooks for additional header compression 1750 The following hook is supplied to allow additional header compression 1751 schemes for headers on top of UDP. The initial chain of subheaders is 1752 then compressed as described here, and the other header compression 1753 scheme is applied to the header above the UDP header. An example of 1754 such additional header compression would be Compressed RTP by Casner 1755 and Jacobson [CRTP]. To allow some error detection, such schemes 1756 typically need a sequence number that may need to be passed in full 1757 headers as well as compressed UDP headers. 1759 The D-bit and Data octet (see section 6) provides the necessary 1760 mechanism. When a sequence number, say, needs to be passed in a 1761 FULL_HEADER or COMPRESSED_NON_TCP header, the D-bit is set and the 1762 sequence number is placed in the Data field. The decompressor must 1763 then extract and make the Data field available to the additional 1764 header compression scheme. 1766 Use of additional header compression schemes like CRTP must be 1767 negotiated. The D-bit and Data octet mechanism is automatically 1768 enabled whenever use of additional header compression schemes has 1769 been negotiated. 1771 13. Demultiplexing 1773 It is necessary to distinguish packets with regular IPv4 headers, 1774 regular IPv6 headers, full IPv6 packets, full IPv4 packets, 1775 compressed TCP packets, compressed non-TCP packets, and CONTEXT_STATE 1776 packets. 1778 The decision to use a distinct ethertype (or equivalent) for IPv6 has 1779 already been taken, which means that link-layers must be able to 1780 indicate that a packet is an IPv6 packet. 1782 IPv6 header compression requires that the link-layer implementation 1783 can indicate four kinds of packets: COMPRESSED_TCP for format a) in 1784 section 6, COMPRESSED_TCP_NODELTA for format b), COMPRESSED_NON_TCP 1785 for formats c) and d), and CONTEXT_STATE as described in section 1786 11.2. It is also desirable to indicate FULL_HEADERS at the link 1787 layer. 1789 Full headers can be indicated by setting the first bit of the Version 1790 field in a packet indicated to be an IPv6 packet. In addition, one 1791 bit of the Version field is used to indicate if the first subheader 1792 is an IPv6 or an IPv4 header, and one bit is used to indicate if this 1793 full header carries a TCP CID or a non-TCP CID. The first four bits 1794 are encoded as follows: 1796 Version Meaning 1797 ------- ------- 1799 0110 regular IPv6 header 1801 1T*0 T=1 indicates a TCP header, T=0 indicates a non-TCP header 1802 1*V0 V=1 indicates a IPv6 header, V=0 indicates a IPv4 header 1804 If the link-layer cannot indicate the packet types for the compressed 1805 headers or CONTEXT_STATE, packet types that cannot be indicated could 1806 start with an octet indicating the packet type, followed by the 1807 header. 1809 First octet Type of compressed header 1810 ----------- ------------------------- 1812 0 COMPRESSED_TCP 1813 1 COMPRESSED_TCP_NODELTA 1814 2 COMPRESSED_NON_TCP 1815 3 CONTEXT_STATE 1817 The currently assigned CONTEXT_STATE type values are 1819 Value Type Reference 1820 ----- ----- ---------- 1821 0 Reserved - 1822 1 IP/UDP/RTP w. 8-bit CID [CRTP] 1823 2 IP/UDP/RTP w. 16-bit CID [CRTP] 1824 3 TCP header request Section 10.2 1826 14. Configuration Parameters 1828 Header compression parameters are negotiated in a way specific to the 1829 link-layer implementation. Such prodedures for link-layer xxx needs 1830 to be specified in a document "IP header compression over xxx". Such 1831 a document exists for PPP. 1833 The following parameter is fixed for all implementations of this 1834 header compression scheme. 1836 MIN_WRAP - minimum time of generation value wrap around 1838 3 seconds. 1840 The following parameters can be negotiated between the compressor and 1841 decompressor. If not negotiated their values must be as specified by 1842 DEFAULT. 1844 F_MAX_PERIOD - Largest number of compressed non-TCP headers that 1845 may be sent without sending a full header. 1847 DEFAULT is 256 1849 F_MAX_PERIOD must be at least 1 and at most 65535. 1851 F_MAX_TIME - Compressed headers may not be sent more than 1852 F_MAX_TIME seconds after sending last full header. 1854 DEFAULT is 5 1856 F_MAX_TIME must be at least 1 and at most 255. 1858 NOTE: F_MAX_PERIOD and F_MAX_TIME should be lower when it is 1859 likely that a decompressor loses its state. 1861 MAX_HEADER - The largest header size in octets that may 1862 be compressed. 1864 DEFAULT is 168 octets, which covers 1866 - Two IPv6 base headers 1867 - A Keyed MD5 Authentication Header 1868 - A maximum-sized TCP header 1870 MAX_HEADER must be at least 60 octets and 1871 at most 65535 octets. 1873 TCP_SPACE - Maximum CID value for TCP. 1875 DEFAULT is 15 (which gives 16 CID values) 1877 TCP_SPACE must be at least 3 and at most 255. 1879 NON_TCP_SPACE - Maximum CID value for non-TCP. 1881 DEFAULT is 15 (which gives 16 CID values) 1883 NON_TCP_SPACE must be at least 3 and at most 65535. 1885 EXPECT_REORDERING - The mechanisms in section 11 are used. 1887 DEFAULT no. 1889 15. Implementation Status 1891 A prototype using UDP as the link layer has been operational since 1892 March 1996. A NetBSD implementation for PPP has been operational 1893 since October 1996. 1895 16. Acknowledgments 1897 This protocol uses many ideas originated by Van Jacobson in the 1898 design of header compression for TCP/IP over slow-speed links [RFC- 1899 1144]. It has benefited from discussions with Stephen Casner and 1900 Carsten Bormann. 1902 We thank Craig Partridge for pointing out a problem that can occur 1903 when the TCP window scale option is used. A solution to this problem 1904 relying on the packet sequence numbers used for reordering is 1905 described in section 11.2. 1907 17. Security Considerations 1909 The compression protocols in this document run on top of a link-layer 1910 protocol. The compression protocols themselves introduce no new 1911 additional vulnerabilities beyond those associated with the specific 1912 link-layer technology being used. 1914 Denial-of-service attacks are possible if an intruder can introduce 1915 (for example) bogus Full Header packets onto the link. However, an 1916 intruder having the ability to inject arbitrary packets at the link- 1917 layer in this manner raises additional security issues that dwarf 1918 those related to the use of header compression. 1920 We advise implementors against identifying packet streams with the 1921 aid of information that is encrypted, even if such information 1922 happens to be available to the compressor. Doing so may expose 1923 traffic patterns. 1925 18. Author's Addresses 1927 Mikael Degermark Tel: +46 920 91188 1928 CDT/Dept of Computer Communication Fax: +46 920 72801 1929 Lulea University Mobile: +46 70 833 8933 1930 S-971 87 Lulea, Sweden EMail: micke@sm.luth.se 1932 Bjorn Nordgren Tel: +46 920 75400 1933 CDT/Telia Research AB Fax: +46 920 75490 1934 Aurorum 6 EMail: bcn@lulea.trab.se 1935 S-977 75 Lulea, Sweden 1937 Stephen Pink Tel: +46 8 752 15 59 1938 CDT/Swedish Institute of Computer Science Fax: +46 8 751 72 30 1939 PO Box 1263 Mobile: +46 70 532 0007 1940 S-164 28 Kista, Sweden EMail: steve@sics.se 1942 19. References 1944 [RFC-768] J. Postel, User Datagram Protocol, RFC 761, August 1980. 1946 [RFC-791] J. Postel, Internet Protocol, RFC 791, September 1981. 1948 [RFC-793] J. Postel, Transmission Control Protocol, RFC 793, 1949 September 1981. 1951 [RFC-1144] V. Jacobson, Compressing TCP/IP Headers for Low-Speed 1952 Serial Links, RFC 1144, February 1990. 1954 [RFC-1553] A. Mathur, M. Lewis, Compressing IPX Headers Over WAN 1955 Media (CIPX), RFC 1553, December 1993. 1957 [RFC-1700] J. Reynolds and J. Postel, Assigned Numbers, RFC-1700, 1958 October 1994. 1960 [RFC-1826] R. Atkinson, IP Authentication Header, RFC 1826, August 1961 1995. 1963 [RFC-1827] R. Atkinson, IP Encapsulating Security Protocol (ESP), 1964 RFC 1827, August 1995. 1966 [RFC-1828] Metzger, W. Simpson, IP Authentication using Keyed MD5, 1967 RFC 1828, August 1995. 1969 [IPv6] S. Deering, R. Hinden, Internet Protocol, Version 6 1970 (IPv6) Specification, RFC 1883, December 1995. 1972 [ICMPv6] A. Conta, S. Deering, Internet Control Message Protocol 1973 (ICMPv6) for the Internet Protocol Version 6 (IPv6), RFC 1974 1885, December 1995. 1976 [RFC-2004] C. Perkins, Minimal Encapsulation within IP, RFC 2004, 1977 October 1996. 1979 [CRTP] S. Casner, V. Jacobson, Compressing IP/UDP/RTP Headers for 1980 Low-Speed Serial Links. Internet-Draft (Work in 1981 progress), November 21, 1997. 1983 This draft expires in December 1998.