Debian Codegraph @

rfc2507.html

raw
1 <pre>Network Working Group M. Degermark
2 Request for Comments: 2507 Lulea University of Technology/SICS
3 Category: Standards Track B. Nordgren
4 Lulea University of Technology/Telia Research AB
5 S. Pink
6 Lulea University of Technology/SICS
7 February 1999
8
9
10 <span class="h1">IP Header Compression</span>
11
12 Status of this Memo
13
14 This document specifies an Internet standards track protocol for the
15 Internet community, and requests discussion and suggestions for
16 improvements. Please refer to the current edition of the "Internet
17 Official Protocol Standards" (STD 1) for the standardization state
18 and status of this protocol. Distribution of this memo is unlimited.
19
20 Copyright Notice
21
22 Copyright (C) The Internet Society (1999). All Rights Reserved.
23
24 Abstract
25
26 This document describes how to compress multiple IP headers and TCP
27 and UDP headers per hop over point to point links. The methods can be
28 applied to of IPv6 base and extension headers, IPv4 headers, TCP and
29 UDP headers, and encapsulated IPv6 and IPv4 headers.
30
31 Headers of typical UDP or TCP packets can be compressed down to 4-7
32 octets including the 2 octet UDP or TCP checksum. This largely
33 removes the negative impact of large IP headers and allows efficient
34 use of bandwidth on low and medium speed links.
35
36 The compression algorithms are specifically designed to work well
37 over links with nontrivial packet-loss rates. Several wireless and
38 modem technologies result in such links.
39
40 TABLE OF CONTENTS
41
42 <a href="#section-1">1</a>. Introduction..............................................<a href="#page-3">3</a>
43 <a href="#section-2">2</a>. Terminology...............................................<a href="#page-5">5</a>
44 <a href="#section-3">3</a>. Compression method........................................<a href="#page-7">7</a>
45 <a href="#section-3.1">3.1</a>. Packet types.......................................<a href="#page-8">8</a>
46 <a href="#section-3.2">3.2</a>. Lost packets in TCP packet streams.................<a href="#page-9">9</a>
47 <a href="#section-3.3">3.3</a>. Lost packets in UDP and non-TCP packet streams....<a href="#page-10">10</a>
48 <a href="#section-4">4</a>. Grouping packets into packet streams.....................<a href="#page-14">14</a>
49
50
51
52 <span class="grey">Degermark, et. al. Standards Track [Page 1]</span></pre>
53 <hr class='noprint'/><!--NewPage--><pre class='newpage'><span id="page-2" ></span>
54 <span class="grey"><a href="./rfc2507">RFC 2507</a> IP Header Compression February 1999</span>
55
56
57 <a href="#section-4.1">4.1</a>. Guidelines for grouping packets...................<a href="#page-15">15</a>
58 <a href="#section-5">5</a>. Size Issues..............................................<a href="#page-16">16</a>
59 <a href="#section-5.1">5.1</a>. Context identifiers...............................<a href="#page-16">16</a>
60 <a href="#section-5.2">5.2</a>. Size of the context...............................<a href="#page-17">17</a>
61 <a href="#section-5.3">5.3</a>. Size of full headers..............................<a href="#page-18">18</a>
62 <a href="#section-5.3.1">5.3.1</a>. Length fields in full TCP headers............<a href="#page-19">19</a>
63 <a href="#section-5.3.2">5.3.2</a>. Length fields in full non-TCP headers........<a href="#page-19">19</a>
64 <a href="#section-6">6</a>. Compressed Header Formats................................<a href="#page-20">20</a>
65 <a href="#section-7">7</a>. Compression of subheaders................................<a href="#page-22">22</a>
66 <a href="#section-7.1">7.1</a>. IPv6 Header.......................................<a href="#page-24">24</a>
67 <a href="#section-7.2">7.2</a>. IPv6 Extension Headers............................<a href="#page-25">25</a>
68 <a href="#section-7.3">7.3</a>. Options...........................................<a href="#page-25">25</a>
69 <a href="#section-7.4">7.4</a>. Hop-by-hop Options Header.........................<a href="#page-26">26</a>
70 <a href="#section-7.5">7.5</a>. Routing Header....................................<a href="#page-26">26</a>
71 <a href="#section-7.6">7.6</a>. Fragment Header...................................<a href="#page-27">27</a>
72 <a href="#section-7.7">7.7</a>. Destination Options Header........................<a href="#page-28">28</a>
73 <a href="#section-7.8">7.8</a>. No Next Header....................................<a href="#page-29">29</a>
74 <a href="#section-7.9">7.9</a>. Authentication Header.............................<a href="#page-29">29</a>
75 <a href="#section-7.10">7.10</a>. Encapsulating Security Payload Header.............<a href="#page-29">29</a>
76 <a href="#section-7.11">7.11</a>. UDP Header........................................<a href="#page-30">30</a>
77 <a href="#section-7.12">7.12</a>. TCP Header........................................<a href="#page-30">30</a>
78 <a href="#section-7.13">7.13</a>. IPv4 Header.......................................<a href="#page-33">33</a>
79 <a href="#section-7.14">7.14</a> Minimal Encapsulation header......................<a href="#page-34">34</a>
80 <a href="#section-8">8</a>. Changing context identifiers.............................<a href="#page-35">35</a>
81 <a href="#section-9">9</a>. Rules for dropping or temporarily storing packets........<a href="#page-35">35</a>
82 <a href="#section-10">10</a>. Low-loss header compression for TCP .....................<a href="#page-36">36</a>
83 <a href="#section-10.1">10.1</a>. The "twice" algorithm............................<a href="#page-37">37</a>
84 <a href="#section-10.2">10.2</a>. Header Requests..................................<a href="#page-37">37</a>
85 <a href="#section-11">11</a>. Links that reorder packets...............................<a href="#page-38">38</a>
86 <a href="#section-11.1">11.1</a>. Reordering in non-TCP packet streams.............<a href="#page-39">39</a>
87 <a href="#section-11.2">11.2</a>. Reordering in TCP packet streams.................<a href="#page-39">39</a>
88 <a href="#section-12">12</a>. Hooks for additional header compression..................<a href="#page-40">40</a>
89 <a href="#section-13">13</a>. Demultiplexing...........................................<a href="#page-41">41</a>
90 <a href="#section-14">14</a>. Configuration Parameters.................................<a href="#page-42">42</a>
91 <a href="#section-15">15</a>. Implementation Status....................................<a href="#page-43">43</a>
92 <a href="#section-16">16</a>. Acknowledgments..........................................<a href="#page-44">44</a>
93 <a href="#section-17">17</a>. Security Considerations..................................<a href="#page-44">44</a>
94 <a href="#section-18">18</a>. Authors' Addresses.......................................<a href="#page-45">45</a>
95 <a href="#section-19">19</a>. References...............................................<a href="#page-46">46</a>
96 <a href="#section-20">20</a>. Full Copyright Statement.................................<a href="#page-47">47</a>
97
98
99
100
101
102
103
104
105
106
107
108 <span class="grey">Degermark, et. al. Standards Track [Page 2]</span></pre>
109 <hr class='noprint'/><!--NewPage--><pre class='newpage'><span id="page-3" ></span>
110 <span class="grey"><a href="./rfc2507">RFC 2507</a> IP Header Compression February 1999</span>
111
112
113 <span class="h2"><a class="selflink" id="section-1" href="#section-1">1</a>. Introduction</span>
114
115 There are several reasons to do header compression on low- or
116 medium-speed links. Header compression can
117
118 * Improve interactive response time
119
120 For very low-speed links, echoing of characters may take longer
121 than 100-200 ms because of the time required to transmit large
122 headers. 100-200 ms is the maximum time people can tolerate
123 without feeling that the system is sluggish.
124
125 * Allow using small packets for bulk data with good line efficiency
126
127 This is important when interactive (for example Telnet) and bulk
128 traffic (for example FTP) is mixed because the bulk data should be
129 carried in small packets to decrease the waiting time when a
130 packet with interactive data is caught behind a bulk data packet.
131
132 Using small packet sizes for the FTP traffic in this case is a
133 global solution to a local problem. It will increase the load on
134 the network as it has to deal with many small packets. A better
135 solution might be to locally fragment the large packets over the
136 slow link.
137
138 * Allow using small packets for delay sensitive low data-rate traffic
139
140 For such applications, for example voice, the time to fill a
141 packet with data is significant if packets are large. To get low
142 end-to-end delay small packets are preferred. Without header
143 compression, the smallest possible IPv6/UDP headers (48 octets)
144 consume 19.2 kbit/s with a packet rate of 50 packets/s. 50
145 packets/s is equivalent to having 20 ms worth of voice samples in
146 each packet. IPv4/UDP headers consumes 11.2 kbit/s at 50
147 packets/s. Tunneling or routing headers, for example to support
148 mobility, will increase the bandwidth consumed by headers by 10-20
149 kbit/s. This should be compared with the bandwidth required for
150 the actual sound samples, for example 13 kbit/s with GSM encoding.
151 Header compression can reduce the bandwidth needed for headers
152 significantly, in the example to about 1.7 kbit/s. This enables
153 higher quality voice transmission over 14.4 and 28.8 kbit/s
154 modems.
155
156 * Decrease header overhead.
157
158 A common size of TCP segments for bulk transfers over medium-speed
159 links is 512 octets today. When TCP segments are tunneled, for
160 example because Mobile IP is used, the IPv6/IPv6/TCP header is 100
161
162
163
164 <span class="grey">Degermark, et. al. Standards Track [Page 3]</span></pre>
165 <hr class='noprint'/><!--NewPage--><pre class='newpage'><span id="page-4" ></span>
166 <span class="grey"><a href="./rfc2507">RFC 2507</a> IP Header Compression February 1999</span>
167
168
169 octets. Header compression will decrease the header overhead for
170 IPv6/TCP from 19.5 per cent to less than 1 per cent, and for
171 tunneled IPv4/TCP from 11.7 to less than 1 per cent. This is a
172 significant gain for line-speeds as high as a few Mbit/s.
173
174 The IPv6 specification prescribes path MTU discovery, so with IPv6
175 bulk TCP transfers should use segments larger than 512 octets when
176 possible. Still, with 1400 octet segments (<a href="./rfc894">RFC 894</a> Ethernet
177 encapsulation allows 1500 octet payloads, of which 100 octets are
178 used for IP headers), header compression reduces IPv6 header
179 overhead from 7.1% to 0.4%.
180
181 * Reduce packet loss rate over lossy links.
182
183 Because fewer bits are sent per packet, the packet loss rate will
184 be lower for a given bit-error rate. This results in higher
185 throughput for TCP as the sending window can open up more between
186 losses, and in fewer lost packets for UDP.
187
188 The mechanisms described here are intended for a point-to-point link.
189 However, care has been taken to allow extensions for multi-access
190 links and multicast.
191
192 Headers that can be compressed include TCP, UDP, IPv4, and IPv6 base
193 and extension headers. For TCP packets, the mechanisms of Van
194 Jacobson [<a href="./rfc1144" title="&quot;Compressing TCP/IP Headers for Low- Speed Serial Links&quot;">RFC-1144</a>] are used to recover from loss. Two additional
195 mechanisms that increase the efficiency of VJ header compression over
196 lossy links are also described. For non-TCP packets, compression
197 slow-start and periodic header refreshes allow minimal periods of
198 packet discard after loss of a header that changes the context. There
199 are hooks for adding header compression schemes on top of UDP, for
200 example compression of RTP headers.
201
202 Header compression relies on many fields being constant or changing
203 seldomly in consecutive packets belonging to the same packet stream.
204 Fields that do not change between packets need not be transmitted at
205 all. Fields that change often with small and/or predictable values,
206 e.g., TCP sequence numbers, can be encoded incrementally so that the
207 number of bits needed for these fields decrease significantly. Only
208 fields that change often and randomly, e.g., checksums or
209 authentication data, need to be transmitted in every header.
210
211 The general principle of header compression is to occasionally send a
212 packet with a full header; subsequent compressed headers refer to the
213 context established by the full header and may contain incremental
214 changes to the context.
215
216
217
218
219
220 <span class="grey">Degermark, et. al. Standards Track [Page 4]</span></pre>
221 <hr class='noprint'/><!--NewPage--><pre class='newpage'><span id="page-5" ></span>
222 <span class="grey"><a href="./rfc2507">RFC 2507</a> IP Header Compression February 1999</span>
223
224
225 This header compression scheme does not require that all packets in
226 the same stream passes over the compressed link. However, for TCP
227 streams the difference between subsequent headers can become more
228 irregular and the compression rate can decrease. Neither is it
229 required that corresponding TCP data and acknowledgment packets
230 traverse the link in opposite directions.
231
232 This header compression scheme is useful on first-hop or last-hop
233 links as well as links in the middle of the network. When many packet
234 streams (several hundred) traverse the link, a phenomenon that could
235 be called CID thrashing could occur, where headers seldom can be
236 matched with an existing context and have to be sent uncompressed or
237 as full headers. It is up to an implementation to use techniques such
238 as hysteresis to ensure that the packet streams that give the highest
239 compression rates keep their context. Such techniques are more
240 likely to be needed in the middle of the network.
241
242 <span class="h2"><a class="selflink" id="section-2" href="#section-2">2</a>. Terminology</span>
243
244 This section explains some terms used in this document.
245
246 The key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT",
247 "SHOULD", "SHOULD NOT", "RECOMMENDED", "MAY", and "OPTIONAL" in this
248 document are to be interpreted as described in <a href="./rfc2119">RFC 2119</a>.
249
250 Subheader
251
252 An IPv6 base header, an IPv6 extension header, an IPv4 header, a
253 UDP header, or a TCP header.
254
255 Header
256
257 A chain of subheaders.
258
259 Compress
260
261 The act of reducing the size of a header by removing header fields
262 or reducing the size of header fields. This is done in a way such
263 that a decompressor can reconstruct the header if its context
264 state is identical to the context state used when compressing the
265 header.
266
267 Decompress
268
269 The act of reconstructing a compressed header.
270
271
272
273
274
275
276 <span class="grey">Degermark, et. al. Standards Track [Page 5]</span></pre>
277 <hr class='noprint'/><!--NewPage--><pre class='newpage'><span id="page-6" ></span>
278 <span class="grey"><a href="./rfc2507">RFC 2507</a> IP Header Compression February 1999</span>
279
280
281 Context identifier (CID)
282
283 A small unique number identifying the context that should be used
284 to decompress a compressed header. Carried in full headers and
285 compressed headers.
286
287 Context
288
289 The state which the compressor uses to compress a header and the
290 decompressor uses to decompress a header. The context is the
291 uncompressed version of the last header sent (compressor) or
292 received (decompressor) over the link, except for fields in the
293 header that are included "as-is" in compressed headers or can be
294 inferred from, e.g., the size of the link-level frame.
295
296 The context for a packet stream is associated with a context
297 identifier. The context for non-TCP packet streams is also
298 associated with a generation.
299
300 Generation
301
302 For non-TCP packet streams, each new version of the context for a
303 given CID is associated with a generation: a small number that is
304 incremented whenever the context associated with that CID changes.
305 Carried by full and compressed non-TCP headers.
306
307 Packet stream
308
309 A sequence of packets whose headers are similar and share context.
310 For example, headers in a TCP packet stream have the same source
311 and final destination address, and the same port numbers in the
312 TCP header. Similarly, headers in a UDP packet stream have the
313 same source and destination address, and the same port numbers in
314 the UDP header.
315
316 Full header (header refresh)
317
318 An uncompressed header that updates or refreshes the context for a
319 packet stream. It carries a CID that will be used to identify the
320 context.
321
322 Full headers for non-TCP packet streams also carry the generation
323 of the context they update or refresh.
324
325 Regular header
326
327 A normal, uncompressed, header. Does not carry CID or generation
328 association.
329
330
331
332 <span class="grey">Degermark, et. al. Standards Track [Page 6]</span></pre>
333 <hr class='noprint'/><!--NewPage--><pre class='newpage'><span id="page-7" ></span>
334 <span class="grey"><a href="./rfc2507">RFC 2507</a> IP Header Compression February 1999</span>
335
336
337 Incorrect decompression
338
339 When a compressed and then decompressed header is different from
340 the uncompressed header. Usually due to mismatching context
341 between the compressor and decompressor or bit errors during
342 transmission of the compressed header.
343
344 Differential coding
345
346 A compression technique where the compressed value of a header
347 field is the difference between the current value of the field and
348 the value of the same field in the previous header belonging to
349 the same packet stream. A decompressor can thus obtain the value
350 of the field by adding the value in the compressed header to its
351 context. This technique is used for TCP streams but not for non-
352 TCP streams.
353
354 <span class="h2"><a class="selflink" id="section-3" href="#section-3">3</a>. Compression method</span>
355
356 Much of the header information stays the same over the life-time of a
357 packet stream. For non-TCP packet streams almost all fields of the
358 headers are constant. For TCP many fields are constant and others
359 change with small and predictable values.
360
361 To initiate compression of the headers of a packet stream, a full
362 header carrying a context identifier, CID, is transmitted over the
363 link. The compressor and decompressor store most fields of this full
364 header as context. The context consists of the fields of the header
365 whose values are constant and thus need not be sent over the link at
366 all, or change little between consecutive headers so that it uses
367 fewer bits to send the difference from the previous value compared to
368 sending the absolute value.
369
370 Any change in fields that are expected to be constant in a packet
371 stream will cause the compressor to send a full header again to
372 update the context at the decompressor. As long as the context is the
373 same at compressor and decompressor, headers can be decompressed to
374 be exactly as they were before compression. However, if a full header
375 or compressed header is lost during transmission, the context of the
376 decompressor may become obsolete as it is not updated properly.
377 Compressed headers will then be decompressed incorrectly.
378
379 IPv6 is not meant to be used over links that can deliver a
380 significant fraction of damaged packets to the IPv6 module. This
381 means that links must have a very low bit-error rate or that link-
382 level frames must be protected by strong checksums, forward error
383 correction or something of that nature. Header compression SHOULD
384 not be used for IPv4 without strong link-level checksums. Damaged
385
386
387
388 <span class="grey">Degermark, et. al. Standards Track [Page 7]</span></pre>
389 <hr class='noprint'/><!--NewPage--><pre class='newpage'><span id="page-8" ></span>
390 <span class="grey"><a href="./rfc2507">RFC 2507</a> IP Header Compression February 1999</span>
391
392
393 frames will thus be discarded by the link layer. The link layer
394 implementation might indicate to the header compression module that a
395 frame was damaged, but it cannot say what packet stream it belonged
396 to as it might be the CID that is damaged. Moreover, frames may
397 disappear without the link layer implementation's knowledge, for
398 example if the link is a multi-hop link where frames can be dropped
399 due to congestion at each hop. The kind of link errors that a header
400 compression module should deal with and protect against will thus be
401 packet loss.
402
403 So a header compression scheme needs mechanisms to update the context
404 at the decompressor and to detect or avoid incorrect decompression.
405 These mechanisms are very different for TCP and non-TCP streams, and
406 are described in sections <a href="#section-3.2">3.2</a> and <a href="#section-3.3">3.3</a>.
407
408 The compression mechanisms in this document assume that packets are
409 not reordered between the compressor and decompressor. If the link
410
411 does reorder, <a href="#section-11">section 11</a> describes mechanisms for ordering the
412 packets before decompression. It is also assumed that the link-layer
413 implementation can provide the length of packets, and that there is
414 no padding in UDP packets or tunneled packets.
415
416 <span class="h3"><a class="selflink" id="section-3.1" href="#section-3.1">3.1</a>. Packet types</span>
417
418 This compression method uses four packet types in addition to the
419 IPv4 and IPv6 packet types. The combination of link-level packet
420 type and the value of the first four bits of the packet uniquely
421 determines the packet type. Details on how these packet types are
422 represented are in <a href="#section-13">section 13</a>.
423
424 FULL_HEADER - indicates a packet with an uncompressed header,
425 including a CID and, if not a TCP packet, a generation. It
426 establishes or refreshes the context for the packet stream
427 identified by the CID.
428
429 COMPRESSED_NON_TCP - indicates a non-TCP packet with a compressed
430 header. The compressed header consists of a CID identifying what
431 context to use for decompression, a generation to detect an
432 inconsistent context and the randomly changing fields of the
433 header.
434
435 COMPRESSED_TCP - indicates a packet with a compressed TCP header,
436 containing a CID, a flag octet indentifying what fields have
437 changed, and the changed fields encoded as the difference from
438 the previous value.
439
440
441
442
443
444 <span class="grey">Degermark, et. al. Standards Track [Page 8]</span></pre>
445 <hr class='noprint'/><!--NewPage--><pre class='newpage'><span id="page-9" ></span>
446 <span class="grey"><a href="./rfc2507">RFC 2507</a> IP Header Compression February 1999</span>
447
448
449 COMPRESSED_TCP_NODELTA - indicates a packet with a compressed TCP
450 header where all fields that are normally sent as the difference
451 to the previous value are instead sent as-is. This packet type
452 is only sent as the response to a header request from the
453 decompressor. It must not be sent as the result of a
454 retransmission.
455
456 In addition to the packet types used for compression, regular IPv4
457 and IPv6 packets are used whenever a compressor decides to not
458 compress a packet. An additional packet type may be used to speed up
459 repair of TCP streams over links where the decompressor can send
460 packets to the compressor.
461
462 CONTEXT_STATE - indicates a special packet sent from the
463 decompressor to the compressor to communicate a list of (TCP)
464 CIDs for which synchronization has been lost. This packet is only
465 sent over a single link so it requires no IP header. The format
466 is shown in <a href="#section-10.2">section 10.2</a>.
467
468 <span class="h3"><a class="selflink" id="section-3.2" href="#section-3.2">3.2</a>. Lost packets in TCP packet streams</span>
469
470 Since TCP headers are compressed using the difference from the
471 previous TCP header, loss of a packet with a compressed or full
472 header will cause subsequent compressed headers to be decompressed
473 incorrectly because the context used for decompression was not
474 incremented properly.
475
476 Loss of a compressed TCP header will cause the TCP sequence numbers
477 of subsequently decompressed TCP headers to be off by k, where k is
478 the size of the lost segment. Such incorrectly decompressed TCP
479 headers will be discarded by the TCP receiver as the TCP checksum
480 reliably catches "off-by-k" errors in the sequence numbers for
481 plausible k.
482
483 TCP's repair mechanisms will eventually retransmit the discarded
484 segment and the compressor peeks into the TCP headers to detect when
485 TCP retransmits. When this happens, the compressor sends a full
486 header on the assumption that the retransmission was due to
487 mismatching compression state at the decompressor. [<a href="./rfc1144" title="&quot;Compressing TCP/IP Headers for Low- Speed Serial Links&quot;">RFC-1144</a>] has a
488 good explanation of this mechanism.
489
490 The mechanisms of <a href="#section-10">section 10</a> should be used to speed up the repair of
491 the context. This is important over medium speed links with high
492 packet loss rates, for example wireless. Losing a timeout's worth of
493 packets due to inconsistent context after each packet lost over the
494 link is not acceptable, especially when the TCP connection is over
495 the wide area.
496
497
498
499
500 <span class="grey">Degermark, et. al. Standards Track [Page 9]</span></pre>
501 <hr class='noprint'/><!--NewPage--><pre class='newpage'><span id="page-10" ></span>
502 <span class="grey"><a href="./rfc2507">RFC 2507</a> IP Header Compression February 1999</span>
503
504
505 <span class="h3"><a class="selflink" id="section-3.3" href="#section-3.3">3.3</a>. Lost packets in UDP and other non-TCP packet streams</span>
506
507 Incorrectly decompressed headers of UDP packets and other non-TCP
508 packets are not so well-protected by checksums as TCP packets. There
509 are no sequence numbers that become "off-by-k" and virtually
510 guarantees a failed checksum as there are for TCP. The UDP checksum
511 only covers payload, UDP header, and pseudo header. The pseudo
512 header includes the source and destination addresses, the transport
513 protocol type and the length of the transport packet. Except for
514 those fields, large parts of the IPv6 header are not covered by the
515 UDP checksum. Moreover, other non-TCP headers lack checksums
516 altogether, for example fragments.
517
518 In order to safely avoid incorrect decompression of non-TCP headers,
519 each version of the context for non-TCP packet streams is identified
520 by a generation, a small number that is carried by the full headers
521 that establish and refresh the context. Compressed headers carry the
522 generation value of the context that were used to compress them.
523 When a decompressor sees that a compressed header carries a
524 generation value other than the generation of its context for that
525 packet stream, the context is not up to date and the packet must be
526 discarded or stored until a full header establishes correct context.
527
528 Differential coding is not used for non-TCP streams, so compressed
529 non-TCP headers do not change the context. Thus, loss of a
530 compressed header does not invalidate subsequent packets with
531 compressed headers. Moreover, the generation changes only when the
532 context of a full header is different from the context of the
533 previous full header. This means that losing a full header will make
534 the context of the decompressor obsolete only when the full header
535 would actually have changed the context.
536
537 The generation field is 6 bits long so the generation value repeats
538 itself after 64 changes to the context. To avoid incorrect
539 decompression after error bursts or other temporary disruptions, the
540 compressor must not reuse the same generation value after a shorter
541 time than MIN_WRAP seconds. A decompressor which has been
542 disconnected MIN_WRAP seconds or more must wait for the next full
543 header before decompressing. A compressor must wait at least MIN_WRAP
544 seconds after booting before compressing non-TCP headers. Instead of
545 reusing a generation value too soon, a compressor may switch to
546 another CID or send regular headers until MIN_WRAP seconds have
547 passed. The value of MIN_WRAP is found in <a href="#section-14">section 14</a>.
548
549
550
551
552
553
554
555
556 <span class="grey">Degermark, et. al. Standards Track [Page 10]</span></pre>
557 <hr class='noprint'/><!--NewPage--><pre class='newpage'><span id="page-11" ></span>
558 <span class="grey"><a href="./rfc2507">RFC 2507</a> IP Header Compression February 1999</span>
559
560
561 <span class="h4"><a class="selflink" id="section-3.3.1" href="#section-3.3.1">3.3.1</a>. Compression Slow-Start</span>
562
563 To allow the decompressor to recover quickly from loss of a full
564 header that would have changed the context, full headers are sent
565 periodically with an exponentially increasing period after a change
566 in the context. This technique avoids an exchange of messages between
567 compressor and decompressor used by other compression schemes, such
568 as in [<a href="./rfc1553" title="&quot;Compressing IPX Headers Over WAN Media (CIPX)&quot;">RFC-1553</a>]. Such exchanges can be costly for wireless mobiles
569 as more power is consumed by the transmitter and delay can be
570 introduced by switching between sending and receiving. Moreover,
571 techniques that require an exchange of messages cannot be used over
572 simplex links, such as direct-broadcast satellite channels or cable
573 TV systems, and are hard to adapt to multicast over multi-access
574 links.
575
576 |.|..|....|........|................|..............................
577 ^
578 Change Sent packets: | with full header, . with compressed header
579
580 The picture shows how packets are sent after change. The compressor
581 keeps a variable for each non-TCP packet stream, F_PERIOD, that keeps
582 track of how many compressed headers may be sent between full
583 headers. When the headers of a non-TCP packet stream change so that
584 its context changes, a full header is sent and F_PERIOD is set to
585 one. After sending F_PERIOD compressed headers, a full header is
586 sent. F_PERIOD is doubled each time a full header is sent during
587 compression slow-start.
588
589 <span class="h4"><a class="selflink" id="section-3.3.2" href="#section-3.3.2">3.3.2</a>. Periodic Header Refreshes</span>
590
591 To avoid losing too many packets if a receiver has lost its context,
592 there is an upper limit, F_MAX_PERIOD, on the number of non-TCP
593 packets with compressed headers that may be sent between header
594 refreshes. If a packet is to be sent and F_MAX_PERIOD compressed
595 headers have been sent since the last full header for this packet
596 stream was sent, a full header must be sent.
597
598 To avoid long periods of disconnection for low data rate packet
599 streams, there is also an upper bound, F_MAX_TIME, on the time
600 between full headers in a non-TCP packet stream. If a packet is to be
601 sent and more than F_MAX_TIME seconds have passed since the last full
602 header was sent for this packet stream, a full header must be sent.
603 The values of F_MAX_PERIOD and F_MAX_TIME are found in <a href="#section-14">section 14</a>.
604
605
606
607
608
609
610
611
612 <span class="grey">Degermark, et. al. Standards Track [Page 11]</span></pre>
613 <hr class='noprint'/><!--NewPage--><pre class='newpage'><span id="page-12" ></span>
614 <span class="grey"><a href="./rfc2507">RFC 2507</a> IP Header Compression February 1999</span>
615
616
617 <span class="h4"><a class="selflink" id="section-3.3.3" href="#section-3.3.3">3.3.3</a>. Rules for sending Full Headers</span>
618
619 The following pseudo code can be used by the compressor to determine
620 when to send a full header for a non-TCP packet stream. The code
621 maintains two variables:
622
623 C_NUM -- a count of the number of compressed headers sent
624 since the last full header was sent.
625 F_LAST -- the time of sending the last full header.
626
627 and uses the functions
628
629 current_time() return the current time
630 min(a,b) return the smallest of a and b
631
632 the procedures send_full_header(), increment_generation_value(),
633 and send_compressed_header()
634 do the obvious thing.
635
636 if ( &lt;this header changes the context&gt; )
637
638 C_NUM := 0;
639 F_LAST := current_time();
640 F_PERIOD := 1;
641 increment_generation_value();
642 send_full_header();
643
644 elseif ( C_NUM &gt;= F_PERIOD )
645
646 C_NUM := 0;
647 F_LAST := current_time();
648 F_PERIOD := min(2 * F_PERIOD, F_MAX_PERIOD);
649 send_full_header();
650
651 elseif ( current_time() &gt; F_LAST + F_MAX_TIME )
652
653 C_NUM := 0;
654 F_LAST := current_time();
655 send_full_header();
656
657 else
658
659 C_NUM := C_NUM + 1
660 send_compressed_header();
661
662 endif
663
664
665
666
667
668 <span class="grey">Degermark, et. al. Standards Track [Page 12]</span></pre>
669 <hr class='noprint'/><!--NewPage--><pre class='newpage'><span id="page-13" ></span>
670 <span class="grey"><a href="./rfc2507">RFC 2507</a> IP Header Compression February 1999</span>
671
672
673 <span class="h4"><a class="selflink" id="section-3.3.4" href="#section-3.3.4">3.3.4</a>. Cost of sending Header Refreshes</span>
674
675 If every f'th packet carries a full header, H is the size of a full
676 header, and C is the size of a compressed header, the average header
677 size is
678
679 (H-C)/f + C
680
681 For f &gt; 1, the average header size is (H-C)/f larger than a
682 compressed header.
683
684 In a diagram where the average header size is plotted for various f
685 values, there is a distinct knee in the curve, i.e., there is a limit
686 beyond which further increasing f gives diminishing returns.
687 F_MAX_PERIOD should be chosen to be a frequency well to the right of
688 the knee of the curve. For typical sizes of H and C, say 48 octets
689 for the full header (IPv6/UDP) and 4 octets for the compressed
690 header, setting F_MAX_PERIOD &gt; 44 means that full headers will
691 contribute less than an octet to the average header size. With a
692 four-address routing header, F_MAX_PERIOD &gt; 115 will have the same
693 effect.
694
695 The default F_MAX_PERIOD value of 256 (<a href="#section-14">section 14</a>) puts the full
696 header frequency well to the right of the knee and means that full
697 headers will typically contribute considerably less than an octet to
698 the average header size. For H = 48 and C = 4, full headers
699 contribute about 1.4 bits to the average header size after reaching
700 the steady-state header refresh frequency determined by the default
701
702 F_MAX_PERIOD. 1.4 bits is a very small overhead.
703
704 After a change in the context, the exponential backoff scheme will
705 initially send full headers frequently. The default F_MAX_PERIOD
706 will be reached after nine full headers and 255 compressed headers
707 have been sent. This is equivalent to a little over 5 seconds for a
708 typical voice stream with 20 ms worth of voice samples per packet.
709
710 During the whole backoff period, full headers contribute 1.5 octets
711 to the average header size when H = 48 and C = 4. For 20 ms voice
712 samples, it takes less than 1.3 seconds until full headers contribute
713 less than one octet to the average header size, and during these
714 initial 1.3 seconds full headers add less than 4 octets to the
715 average header size. The cost of the exponential backoff is not
716 great and as the headers of non-TCP packet streams are expected to
717 change seldomly, it will be amortized over a long time.
718
719
720
721
722
723
724 <span class="grey">Degermark, et. al. Standards Track [Page 13]</span></pre>
725 <hr class='noprint'/><!--NewPage--><pre class='newpage'><span id="page-14" ></span>
726 <span class="grey"><a href="./rfc2507">RFC 2507</a> IP Header Compression February 1999</span>
727
728
729 The cost of header refreshes in terms of bandwidth are higher than
730 similar costs for hard state schemes like [<a href="./rfc1553" title="&quot;Compressing IPX Headers Over WAN Media (CIPX)&quot;">RFC-1553</a>] where full
731 headers must be acknowledged by the decompressor before compressed
732 headers may be sent. Such schemes typically send one full header plus
733 a few control messages when the context changes. Hard state schemes
734 require more types of protocol messages and an exchange of messages
735 is necessary. Hard state schemes also need to deal explicitly with
736 various error conditions that soft state handles automatically, for
737 instance the case of one party disappearing unexpectedly, a common
738 situation on wireless links where mobiles may go out of range of the
739 base station.
740
741 The major advantage of the soft state scheme is that no handshakes
742 are needed between compressor and decompressor, so the scheme can be
743 used over simplex links. The costs in terms of bandwidth are higher
744 than for hard state schemes, but the simplicity of the decompressor,
745 the simplicity of the protocol, and the lack of handshakes between
746 compressor and decompressor justifies this small cost. Moreover, soft
747 state schemes are more easily extended to multicast over multi-access
748 links, for example radio links.
749
750 <span class="h2"><a class="selflink" id="section-4" href="#section-4">4</a>. Grouping packets into packet streams</span>
751
752 This section explains how packets MAY be grouped together into packet
753 streams for compression. To achieve the best compression rates,
754 packets SHOULD be grouped together such that packets in the same
755 packet stream have similar headers. If this grouping fails, header
756 compression performance will be bad, since the compression algorithm
757 can rarely utilize the existing context for the packet stream and
758 full headers must be sent frequently.
759
760 Grouping is done by the compressor. A compressor may use whatever
761 criterion it finds appropriate to group packets into packet streams.
762 To determine what packet stream a packet belongs to, a compressor MAY
763
764 a) examine the compressible chain of subheaders (see <a href="#section-7">section 7</a>),
765
766 b) examine the contents of an upper layer protocol header that
767 follows the compressible chain of subheaders, for example ICMP
768 headers, DVMRP headers, or tunneled IPX headers,
769
770 c) use information obtained from a resource manager, for example if a
771 resource manager requests compression for a particular packet
772 stream and provides a way to identify packets belonging to that
773 packet stream,
774
775
776
777
778
779
780 <span class="grey">Degermark, et. al. Standards Track [Page 14]</span></pre>
781 <hr class='noprint'/><!--NewPage--><pre class='newpage'><span id="page-15" ></span>
782 <span class="grey"><a href="./rfc2507">RFC 2507</a> IP Header Compression February 1999</span>
783
784
785 d) use any other relevant information, for example if routes flap and
786 the hop limit (TTL) field in a packet stream changes frequently
787 between n and n+k, a compressor may choose to group the packets
788 into two different packet streams.
789
790 A compressor is also free not to group packets into packet streams
791 for compression, letting some packets keep their regular headers and
792 passing them through unmodified.
793
794 As long as the rules for when to send full headers for a non-TCP
795 packet stream are followed and subheaders are compressed as specified
796 in this document, the decompressor is able to reconstruct a
797 compressed header correctly regardless of how packets are grouped
798 into packet streams.
799
800 <span class="h3"><a class="selflink" id="section-4.1" href="#section-4.1">4.1</a> Guidelines for grouping packets</span>
801
802 In this section we give OPTIONAL guidelines for how a compressor may
803 group packets into packet streams for compression.
804
805 Defining fields
806
807 The defining fields of a header should be present and identical in
808 all packets belonging to the same packet stream. These fields are
809 marked DEF in <a href="#section-7">section 7</a>. The defining fields include the flow
810 label, source and destination addresses of IP headers, final
811 destination address in routing headers, the next header fields
812 (for IPv6), the protocol field (IPv4), port numbers (UDP and TCP),
813 and the SPI in authentication and encryption headers.
814
815 Fragmented packets
816
817 Fragmented and unfragmented packets should never be grouped
818 together in the same packet stream. The Identification field of
819 the Fragment header or IPv4 header should not be used to identify
820 the packet stream. If it was, the first fragment of a new packet
821 would cause a compression slow-start.
822
823 No field after a Fragment Header, or an IPv4 header for a
824 fragment, should be used for grouping purposes.
825
826 Upper protocol identification
827
828 The first next header field identifying a header not described in
829 <a href="#section-7">section 7</a> should be used for identifying packet streams, i.e., all
830 packets with the same DEF fields and the same upper protocol
831 should be grouped together.
832
833
834
835
836 <span class="grey">Degermark, et. al. Standards Track [Page 15]</span></pre>
837 <hr class='noprint'/><!--NewPage--><pre class='newpage'><span id="page-16" ></span>
838 <span class="grey"><a href="./rfc2507">RFC 2507</a> IP Header Compression February 1999</span>
839
840
841 TTL field (Hop Limit field)
842
843 A sophisticated implementation might monitor the TTL (Hop Limit)
844 field and if it changes frequently use it as a DEF field. This can
845 occur when there are frequent route flaps so that packets traverse
846 different paths through the internet.
847
848 Traffic Class field (IPv6), Type of Service field (IPv4)
849
850 It is possible that the Traffic Class field of the IPv6 header and
851 the Type of Service of the IPv4 header will change frequently
852 between packets with otherwise identical DEF fields. A
853 sophisticated implementation should watch out for this and be
854 prepared to use these fields as defining fields.
855
856 When IP packets are tunneled they are encapsulated with an additional
857 IP header at the tunnel entry point and then sent to the tunnel
858 endpoint. To group such packets into packet streams, the inner
859 headers should also be examined to determine the packet stream. If
860 this is not done, full headers will be sent each time the headers of
861 the inner IP packet changes. So when a packet is tunneled, the
862 identifying fields of the inner subheaders should be considered in
863 addition to the identifying fields of the initial IP header.
864
865 An implementation can use other fields for identification than the
866 ones described here. If too many fields are used for identification,
867 performance might suffer because more CIDs will be used and the wrong
868 CIDs might be reused when new flows need CIDs. If too few fields are
869 used for identification, performance might suffer because there are
870 too frequent changes to the context.
871
872 We stress that these guidelines are educated guesses. When IPv6 is
873 widely deployed and IPv6 traffic can be analyzed, we might find that
874 other grouping algorithms perform better. We also stress that if the
875 grouping fails, the result will be bad performance but not incorrect
876 decompression. The decompressor can do its task regardless of how the
877 grouping algorithm works.
878
879 <span class="h2"><a class="selflink" id="section-5" href="#section-5">5</a>. Size Issues</span>
880
881 <span class="h3"><a class="selflink" id="section-5.1" href="#section-5.1">5.1</a>. Context Identifiers</span>
882
883 Context identifiers can be 8 or 16 bits long. Their size is not
884 relevant for finding the context. An 8-bit CID with value two and a
885 16-bit CID with value two are equivalent.
886
887
888
889
890
891
892 <span class="grey">Degermark, et. al. Standards Track [Page 16]</span></pre>
893 <hr class='noprint'/><!--NewPage--><pre class='newpage'><span id="page-17" ></span>
894 <span class="grey"><a href="./rfc2507">RFC 2507</a> IP Header Compression February 1999</span>
895
896
897 The CID spaces for TCP and non-TCP are separate, so a TCP CID and a
898 non-TCP CID never identify the same context. Even if they have the
899 same value. This doubles the available CID space while using the same
900 number of bits for CIDs. It is always possible to tell whether a
901 full or compressed header is for a TCP or non-TCP packet, so no
902 mixups can occur.
903
904 Non-TCP compressed headers encode the size of the CID using one bit
905 in the second octet of the compressed header. The 8-bit CID allows a
906 minimum compressed header size of 2 octets for non-TCP packets, the
907 CID uses the first octet and the size bit and the 6-bit Generation
908 value fit in the second octet.
909
910 For TCP the only available CID size is 8 bits as in [<a href="./rfc1144" title="&quot;Compressing TCP/IP Headers for Low- Speed Serial Links&quot;">RFC-1144</a>]. 8
911 bits is probably sufficient as TCP connections are always point-to-
912 point.
913
914 The 16 bit CID size may not be needed for point-to-point links; it is
915 intended for use on multi-access links where a larger CID space may
916 be needed for efficient selection of CIDs.
917
918 The major difficulty with multi-access links is that several
919 compressors share the CID space of a decompressor. CIDs can no
920 longer be selected independently by the compressors as collisions may
921 occur. This problem may be resolved by letting the decompressors
922 have a separate CID space for each compressor. Having separate CID
923 spaces requires that decompressors can identify which compressor sent
924 the compressed packet, perhaps by utilizing link-layer information as
925 to who sent the link-layer frame. If such information is not
926 available, all compressors on the multi-access link may be
927 enumerated, automatically or otherwise, and supply their number as
928 part of the CID. This latter method requires a large CID space.
929
930 <span class="h3"><a class="selflink" id="section-5.2" href="#section-5.2">5.2</a>. Size of the context</span>
931
932 The size of the context SHOULD be limited to simplify implementation
933 of compressor and decompressor, and put a limit on their memory
934 requirements. However, there is no upper limit on the size of an
935 IPv6 header as the chain of extension headers can be arbitrarily
936 long. This is a problem as the context is essentially a stored
937 header.
938
939 The configurable parameter MAX_HEADER (see <a href="#section-14">section 14</a>) represents the
940 maximum size of the context, expressed as the maximum sized header
941 that can be stored as context. When a header is larger than
942 MAX_HEADER, only part of it is stored as context. An implementation
943 MUST NOT compress more than the initial MAX_HEADER octets of a
944 header. An implementation MUST NOT partially compress a subheader.
945
946
947
948 <span class="grey">Degermark, et. al. Standards Track [Page 17]</span></pre>
949 <hr class='noprint'/><!--NewPage--><pre class='newpage'><span id="page-18" ></span>
950 <span class="grey"><a href="./rfc2507">RFC 2507</a> IP Header Compression February 1999</span>
951
952
953 Thus, the part of the header that is stored as context and is
954 compressed is the longest initial sequence of entire subheaders that
955 is not larger than MAX_HEADER octets.
956
957 <span class="h3"><a class="selflink" id="section-5.3" href="#section-5.3">5.3</a>. Size of full headers</span>
958
959 It is desirable to avoid increasing the size of packets with full
960 headers beyond their original size, as their size may be optimized
961 for the MTU of the link. Since we assume that the link layer
962 implementation provides the length of packets, we can use the length
963 fields in full headers to pass the values of the CID and the
964 generation to the decompressor.
965
966 This requires that the link-layer must not add padding to the
967 payload, at least not padding that can be delivered to the
968 destination link user. It is also required that no extra padding is
969 added after UDP data or in tunneled packets. This allows values of
970 length fields to be calculated from the length of headers and the
971 length of the link-layer frame.
972
973 The generation requires one octet and the CID may require up to 2
974 octets. There are length fields of 2 octets in the IPv6 Base Header,
975 the IPv4 header, and the UDP header.
976
977 A full TCP header will thus have at least 2 octets available in the
978 IP header to pass the 8 bit CID, which is sufficient. There will be
979 more than two octets available if there is more than one IP header.
980
981 [<a id="ref-RFC-1144">RFC-1144</a>] uses the 8 bit Protocol field of the IPv4 header to pass
982 the CID. We cannot use the corresponding method as the sequence of
983 IPv6 extension headers is not fixed and CID values are not disjoint
984 from the legal values of Next Header fields.
985
986 An IPv6/UDP or IPv4/UDP packet will have 4 octets available to pass
987 the generation and the CID, so all CID sizes may be used. Fragmented
988 or encrypted packet streams may have only 2 octets available to pass
989 the generation and CID. Thus, 8-bit CIDs may be the only CID sizes
990 that can be used for such packet streams. When IPv6/IPv4 or
991 IPv4/IPv6 tunneling is used, there will be at least 4 octets
992 available, and both CID sizes may be used.
993
994 The generation value is passed in the higher order octet of the first
995 length field in the full header. When only one length field is
996 available, the 8-bit CID is passed in the low order octet. When two
997 length fields are available, the lowest two octets of the CID are
998 passed in the second length field and the low order octet of the
999 first length field carries the highest octet of the CID.
1000
1001
1002
1003
1004 <span class="grey">Degermark, et. al. Standards Track [Page 18]</span></pre>
1005 <hr class='noprint'/><!--NewPage--><pre class='newpage'><span id="page-19" ></span>
1006 <span class="grey"><a href="./rfc2507">RFC 2507</a> IP Header Compression February 1999</span>
1007
1008
1009 <span class="h4"><a class="selflink" id="section-5.3.1" href="#section-5.3.1">5.3.1</a>. Use of length fields in full TCP headers</span>
1010
1011 Use of first length field:
1012
1013 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
1014 Length field | LSB of pkt nr | CID |
1015 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
1016
1017 Use of second length field if available:
1018
1019 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
1020 Second length field | MSB of pkt nr | 0 |
1021 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
1022
1023 Pkt nr is short for packet sequence number, described in <a href="#section-11.2">section</a>
1024 <a href="#section-11.2">11.2</a>.
1025
1026 <span class="h4"><a class="selflink" id="section-5.3.2" href="#section-5.3.2">5.3.2</a>. Use of length fields in full non-TCP headers</span>
1027
1028 Full non-TCP headers with 8-bit CID:
1029
1030 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
1031 First length field |0|D| Generation| CID |
1032 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
1033
1034 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
1035 Second length field (if avail.) | 0 | Data (if D=1) |
1036 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
1037
1038 Full non-TCP headers with 16-bit CID:
1039
1040 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
1041 First length field |1|D| Generation| Data (if D=1) |
1042 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
1043
1044 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
1045 Second length field | CID |
1046 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
1047
1048 The first bit in the first length field indicates the length of the
1049 CID. The Data field is zero if D is zero. The use of the D bit and
1050 Data field is explained in <a href="#section-12">section 12</a>.
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060 <span class="grey">Degermark, et. al. Standards Track [Page 19]</span></pre>
1061 <hr class='noprint'/><!--NewPage--><pre class='newpage'><span id="page-20" ></span>
1062 <span class="grey"><a href="./rfc2507">RFC 2507</a> IP Header Compression February 1999</span>
1063
1064
1065 <span class="h2"><a class="selflink" id="section-6" href="#section-6">6</a>. Compressed Header Formats</span>
1066
1067 This section uses some terminology (DELTA, RANDOM) defined in <a href="#section-7">section</a>
1068 <a href="#section-7">7</a>.
1069
1070 a) COMPRESSED_TCP format (similar to [<a href="./rfc1144">RFC 1144</a>]):
1071
1072 +-+-+-+-+-+-+-+-+
1073 | CID |
1074 +-+-+-+-+-+-+-+-+
1075 |R O I P S A W U|
1076 +-+-+-+-+-+-+-+-+
1077 | |
1078 + TCP Checksum +
1079 | |
1080 +-+-+-+-+-+-+-+-+
1081 | RANDOM fields, if any (see <a href="#section-7">section 7</a>) (implied)
1082 - - - - - - - -
1083 | R-octet | (if R=1)
1084 - - - - - - - -
1085 | Urgent Pointer Value (if U=1)
1086 - - - - - - - -
1087 | Window Delta (if W=1)
1088 - - - - - - - -
1089 | Acknowledgment Number Delta (if A=1)
1090 - - - - - - - -
1091 | Sequence Number Delta (if S=1)
1092 - - - - - - - -
1093 | IPv4 Identification Delta (if I=1)
1094 - - - - - - - -
1095 | Options (if O=1)
1096 - - - - - - - -
1097
1098
1099 The latter flags in the second octet (IPSAWU) have the same meaning
1100 as in [<a href="./rfc1144" title="&quot;Compressing TCP/IP Headers for Low- Speed Serial Links&quot;">RFC-1144</a>], regardless of whether the TCP segments are carried
1101 by IPv6 or IPv4. The C bit has been eliminated because the CID is
1102 always present. The context associated with the CID keeps track of
1103 the IP version and what RANDOM fields are present. The order between
1104 delta fields specified here is exactly as in [<a href="./rfc1144" title="&quot;Compressing TCP/IP Headers for Low- Speed Serial Links&quot;">RFC-1144</a>]. An
1105 implementation will typically scan the context from the beginning and
1106 insert the RANDOM fields in order. The RANDOM fields are thus placed
1107 before the DELTA fields of the TCP header in the same order as they
1108 occur in the original uncompressed header.
1109
1110
1111
1112
1113
1114
1115
1116 <span class="grey">Degermark, et. al. Standards Track [Page 20]</span></pre>
1117 <hr class='noprint'/><!--NewPage--><pre class='newpage'><span id="page-21" ></span>
1118 <span class="grey"><a href="./rfc2507">RFC 2507</a> IP Header Compression February 1999</span>
1119
1120
1121 The I flag is zero unless an IPv4 header immediately precedes the TCP
1122 header. The combined IPv4/TCP header is then compressed as a unit as
1123 described in [<a href="./rfc1144" title="&quot;Compressing TCP/IP Headers for Low- Speed Serial Links&quot;">RFC-1144</a>]. Identification fields in IPv4 headers that
1124 are not immediately followed by a TCP header are RANDOM.
1125
1126 If the O flag is set, the Options of the TCP header were not the same
1127 as in the previous header. The entire Option field are placed last in
1128 the compressed TCP header.
1129
1130 If the R flag is set, there were differences between the context and
1131 the Reserved field (6 bits) in the TCP header or bit 6 or 7 of the
1132 TOS octet (Traffic Class octet) in a IPv4 header (IPv6 header) that
1133 immediately precedes the TCP header. An octet with the actual values
1134 of the Reserved field and bit 6 and 7 of the TOS or Traffic Class
1135 field is then placed immediately after the RANDOM fields. Bits 0-5
1136 of the passed octet is the actual value of the Reserved field, and
1137 bits 6 and 7 are the actual values of bits 6 and 7 in the TOS or
1138 Traffic Class field. If there is no preceding IP header, bits 6 and 7
1139 are 0. The octet passed with the R flag MUST NOT update the context.
1140
1141 NOTE: The R-octet does not update the context because if it did, the
1142 nTCP checksum would not guard the receiving TCP from erroneously
1143 decompressed headers. Bits 6 and 7 of the TOS octet or Traffic Class
1144 octet is expected to change frequently due to Explicit Congestion
1145 Notification.
1146
1147 See <a href="#section-7.12">section 7.12</a> and [<a href="./rfc1144" title="&quot;Compressing TCP/IP Headers for Low- Speed Serial Links&quot;">RFC-1144</a>] for further information on how to
1148 compress TCP headers.
1149
1150 b) COMPRESSED_TCP_NODELTA header format
1151
1152 +-+-+-+-+-+-+-+-+
1153 | CID |
1154 +-+-+-+-+-+-+-+-+
1155 | RANDOM fields, if any (see <a href="#section-7">section 7</a>) (implied)
1156 +-+-+-+-+-+-+-+-+
1157 | Whole TCP header except for Port Numbers
1158 +-+-+-+-+-+-+-+-+
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172 <span class="grey">Degermark, et. al. Standards Track [Page 21]</span></pre>
1173 <hr class='noprint'/><!--NewPage--><pre class='newpage'><span id="page-22" ></span>
1174 <span class="grey"><a href="./rfc2507">RFC 2507</a> IP Header Compression February 1999</span>
1175
1176
1177 c) Compressed non-TCP header, 8 bit CID:
1178 0 7
1179 +-+-+-+-+-+-+-+-+
1180 | CID |
1181 +-+-+-+-+-+-+-+-+
1182 |0|D| Generation|
1183 +-+-+-+-+-+-+-+-+
1184 | data | (if D=1)
1185 - - - - - - - -
1186 | RANDOM fields, if any (<a href="#section-7">section 7</a>) (implied)
1187 - - - - - - - -
1188
1189 d) Compressed non-TCP header, 16 bit CID:
1190 0 7
1191 +-+-+-+-+-+-+-+-+
1192 | msb of CID |
1193 +-+-+-+-+-+-+-+-+
1194 |1|D| Generation|
1195 +-+-+-+-+-+-+-+-+
1196 | lsb of CID |
1197 +-+-+-+-+-+-+-+-+
1198 | data | (if D=1)
1199 - - - - - - - -
1200 | RANDOM fields, if any (<a href="#section-7">section 7</a>) (implied)
1201 - - - - - - - -
1202
1203 The generation, CID and optional one octet data are followed by
1204 relevant RANDOM fields (see <a href="#section-7">section 7</a>) as implied by the compression
1205 state, placed in the same order as they occur in the original
1206 uncompressed header, followed by the payload.
1207
1208 <span class="h2"><a class="selflink" id="section-7" href="#section-7">7</a>. Compression of subheaders</span>
1209
1210 This section gives rules for how the compressible chain of subheaders
1211 is compressed. These rules MUST be followed. Subheaders that may be
1212 compressed include IPv6 base and extension headers, TCP headers, UDP
1213 headers, and IPv4 headers. The compressible chain of subheaders
1214 extends from the beginning of the header
1215
1216 a) up to but not including the first header that is not an IPv4
1217 header, an IPv6 base or extension header, a TCP header, or a UDP
1218 header, or
1219
1220 b) up to and including the first TCP header, UDP header, Fragment
1221 Header, Encapsulating Security Payload Header, or IPv4 header for
1222 a fragment,
1223
1224
1225
1226
1227
1228 <span class="grey">Degermark, et. al. Standards Track [Page 22]</span></pre>
1229 <hr class='noprint'/><!--NewPage--><pre class='newpage'><span id="page-23" ></span>
1230 <span class="grey"><a href="./rfc2507">RFC 2507</a> IP Header Compression February 1999</span>
1231
1232
1233 whichever gives the shorter chain. For example, rules a) and b) both
1234 fit a chain of subheaders that contain a Fragment Header and ends at
1235 a tunneled IPX packet. Since rule b) gives a shorter chain, the
1236 compressible chain of subheaders stops at the Fragment Header.
1237
1238 The following subsections are a systematic classification of how all
1239 fields in subheaders are expected to change.
1240
1241 NOCHANGE The field is not expected to change. Any change means
1242 that a full header MUST be sent to update the context.
1243
1244 DELTA The field may change often but usually the difference
1245 from the field in the previous header is small, so that
1246 it is cheaper to send the change from the previous value
1247 rather than the current value. This type of compression
1248 is only used for TCP packet streams.
1249
1250 RANDOM The field must be included "as-is" in compressed headers,
1251 usually because it changes unpredictably.
1252
1253 INFERRED The field contains a value that can be inferred from
1254 other values, for example the size of the frame carrying
1255 the packet, and thus must not be included in the
1256 compressed header.
1257
1258 The classification implies how a compressed header is constructed. No
1259 field that is NOCHANGE or INFERRED is present in a compressed header.
1260 A compressor obtains the values of NOCHANGE fields from the context
1261 identified by the compression identifier, and obtains the values of
1262 INFERRED fields from the link-layer implementation, e.g., from the
1263 size of the link-layer frame, or from other fields, e.g., by
1264 recalculating the IPv4 header checksum. DELTA fields are encoded as
1265 the difference to the value in the previous packet in the same packet
1266 stream. The decompressor must update the context by adding the value
1267 in the compressed header to the value in its context. The result is
1268 the proper value of the field. RANDOM fields must be sent "as-is" in
1269 the compressed header. RANDOM fields must occur in the same order in
1270 the compressed header as they occur in the full header.
1271
1272 Fields that may optionally be used to identify what packet stream a
1273 packet belongs to according to <a href="#section-4.1">section 4.1</a> are marked with the word
1274 DEF. To a compressor using the optional guidelines from <a href="#section-4.1">section 4.1</a>,
1275 any difference in corresponding DEF fields between two packets
1276 implies that they belong to different packet streams. Moreover, if a
1277 DEF field is present in one packet but not in another, the packets
1278 belong to different packet streams.
1279
1280
1281
1282
1283
1284 <span class="grey">Degermark, et. al. Standards Track [Page 23]</span></pre>
1285 <hr class='noprint'/><!--NewPage--><pre class='newpage'><span id="page-24" ></span>
1286 <span class="grey"><a href="./rfc2507">RFC 2507</a> IP Header Compression February 1999</span>
1287
1288
1289 <span class="h3"><a class="selflink" id="section-7.1" href="#section-7.1">7.1</a>. IPv6 Header [IPv6, <a href="#section-3">section 3</a>]</span>
1290
1291 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
1292 |Version| Traffic Class | Flow Label |
1293 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
1294 | Payload Length | Next Header | Hop Limit |
1295 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
1296 | |
1297 + +
1298 | |
1299 + Source Address +
1300 | |
1301 + +
1302 | |
1303 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
1304 | |
1305 + +
1306 | |
1307 + Destination Address +
1308 | |
1309 + +
1310 | |
1311 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
1312
1313 Version NOCHANGE (DEF)
1314 Traffic Class NOCHANGE (might be DEF, see sect 4.1)
1315 (see also sect 6 a)
1316 Flow Label NOCHANGE (DEF)
1317 Payload Length INFERRED
1318 Next Header NOCHANGE
1319 Hop Limit NOCHANGE (might be DEF, see sect 4.1)
1320 Source Address NOCHANGE (DEF)
1321 Destination Address NOCHANGE (DEF)
1322
1323 The Payload Length field of encapsulated headers must correspond to
1324 the length value of the encapsulating header. If not, the header
1325 chain MUST NOT be compressed.
1326
1327 NOTE: If this the IP header closest to a TCP header, bit 7 of the
1328 Traffic Class field can be passed using the R-flag of the compressed
1329 TCP header. See <a href="#section-6">section 6</a> a).
1330
1331 This classification implies that the entire IPv6 base header will be
1332 compressed away.
1333
1334
1335
1336
1337
1338
1339
1340 <span class="grey">Degermark, et. al. Standards Track [Page 24]</span></pre>
1341 <hr class='noprint'/><!--NewPage--><pre class='newpage'><span id="page-25" ></span>
1342 <span class="grey"><a href="./rfc2507">RFC 2507</a> IP Header Compression February 1999</span>
1343
1344
1345 <span class="h3"><a class="selflink" id="section-7.2" href="#section-7.2">7.2</a>. IPv6 Extension Headers [IPv6, <a href="#section-4">section 4</a>]</span>
1346
1347 What extension headers are present and the relative order of them is
1348 not expected to change in a packet stream. Whenever there is a
1349 change, a full packet header must be sent. All Next Header fields in
1350 IPv6 base header and IPv6 extension headers are NOCHANGE.
1351
1352 <span class="h3"><a class="selflink" id="section-7.3" href="#section-7.3">7.3</a>. Options [IPv6, <a href="#section-4.2">section 4.2</a>]</span>
1353
1354 The contents of Hop-by-hop Options and Destination Options extension
1355 headers are encoded with TLV "options" (see [<a href="#ref-IPv6" title="&quot;Internet Protocol, Version 6 (IPv6) Specification&quot;">IPv6</a>]):
1356
1357 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+- - - - - - - - -
1358 | Option Type | Opt Data Len | Option Data
1359 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+- - - - - - - - -
1360
1361 Option Type and Opt Data Len fields are assumed to be fixed for a
1362 given packet stream, so they are classified as NOCHANGE. The Option
1363 data is RANDOM unless specified otherwise below.
1364
1365 Padding
1366
1367 Pad1 option
1368
1369 +-+-+-+-+-+-+-+-+
1370 | 0 |
1371 +-+-+-+-+-+-+-+-+
1372
1373 Entire option is NOCHANGE.
1374
1375 PadN option
1376
1377 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+- - - - - - - - -
1378 | 1 | Opt Data Len | Option Data
1379 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+- - - - - - - - -
1380
1381 All fields are NOCHANGE.
1382
1383
1384
1385
1386
1387
1388
1389
1390
1391
1392
1393
1394
1395
1396 <span class="grey">Degermark, et. al. Standards Track [Page 25]</span></pre>
1397 <hr class='noprint'/><!--NewPage--><pre class='newpage'><span id="page-26" ></span>
1398 <span class="grey"><a href="./rfc2507">RFC 2507</a> IP Header Compression February 1999</span>
1399
1400
1401 <span class="h3"><a class="selflink" id="section-7.4" href="#section-7.4">7.4</a>. Hop-by-Hop Options Header [IPv6, <a href="#section-4.3">section 4.3</a>]</span>
1402
1403 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
1404 | Next Header | Hdr Ext Len | |
1405 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ +
1406 | |
1407 . .
1408 . Options .
1409 . .
1410 | |
1411 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
1412
1413 Next Header NOCHANGE
1414 Hdr Ext Len NOCHANGE
1415
1416 Options TLV coded values and padding.
1417 Classified according to 7.3 above, unless
1418 being a Jumbo Payload option (see below).
1419
1420 Jumbo Payload option
1421 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
1422 | 194 |Opt Data Len=4 |
1423 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
1424 | Jumbo Payload Length |
1425 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
1426
1427 First two fields are NOCHANGE and Jumbo Payload Length INFERRED.
1428 (frame length must be supplied by link layer implementation).
1429
1430
1431 NOTE: It is silly to compress the headers of a packet carrying a
1432 Jumbo Payload Option since the relative header overhead is
1433 negligible. Moreover, it is usually a bad idea to send such
1434 large packets over low- and medium-speed links.
1435
1436 <span class="h3"><a class="selflink" id="section-7.5" href="#section-7.5">7.5</a>. Routing Header [IPv6, <a href="#section-4.4">section 4.4</a>]</span>
1437
1438 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
1439 | Next Header | Hdr Ext Len | Routing Type | Segments Left |
1440 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
1441 | |
1442 . .
1443 . type-specific data .
1444 . .
1445 | |
1446 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
1447
1448 All fields of the Routing Header are NOCHANGE.
1449
1450
1451
1452 <span class="grey">Degermark, et. al. Standards Track [Page 26]</span></pre>
1453 <hr class='noprint'/><!--NewPage--><pre class='newpage'><span id="page-27" ></span>
1454 <span class="grey"><a href="./rfc2507">RFC 2507</a> IP Header Compression February 1999</span>
1455
1456
1457 If the Routing Type is not recognized, it is impossible to determine
1458 the final Destination Address unless the Segments Left field has the
1459 value zero, in which case the Destination Address is the final
1460 Destination Address in the basic IPv6 header.
1461
1462 In the Type 0 Routing Header, the last address is DEF if (Segments
1463 Left &gt; 0).
1464
1465 Routing Headers are compressed away completely. This is a big win as
1466 the maximum size of the Routing Header is 392 octets. Moreover, Type
1467 0 Routing Headers with one address, size 24 octets, are used by
1468 Mobile IP.
1469
1470 <span class="h3"><a class="selflink" id="section-7.6" href="#section-7.6">7.6</a>. Fragment Header [IPv6, <a href="#section-4.5">section 4.5</a>]</span>
1471
1472 The first fragment of a packet has Fragment Offset = 0 and the chain
1473 of subheaders extends beyond its Fragment Header. If a fragment is
1474 not the first (Fragment Offset not 0), there are no subsequent
1475 subheaders (unless the chain of subheaders in the first fragment
1476 didn't fit entirely in the first fragment).
1477
1478 Since packets may be reordered before reaching the compression point,
1479 and some fragments may follow other routes through the network, a
1480 compressor cannot rely on seeing the first fragment before other
1481 fragments. This implies that information in subheaders following the
1482 Fragment Header of the first fragment cannot be examined to determine
1483 the proper packet stream for other fragments.
1484
1485 It is possible to design compression schemes that can compress
1486 subheaders after the Fragment Header, at least in the first fragment,
1487 but to avoid complicating the rules for sending full headers and the
1488 rules for compression and decompression, the chain of subheaders that
1489 follow a Fragment Header MUST NOT be compressed.
1490
1491 The fields of the Fragment Header are classified as follows.
1492
1493 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
1494 | Next Header | Reserved | Fragment Offset |Res|M|
1495 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
1496 | Identification |
1497 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
1498
1499 Next Header NOCHANGE
1500 Reserved NOCHANGE
1501 Res RANDOM
1502 M flag RANDOM
1503 Fragment Offset RANDOM
1504 Identification RANDOM
1505
1506
1507
1508 <span class="grey">Degermark, et. al. Standards Track [Page 27]</span></pre>
1509 <hr class='noprint'/><!--NewPage--><pre class='newpage'><span id="page-28" ></span>
1510 <span class="grey"><a href="./rfc2507">RFC 2507</a> IP Header Compression February 1999</span>
1511
1512
1513 This classification implies that a Fragment Header is compressed down
1514 to 6 octets. The minimum IPv6 MTU is 1280 octets so most fragments
1515 will be at least 1280 octets. Since the 6 octet overhead of the
1516 compressed fragment header is amortized over a fairly large packet,
1517 the additional complexity of more sophisticated compression schemes
1518 is not justifiable.
1519
1520 NOTE: The Identification field is RANDOM instead of NOCHANGE
1521 to avoid one compression slow-start per original packet.
1522
1523 Grouping of fragments according to the optional guidelines in
1524 section4.1:
1525
1526 Fragments and unfragmented packets should not be grouped
1527 together.
1528
1529 Port numbers cannot be used to identify the packet stream because
1530 port numbers are not present in every fragment. To adhere to the
1531 uniqueness rules for the Identification value, a fragmented
1532 packet stream is identified by the combination of Source Address
1533 and (final) Destination Address.
1534
1535 NOTE: The Identification value is NOT used to identify the
1536 packet stream. This avoids using a new CID for each packet and
1537 saves the cost of the associated compression slow-start. We
1538 expect that the unfragmentable part of the headers will not
1539 change too frequently, if it does thrashing may occur.
1540
1541 <span class="h3"><a class="selflink" id="section-7.7" href="#section-7.7">7.7</a>. Destination Options Header [IPv6, <a href="#section-4.6">section 4.6</a>]</span>
1542
1543 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
1544 | Next Header | Hdr Ext Len | |
1545 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ +
1546 | |
1547 . .
1548 . Options .
1549 . .
1550 | |
1551 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
1552
1553 Next Header NOCHANGE
1554 Hdr Ext Len NOCHANGE
1555
1556 Options TLV coded values and padding.
1557 Compressed according to 7.3 above.
1558
1559 The only Destination Options defined in [<a href="#ref-IPv6" title="&quot;Internet Protocol, Version 6 (IPv6) Specification&quot;">IPv6</a>] are the padding
1560 options.
1561
1562
1563
1564 <span class="grey">Degermark, et. al. Standards Track [Page 28]</span></pre>
1565 <hr class='noprint'/><!--NewPage--><pre class='newpage'><span id="page-29" ></span>
1566 <span class="grey"><a href="./rfc2507">RFC 2507</a> IP Header Compression February 1999</span>
1567
1568
1569 <span class="h3"><a class="selflink" id="section-7.8" href="#section-7.8">7.8</a>. No Next Header [IPv6, <a href="#section-4.7">section 4.7</a>]</span>
1570
1571 Covered by rules for IPv6 Header Extensions (7.2).
1572
1573 <span class="h3"><a class="selflink" id="section-7.9" href="#section-7.9">7.9</a>. Authentication Header [RFC-2402, <a href="#section-3.2">section 3.2</a>]</span>
1574
1575 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
1576 +---------------+---------------+---------------+---------------+
1577 | Next Header | Length | RESERVED |
1578 +---------------+---------------+---------------+---------------+
1579 | Security Parameters Index (SPI) |
1580 +---------------+---------------+---------------+---------------+
1581 | |
1582 + Authentication Data (variable number of 32-bit words) |
1583 | |
1584 +---------------+---------------+---------------+---------------+
1585
1586 Next Header NOCHANGE
1587 Length NOCHANGE
1588 Reserved NOCHANGE
1589 SPI NOCHANGE (DEF)
1590 Authentication Data RANDOM
1591
1592 [<a id="ref-RFC-1828">RFC-1828</a>] specifies how to do authentication with keyed MD5, the
1593 authentication method all IPv6 implementations must support. For
1594 this method, the Authentication Data is 16 octets.
1595
1596 <span class="h3"><a class="selflink" id="section-7.10" href="#section-7.10">7.10</a>. Encapsulating Security Payload Header [RFC-2406, <a href="#section-3.1">section 3.1</a>]</span>
1597
1598 This header implies that the subsequent parts of the packet are
1599 encrypted. Thus, no further header compression is possible on
1600 subsequent headers as encryption is typically already performed when
1601 the compressor sees the packet.
1602
1603 However, when the ESP Header is used in tunnel mode an entire IP
1604 packet is encrypted, and the headers of that packet MAY be compressed
1605 before the packet is encrypted at the entry point of the tunnel.
1606 This means that it must be possible to feed an IP packet and its
1607 length to the decompressor, as if it came from the link-layer. The
1608 mechanisms for dealing with reordering described in <a href="#section-11">section 11</a> MUST
1609 also be used, as packets can be reordered in a tunnel.
1610
1611
1612
1613
1614
1615
1616
1617
1618
1619
1620 <span class="grey">Degermark, et. al. Standards Track [Page 29]</span></pre>
1621 <hr class='noprint'/><!--NewPage--><pre class='newpage'><span id="page-30" ></span>
1622 <span class="grey"><a href="./rfc2507">RFC 2507</a> IP Header Compression February 1999</span>
1623
1624
1625 +---------------+---------------+---------------+---------------+
1626 | Security Association Identifier (SPI), 32 bits |
1627 +===============+===============+===============+===============+
1628 | Opaque Transform Data, variable length |
1629 +---------------+---------------+---------------+---------------+
1630
1631 SPI NOCHANGE (DEF)
1632 Opaque Transform Data RANDOM
1633
1634 Everything after the SPI is encrypted and is not compressed.
1635
1636 <span class="h3"><a class="selflink" id="section-7.11" href="#section-7.11">7.11</a>. UDP Header</span>
1637
1638 The UDP header is described in [<a href="./rfc768" title="&quot;User Datagram Protocol&quot;">RFC-768</a>].
1639
1640
1641 The Next Header field (IPv6) or Protocol field (IPv4) in the
1642 preceding subheader is DEF.
1643
1644 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
1645 | Source Port | Destination Port |
1646 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
1647 | Length | Checksum |
1648 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
1649
1650 Source Port NOCHANGE (DEF)
1651 Destination Port NOCHANGE (DEF)
1652 Length INFERRED
1653 Checksum RANDOM, unless it is zero,
1654 in which case it is NOCHANGE.
1655
1656 The Length field of the UDP header MUST match the Length field(s) of
1657 preceding subheaders, i.e, there must not be any padding after the
1658 UDP payload that is covered by the IP Length.
1659
1660 The UDP header is typically compressed down to 2 octets, the UDP
1661 checksum. When the UDP checksum is zero (which it cannot be with
1662 IPv6), it is likely to be so for all packets in the flow and is
1663 defined to be NOCHANGE. This saves 2 octets in the compressed header.
1664
1665 <span class="h3"><a class="selflink" id="section-7.12" href="#section-7.12">7.12</a>. TCP Header</span>
1666
1667 The TCP header is described in [<a href="./rfc793" title="&quot;Transmission Control Protocol&quot;">RFC-793</a>].
1668
1669 The Next Header field (IPv6) or Protocol field (IPv4) in the
1670 preceding subheader is DEF.
1671
1672
1673
1674
1675
1676 <span class="grey">Degermark, et. al. Standards Track [Page 30]</span></pre>
1677 <hr class='noprint'/><!--NewPage--><pre class='newpage'><span id="page-31" ></span>
1678 <span class="grey"><a href="./rfc2507">RFC 2507</a> IP Header Compression February 1999</span>
1679
1680
1681 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
1682 | Source Port | Destination Port |
1683 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
1684 | Sequence Number |
1685 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
1686 | Acknowledgment Number |
1687 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
1688 | Offset| Reserved |U|A|P|R|S|F| Window |
1689 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
1690 | Checksum | Urgent Pointer |
1691 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
1692 | Options | Padding |
1693 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
1694
1695 U, A, P, R, S, and F stands for Urg, Ack, Psh, Rst, Syn, and Fin.
1696
1697 There are two ways to compress the TCP header.
1698
1699 <span class="h4"><a class="selflink" id="section-7.12.1" href="#section-7.12.1">7.12.1</a>. Compressed with differential encoding</span>
1700
1701 Source Port NOCHANGE (DEF)
1702 Destination Port NOCHANGE (DEF)
1703 Sequence Number DELTA
1704 Acknowledgment Number DELTA
1705 Offset NOCHANGE
1706 Reserved DELTA (if differs from context,
1707 set R-flag in flag octet
1708 and send absolute value
1709 as described in 6 a.)
1710 Urg,Psh RANDOM (placed in flag octet)
1711 Ack INFERRED to be 1
1712 Rst,Syn,Fin INFERRED to be 0
1713 Window DELTA (if change in Window,
1714 set W-flag in flag octet
1715 and send difference)
1716 Checksum RANDOM
1717 Urgent Pointer DELTA (if Urg is set, send
1718 absolute value)
1719 Options, Padding DELTA (if change in Options,
1720 set O-flag and send
1721 whole Options, Padding)
1722
1723 A packet with a TCP header compressed according to the above must be
1724 indicated to be of type COMPRESSED_TCP. The compressed header is
1725 described in <a href="#section-6">section 6</a>.
1726
1727
1728
1729
1730
1731
1732 <span class="grey">Degermark, et. al. Standards Track [Page 31]</span></pre>
1733 <hr class='noprint'/><!--NewPage--><pre class='newpage'><span id="page-32" ></span>
1734 <span class="grey"><a href="./rfc2507">RFC 2507</a> IP Header Compression February 1999</span>
1735
1736
1737 This method is essentially the differential encoding techniques of
1738 Jacobson, described in [<a href="./rfc1144" title="&quot;Compressing TCP/IP Headers for Low- Speed Serial Links&quot;">RFC-1144</a>], the differences being the placement
1739 of the compressed TCP header fields (see <a href="#section-6">section 6</a>), the use of the
1740 O-flag, the use of the R-flag, and elimination of the C-flag. The
1741 O-flag allows compression of the TCP header when the Timestamp option
1742 is used and the Options fields changes with each header.
1743
1744 DELTA values (except for Reserved field and Options, Padding) MUST be
1745 coded as in [<a href="./rfc1144" title="&quot;Compressing TCP/IP Headers for Low- Speed Serial Links&quot;">RFC-1144</a>]. A Reserved field value passed with the R-flag
1746 MUST NOT update the context at compressor or decompressor.
1747
1748 <span class="h4"><a class="selflink" id="section-7.12.2" href="#section-7.12.2">7.12.2</a>. Without differential encoding</span>
1749
1750 Source Port NOCHANGE (DEF)
1751 Destination Port NOCHANGE (DEF)
1752
1753 (all the rest) RANDOM
1754
1755 The Identification field in a preceding IPv4 header is RANDOM.
1756
1757 A packet with a TCP header compressed according to the above must be
1758 indicated to be of type COMPRESSED_TCP_NODELTA. It uses the same CID
1759 space as COMPRESSED_TCP packets, and the header MUST be saved as
1760 context. The compressed header is described in <a href="#section-6">section 6</a>.
1761
1762 This packet type can be sent as the response to a header request
1763 instead of sending a full header, can be used over links that reorder
1764 packets, and can be sent instead of a full header when there are
1765 changes that cannot be represented by a compressed header. A
1766 sophisticated compressor can switch to sending only
1767 COMPRESSED_TCP_NODELTA headers when the packet loss frequency is high.
1768
1769
1770
1771
1772
1773
1774
1775
1776
1777
1778
1779
1780
1781
1782
1783
1784
1785
1786
1787
1788 <span class="grey">Degermark, et. al. Standards Track [Page 32]</span></pre>
1789 <hr class='noprint'/><!--NewPage--><pre class='newpage'><span id="page-33" ></span>
1790 <span class="grey"><a href="./rfc2507">RFC 2507</a> IP Header Compression February 1999</span>
1791
1792
1793 <span class="h3"><a class="selflink" id="section-7.13" href="#section-7.13">7.13</a>. IPv4 header [RFC-791, <a href="#section-3.1">section 3.1</a>]</span>
1794
1795 0 1 2 3
1796 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
1797 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
1798 |Version| IHL |Type of Service| Total Length |
1799 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
1800 | Identification |Flags| Fragment Offset |
1801 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
1802 | Time to Live | Protocol | Header Checksum |
1803 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
1804 | Source Address |
1805 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
1806 | Destination Address |
1807 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
1808 | Options | Padding |
1809 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
1810
1811 There are two ways to compress the IPv4 header
1812
1813 a) If the IPv4 header is not for a fragment (MF flag is not set and
1814 Fragment Offset is zero) and there are no options (IHL is 5), it
1815 is classified as follows
1816
1817 Version NOCHANGE (DEF)
1818 IHL NOCHANGE (DEF, must be 5)
1819 Type of Service NOCHANGE (might be DEF, see sect 4.1)
1820 (see also 6 a)
1821 Total Length INFERRED (from link-layer implementation
1822 or encapsulating IP header)
1823
1824 Identification DELTA/ (If the Protocol field has the
1825 (value corresponding to TCP)
1826 RANDOM (otherwise)
1827
1828 Flags NOCHANGE (MF flag must not be set)
1829 Fragment Offset NOCHANGE (must be zero)
1830 Time to Live NOCHANGE (might be DEF, see sect 4.1)
1831 Protocol NOCHANGE
1832 Header Checksum INFERRED (calculated from other fields)
1833 Source Address NOCHANGE (DEF)
1834 Destination Address NOCHANGE (DEF)
1835 Options, Padding (not present)
1836
1837
1838
1839
1840
1841
1842
1843
1844 <span class="grey">Degermark, et. al. Standards Track [Page 33]</span></pre>
1845 <hr class='noprint'/><!--NewPage--><pre class='newpage'><span id="page-34" ></span>
1846 <span class="grey"><a href="./rfc2507">RFC 2507</a> IP Header Compression February 1999</span>
1847
1848
1849 Note: When a TCP header immediately follows, the IPv4 and TCP
1850 header MUST be compressed as a unit as described in <a href="#section-6">section 6</a>.
1851 Bits 6 and 7 of the Type of Service field (bits 14 and 15 of the
1852 first word) can then be passed using the R-flag (see <a href="#section-6">section 6</a>
1853 a).
1854
1855 b) If the IPv4 header is for a fragment (MF bit set or Fragment
1856 Offset nonzero), or there are options (IHL &gt; 5), all fields are
1857 RANDOM (i.e., if the header is compressed all fields are sent
1858 as-is and not compressed). This classification allows compression
1859 of the tunnel header, but not the fragment header, when fragments
1860 are tunneled. If the IPv4 header is for a fragment it ends the
1861 compressible chain of subheaders, i.e., it must be the last
1862 subheader to be compressed. If the IPv4 header has options but
1863 is not for a fragment it does not end the compressible chain of
1864 subheaders, so subsequent subheaders can be compressed.
1865
1866 A compressor that follows the optional guidelines of <a href="#section-4.1">section 4.1</a> will
1867 in case a) use the Version, Source Address and Destination Address to
1868 define the packet stream, together with the fact that there are no
1869 IPv4 options and that this is not a fragment.
1870
1871 Case b) can define two kinds of packet streams depending on whether
1872 the IPv4 header is for a fragment or not.
1873
1874 If the IPv4 header in case b) is for a fragment, a compressor
1875 following the optional guidelines will use that fact together with
1876 the Version, Source Address, and Destination Address to determine the
1877 packet stream.
1878
1879 If the IPv4 header in case b) is not for a fragment, it must have
1880 options. A compressor following the optional guidelines will use that
1881 fact, but not the size of the options, together with the Version,
1882 Source Address, and Destination Address to determine the packet
1883 stream.
1884
1885 <span class="h3"><a class="selflink" id="section-7.14" href="#section-7.14">7.14</a>. Minimal Encapsulation header [RFC-2004, <a href="#section-3.1">section 3.1</a>]</span>
1886
1887 0 1 2 3
1888 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
1889 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
1890 | Protocol |S| reserved | Header Checksum |
1891 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
1892 | Original Destination Address |
1893 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
1894 : (if present) Original Source Address :
1895 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
1896
1897
1898
1899
1900 <span class="grey">Degermark, et. al. Standards Track [Page 34]</span></pre>
1901 <hr class='noprint'/><!--NewPage--><pre class='newpage'><span id="page-35" ></span>
1902 <span class="grey"><a href="./rfc2507">RFC 2507</a> IP Header Compression February 1999</span>
1903
1904
1905 Protocol NOCHANGE
1906 Original Source Address Present (S) NOCHANGE
1907 reserved NOCHANGE
1908 Header Checksum INFERRED (calculated from
1909 other values)
1910 Original Destination Address NOCHANGE
1911 Original Source Address NOCHANGE (present only
1912 if S=1)
1913
1914 This header is likely to be used by Mobile IP.
1915
1916 <span class="h2"><a class="selflink" id="section-8" href="#section-8">8</a>. Changing context identifiers</span>
1917
1918 On a point-to-point link, the compressor has total knowledge of what
1919 CIDs are in use at the decompressor and may change what CID a packet
1920 stream uses or reuse CIDs at will.
1921
1922 Each non-TCP CID is associated with a context with a generation
1923 value. To avoid too rapid generation wrap-around and potential
1924 incorrect decompression, an implementation MUST avoid wrap-around of
1925 the generation value in less than MIN_WRAP seconds (see <a href="#section-14">section 14</a>).
1926
1927 To aid in avoiding wrap-around, the generation value associated with
1928 a CID MUST NOT be reset when changing to a new packet stream.
1929 Instead, a compressor MUST increment the generation value by one when
1930 using the CID for a new non-TCP packet stream.
1931
1932 <span class="h2"><a class="selflink" id="section-9" href="#section-9">9</a>. Rules for dropping or temporarily storing packets</span>
1933
1934 When a decompressor receives a packet with a compressed TCP header
1935 with CID C, it MUST be discarded when the context for C has not been
1936 initialized by a full header.
1937
1938 When a decompressor receives a packet with a compressed non-TCP
1939 header with CID C and generation G, the header must not be
1940 decompressed using the current context when
1941
1942 a) the decompressor has been disconnected from the compressor for
1943 more than MIN_WRAP seconds, because the context might be
1944 obsolete even if it has generation G.
1945
1946 b) the context for C has a generation other than G.
1947
1948 In case a) and b) the packet may either be
1949
1950 i) discarded immediately, or else
1951
1952
1953
1954
1955
1956 <span class="grey">Degermark, et. al. Standards Track [Page 35]</span></pre>
1957 <hr class='noprint'/><!--NewPage--><pre class='newpage'><span id="page-36" ></span>
1958 <span class="grey"><a href="./rfc2507">RFC 2507</a> IP Header Compression February 1999</span>
1959
1960
1961 ii) stored temporarily until the context is updated by a packet
1962 with a full non-TCP header with CID C and generation G, after
1963 which the header can be decompressed.
1964
1965 Packets stored in this manner MUST be discarded when
1966
1967 *) receiving full or compressed non-TCP headers with CID C
1968 and a generation other than G,
1969
1970 *) the decompressor has not received packets with CID C in
1971 the last MIN_WRAP seconds.
1972
1973 When full headers are lost, a decompressor can receive compressed
1974 non-TCP headers with a generation value other than the generation of
1975 its context. Rule ii) allows the decompressor to store such headers
1976 until they can be decompressed using the correct context.
1977
1978 <span class="h2"><a class="selflink" id="section-10" href="#section-10">10</a>. Low-loss header compression for TCP</span>
1979
1980 Since fewer bits are transmitted per packet with header compression,
1981 the packet loss rate is lower with header compression than without,
1982 for a fixed bit-error rate. This is beneficial for links with high
1983 bit-error rates such as wireless links.
1984
1985 However, since TCP headers are compressed using differential
1986 encoding, a single lost TCP segment can ruin an entire TCP sending
1987 window because the context is not incremented properly at the
1988 decompressor. Subsequent headers will therefore be decompressed to
1989 be different than before compression and discarded by the TCP
1990 receiver because the TCP checksum fails.
1991
1992 A TCP connection in the wide area where the last hop is over a
1993 medium-speed lossy link, for example a wireless LAN, will then have
1994 poor performance with traditional header compression because the
1995 delay-bandwidth product is relatively large and the bit-error rate
1996 relatively high. For a 2 Mbit/s wireless LAN and an end-to-end RTT of
1997 200 ms, the delay-bandwidth product is 50 kbyte. That is equivalent
1998 to about 97 512-octet segments with compressed headers. Each loss
1999 can thus be multiplied by a factor of 100.
2000
2001 This section describes two simple mechanisms for quick repair of the
2002 context. With these mechanisms header compression will improve TCP
2003 throughput over lossy links as well as links with low bit-error
2004 rates.
2005
2006
2007
2008
2009
2010
2011
2012 <span class="grey">Degermark, et. al. Standards Track [Page 36]</span></pre>
2013 <hr class='noprint'/><!--NewPage--><pre class='newpage'><span id="page-37" ></span>
2014 <span class="grey"><a href="./rfc2507">RFC 2507</a> IP Header Compression February 1999</span>
2015
2016
2017 <span class="h3"><a class="selflink" id="section-10.1" href="#section-10.1">10.1</a>. The "twice" algorithm</span>
2018
2019 The decompressor may compute the TCP checksum to determine if its
2020 context is not updated properly. If the checksum fails, the error is
2021 assumed to be caused by a lost segment that did not update the
2022 context properly. The delta of the current segment is then added to
2023 the context again on the assumption that the lost segment contained
2024 the same delta as the current. By decompressing and computing the TCP
2025 checksum again, the decompressor checks if the repair succeeded or if
2026 the delta should be applied once more.
2027
2028 Analysis of traces of various TCP bulk transfers show that applying
2029 the delta of the current segment one or two times will repair the
2030 context for between 83 and 99 per cent of all single-segment losses
2031 in the data stream. For the acknowledgment stream, the success rate
2032 is smaller due to the delayed ack mechanism of TCP. The "twice"
2033 mechanism repairs the context for 53 to 99 per cent of the losses in
2034 the acknowledgment stream. A sophisticated implementation of this
2035 idea would determine whether the TCP stream is an acknowledgment or
2036 data stream and determine the segment size by observing the stream of
2037 full and compressed headers. Trying deltas that are small multiples
2038 of the segment size will result in even higher rates of successful
2039 repairs for acknowledgment streams.
2040
2041 <span class="h3"><a class="selflink" id="section-10.2" href="#section-10.2">10.2</a>. Header Requests</span>
2042
2043 The relatively low success rate for the "twice" algorithm for TCP
2044 acknowledgment streams calls for an additional mechanism for
2045 repairing the context at the decompressor. When the decompressor
2046 fails to repair the context after a loss, the decompressor may
2047 optionally request a full header from the compressor. This is
2048 possible on links where the decompressor can identify the compressor
2049 and send packets to it.
2050
2051 On such links, a decompressor may send a CONTEXT_STATE packet back to
2052 the compressor to indicate that one or more contexts are invalid. A
2053 decompressor SHOULD NOT transmit a CONTEXT_STATE packet every time a
2054 compressed packet refers to an invalid context, but instead should
2055 limit the rate of transmission of CONTEXT_STATE packets to avoid
2056 flooding the reverse channel. A CONTEXT_STATE packet can indicate
2057 that several contexts are out of date, this technique SHOULD be used
2058 instead of sending several separate packets. The following diagram
2059 shows the format of a CONTEXT_STATE packet.
2060
2061
2062
2063
2064
2065
2066
2067
2068 <span class="grey">Degermark, et. al. Standards Track [Page 37]</span></pre>
2069 <hr class='noprint'/><!--NewPage--><pre class='newpage'><span id="page-38" ></span>
2070 <span class="grey"><a href="./rfc2507">RFC 2507</a> IP Header Compression February 1999</span>
2071
2072
2073 0 1 2 3 4 5 6 7
2074 +---+---+---+---+---+---+---+---+
2075 | TCP header request = 3 |
2076 +---+---+---+---+---+---+---+---+
2077 | CID count |
2078 +---+---+---+---+---+---+---+---+
2079 | CID |
2080 +---+---+---+---+---+---+---+---+
2081 | CID |
2082 +---+---+---+---+---+---+---+---+
2083 ...
2084 +---+---+---+---+---+---+---+---+
2085 | CID |
2086 +---+---+---+---+---+---+---+---+
2087
2088 The first octet is a type code to allow the CONTEXT_STATE packet type
2089 to be shared for other compression protocols that are (see [<a href="#ref-CRTP" title="&quot;Compressing IP/UDP/RTP Headers for Low-Speed Serial Links&quot;">CRTP</a>]) or
2090 may be defined in parallel with this one. When used for TCP header
2091 requests the type code has the value 3, and the remainder of the
2092 packet is a sequence of CIDs preceded by a one-octet count of the
2093 number of CIDs.
2094
2095 On receipt of a CONTEXT_STATE packet, the compressor MUST mark the
2096 CIDs invalid to ensure that the next packet emitted in those packet
2097 streams are FULL_HEADER or COMPRESSED_TCP_NODELTA packets.
2098
2099 Header requests are an optimization, so loss of a CONTEXT_STATE
2100 packet does not affect the correct operation of TCP header
2101 compression. When a CONTEXT_STATE packet is lost, eventually a new
2102 one will be transmitted or TCP will timeout and retransmit. The big
2103 advantage of using header requests is that TCP acknowledgment streams
2104 can be repaired after a roundtrip-time over the lossy link. This
2105 will typically avoid a TCP timeout and unnecessary retransmissions.
2106 The lower packet loss rate due to smaller packets will then result in
2107 higher throughput because the TCP window can grow larger between
2108 losses.
2109
2110 <span class="h2"><a class="selflink" id="section-11" href="#section-11">11</a>. Links that reorder packets</span>
2111
2112 Some links reorder packets, for example multi-hop radio links that
2113 use deflection routing to route around congested nodes. Packets
2114 routed different ways can then arrive at the destination in a
2115 different order than they were sent.
2116
2117
2118
2119
2120
2121
2122
2123
2124 <span class="grey">Degermark, et. al. Standards Track [Page 38]</span></pre>
2125 <hr class='noprint'/><!--NewPage--><pre class='newpage'><span id="page-39" ></span>
2126 <span class="grey"><a href="./rfc2507">RFC 2507</a> IP Header Compression February 1999</span>
2127
2128
2129 <span class="h3"><a class="selflink" id="section-11.1" href="#section-11.1">11.1</a>. Reordering in non-TCP packet streams</span>
2130
2131 Compressed non-TCP headers do not change the context, and neither do
2132 full headers that refresh it. There can be problems only when a full
2133 header that changes the context arrives out of order. There are two
2134 cases:
2135
2136 - A packet with a full header with generation G arrives *after*
2137 a packet with a compressed header with generation G. This case
2138 is covered by rule b) ii) in <a href="#section-9">section 9</a>.
2139
2140 - A packet with a full header with generation G arrives *before*
2141 a packet with a compressed header with generation G-1 (modulo
2142 64). The decompressor MAY then keep both versions of the
2143 context around for a while to be able to decompress subsequent
2144 compressed headers with generation G-1 (modulo 64). The old
2145 context MUST be discarded after MIN_WRAP seconds.
2146
2147 <span class="h3"><a class="selflink" id="section-11.2" href="#section-11.2">11.2</a>. Reordering in TCP packet streams</span>
2148
2149 A compressor may avoid sending COMPRESSED_TCP headers and only send
2150 COMPRESSED_TCP_NODELTA headers when there is reordering over the
2151 link. Compressed headers will typically be 17 octets with that
2152 method, significantly larger than the usual 4-7 octets.
2153
2154 To achieve better compression rates the following method, adding only
2155 two octets to the compressed header for a total of 6-9 octets, may be
2156 used. A packet sequence number, incremented by one for every packet
2157 in the TCP stream, is then associated with each compressed and full
2158 header. This allows the decompressor to place the packets in the
2159 correct sequence and apply their deltas to the context in the correct
2160 order. A simple sliding window scheme is used to place the packets
2161 in the correct order.
2162
2163 Two octets are needed for the packet sequence numbers. One octet
2164 gives only 256 sequence numbers. In a sliding window scheme the
2165 window should be no larger than half of the sequence number space, so
2166 packets can not arrive more than 127 positions out-of-sequence. This
2167 is equivalent to a delay of 260 ms on 2 Mbit/s links with 512 octet
2168 segments. Delays of that order are not uncommon over wide-area
2169 Internet connections. However, two octets giving 2^16 = 65536 values
2170 should be sufficient.
2171
2172 Full TCP/IP headers will only have space for one octet of sequence
2173 number when there is no tunneling. It is not feasible to increase the
2174 size of full headers since the packet size might be optimized for the
2175 MTU of the link. Therefore only the least significant octet of the
2176 packet sequence number can be placed in such full headers. We believe
2177
2178
2179
2180 <span class="grey">Degermark, et. al. Standards Track [Page 39]</span></pre>
2181 <hr class='noprint'/><!--NewPage--><pre class='newpage'><span id="page-40" ></span>
2182 <span class="grey"><a href="./rfc2507">RFC 2507</a> IP Header Compression February 1999</span>
2183
2184
2185 that such full headers can be positioned correctly frequently enough
2186 with only the least significant octet of the packet sequence number
2187 available.
2188
2189 The packet sequence number zero MUST be skipped over. Avoiding zero
2190 takes care of a problem that can occur when the TCP window scale
2191 option is used to enlarge the TCP window. When exactly 2^16 octets of
2192 TCP data is lost, a compressed header will be decompressed
2193 incorrectly without being detected by the TCP checksum. TCP segment
2194 sizes are often a power of two. So by using a packet sequence number
2195 space that is not a power of two either the TCP sequence number or
2196 the packet sequence number will differ when 2^16 octets are lost.
2197 Whenever a compressor sees the window scale option on a SYN segment,
2198 it MUST use packet sequence numbers when subsequently compressing
2199 that packet stream.
2200
2201 In compressed TCP headers the two octet packet sequence number MUST
2202 be placed immediately after the TCP Checksum. See <a href="#section-5.3">section 5.3</a> for
2203 placement of packet sequence numbers in full headers.
2204
2205 <span class="h2"><a class="selflink" id="section-12" href="#section-12">12</a>. Hooks for additional header compression</span>
2206
2207 The following hook is supplied to allow additional header compression
2208 schemes for headers on top of UDP. The initial chain of subheaders is
2209 then compressed as described here, and the other header compression
2210 scheme is applied to the header above the UDP header. An example of
2211 such additional header compression is Compressed RTP by Casner and
2212 Jacobson [<a href="#ref-CRTP" title="&quot;Compressing IP/UDP/RTP Headers for Low-Speed Serial Links&quot;">CRTP</a>]. To allow some error detection, such schemes
2213 typically need a sequence number that may need to be passed in full
2214 headers as well as compressed UDP headers.
2215
2216 The D-bit and Data octet (see <a href="#section-6">section 6</a>) provides the necessary
2217 mechanism. When a sequence number, say, needs to be passed in a
2218 FULL_HEADER or COMPRESSED_NON_TCP header, the D-bit is set and the
2219 sequence number is placed in the Data field. The decompressor must
2220 then extract and make the Data field available to the additional
2221 header compression scheme.
2222
2223 Use of additional header compression schemes like CRTP must be
2224 negotiated. The D-bit and Data octet mechanism must automatically be
2225 enabled whenever use of additional header compression schemes has
2226 been negotiated.
2227
2228
2229
2230
2231
2232
2233
2234
2235
2236 <span class="grey">Degermark, et. al. Standards Track [Page 40]</span></pre>
2237 <hr class='noprint'/><!--NewPage--><pre class='newpage'><span id="page-41" ></span>
2238 <span class="grey"><a href="./rfc2507">RFC 2507</a> IP Header Compression February 1999</span>
2239
2240
2241 <span class="h2"><a class="selflink" id="section-13" href="#section-13">13</a>. Demultiplexing</span>
2242
2243 For each link layer, there must be a document specifying how the
2244 various packet types used by IP header compression is indicated.
2245 Such a document exists for PPP [<a href="#ref-PPP-HC" title="&quot;IP Header Compression for PPP&quot;">PPP-HC</a>]. This section gives OPTIONAL
2246 guidelines on how packet types may be indicated by a specific link-
2247 layer.
2248
2249 It is necessary to distinguish packets with regular IPv4 headers,
2250 regular IPv6 headers, full IPv6 packets, full IPv4 packets,
2251 compressed TCP packets, compressed non-TCP packets, and CONTEXT_STATE
2252 packets.
2253
2254 The decision to use a distinct ethertype (or equivalent) for IPv6 has
2255 already been taken, which means that link-layers must be able to
2256 indicate that a packet is an IPv6 packet.
2257
2258 IP header compression requires that the link-layer implementation can
2259 indicate four kinds of packets: COMPRESSED_TCP for format a) in
2260 <a href="#section-6">section 6</a>, COMPRESSED_TCP_NODELTA for format b), COMPRESSED_NON_TCP
2261 for formats c) and d), and CONTEXT_STATE as described in <a href="#section-11.2">section</a>
2262 <a href="#section-11.2">11.2</a>. It is also desirable to indicate FULL_HEADERS at the link
2263 layer.
2264
2265 Full headers can be indicated by setting the first bit of the Version
2266 field in a packet indicated to be an IPv6 packet. In addition, one
2267 bit of the Version field is used to indicate if the first subheader
2268 is an IPv6 or an IPv4 header, and one bit is used to indicate if this
2269 full header carries a TCP CID or a non-TCP CID. The first four bits
2270 are encoded as follows:
2271
2272 Version Meaning
2273 ------- -------
2274
2275 0110 regular IPv6 header
2276
2277 1T*0 T=1 indicates a TCP header, T=0 indicates a non-TCP header
2278 1*V0 V=1 indicates a IPv6 header, V=0 indicates a IPv4 header
2279
2280 If a link-layer cannot indicate the packet types for the compressed
2281 headers or CONTEXT_STATE, packet types that cannot be indicated could
2282 start with an octet indicating the packet type, followed by the
2283 header.
2284
2285
2286
2287
2288
2289
2290
2291
2292 <span class="grey">Degermark, et. al. Standards Track [Page 41]</span></pre>
2293 <hr class='noprint'/><!--NewPage--><pre class='newpage'><span id="page-42" ></span>
2294 <span class="grey"><a href="./rfc2507">RFC 2507</a> IP Header Compression February 1999</span>
2295
2296
2297 First octet Type of compressed header
2298 ----------- -------------------------
2299
2300 0 COMPRESSED_TCP
2301 1 COMPRESSED_TCP_NODELTA
2302 2 COMPRESSED_NON_TCP
2303 3 CONTEXT_STATE
2304
2305 The currently assigned CONTEXT_STATE type values are
2306
2307 Value Type Reference
2308 ----- ----- ----------
2309 0 Reserved -
2310 1 IP/UDP/RTP w. 8-bit CID [<a href="#ref-CRTP" title="&quot;Compressing IP/UDP/RTP Headers for Low-Speed Serial Links&quot;">CRTP</a>]
2311 2 IP/UDP/RTP w. 16-bit CID [<a href="#ref-CRTP" title="&quot;Compressing IP/UDP/RTP Headers for Low-Speed Serial Links&quot;">CRTP</a>]
2312 3 TCP header request <a href="#section-10.2">Section 10.2</a>
2313
2314 <span class="h2"><a class="selflink" id="section-14" href="#section-14">14</a>. Configuration Parameters</span>
2315
2316 Header compression parameters are negotiated in a way specific to the
2317 link-layer implementation. Such procedures for link-layer xxx needs
2318 to be specified in a document "IP header compression over xxx". Such
2319 a document exists for PPP [<a href="#ref-PPP-HC" title="&quot;IP Header Compression for PPP&quot;">PPP-HC</a>].
2320
2321 The following parameter is fixed for all implementations of this
2322 header compression scheme.
2323
2324 MIN_WRAP - minimum time of generation value wrap around
2325
2326 3 seconds.
2327
2328 The following parameters can be negotiated between the compressor and
2329 decompressor. If not negotiated their values must be as specified by
2330 DEFAULT.
2331
2332 F_MAX_PERIOD - Largest number of compressed non-TCP headers that
2333 may be sent without sending a full header.
2334
2335 DEFAULT is 256
2336
2337 F_MAX_PERIOD must be at least 1 and at most 65535.
2338
2339
2340 F_MAX_TIME - Compressed headers may not be sent more than
2341 F_MAX_TIME seconds after sending last full header.
2342
2343 DEFAULT is 5
2344
2345
2346
2347
2348 <span class="grey">Degermark, et. al. Standards Track [Page 42]</span></pre>
2349 <hr class='noprint'/><!--NewPage--><pre class='newpage'><span id="page-43" ></span>
2350 <span class="grey"><a href="./rfc2507">RFC 2507</a> IP Header Compression February 1999</span>
2351
2352
2353 F_MAX_TIME must be at least 1 and at most 255.
2354
2355 NOTE: F_MAX_PERIOD and F_MAX_TIME should be lower when it is
2356 likely that a decompressor loses its state.
2357
2358
2359 MAX_HEADER - The largest header size in octets that may
2360 be compressed.
2361
2362 DEFAULT is 168 octets, which covers
2363
2364 - Two IPv6 base headers
2365 - A Keyed MD5 Authentication Header
2366 - A maximum-sized TCP header
2367
2368 MAX_HEADER must be at least 60 octets and
2369 at most 65535 octets.
2370
2371
2372 TCP_SPACE - Maximum CID value for TCP.
2373
2374 DEFAULT is 15 (which gives 16 CID values)
2375
2376 TCP_SPACE must be at least 3 and at most 255.
2377
2378
2379 NON_TCP_SPACE - Maximum CID value for non-TCP.
2380
2381 DEFAULT is 15 (which gives 16 CID values)
2382
2383 NON_TCP_SPACE must be at least 3 and at most 65535.
2384
2385
2386 EXPECT_REORDERING - The mechanisms in <a href="#section-11">section 11</a> are used.
2387
2388 DEFAULT no.
2389
2390 <span class="h2"><a class="selflink" id="section-15" href="#section-15">15</a>. Implementation Status</span>
2391
2392 A prototype using UDP as the link layer has been operational since
2393 March 1996. A NetBSD implementation for PPP has been operational
2394 since October 1996.
2395
2396
2397
2398
2399
2400
2401
2402
2403
2404 <span class="grey">Degermark, et. al. Standards Track [Page 43]</span></pre>
2405 <hr class='noprint'/><!--NewPage--><pre class='newpage'><span id="page-44" ></span>
2406 <span class="grey"><a href="./rfc2507">RFC 2507</a> IP Header Compression February 1999</span>
2407
2408
2409 <span class="h2"><a class="selflink" id="section-16" href="#section-16">16</a>. Acknowledgments</span>
2410
2411 This protocol uses many ideas originated by Van Jacobson in the
2412 design of header compression for TCP/IP over slow-speed links [RFC-
2413 1144]. It has benefited from discussions with Stephen Casner and
2414 Carsten Bormann.
2415
2416 We thank Craig Partridge for pointing out a problem that can occur
2417 when the TCP window scale option is used. A solution to this problem
2418 relying on the packet sequence numbers used for reordering is
2419 described in <a href="#section-11.2">section 11.2</a>.
2420
2421 <span class="h2"><a class="selflink" id="section-17" href="#section-17">17</a>. Security Considerations</span>
2422
2423 The compression protocols in this document run on top of a link-layer
2424 protocol. The compression protocols themselves introduce no new
2425 additional vulnerabilities beyond those associated with the specific
2426 link-layer technology being used.
2427
2428 Denial-of-service attacks are possible if an intruder can introduce
2429 (for example) bogus Full Header packets onto the link. However, an
2430 intruder having the ability to inject arbitrary packets at the link-
2431 layer in this manner raises additional security issues that dwarf
2432 those related to the use of header compression.
2433
2434 We advise implementors against identifying packet streams with the
2435 aid of information that is encrypted, even if such information
2436 happens to be available to the compressor. Doing so may expose
2437 traffic patterns.
2438
2439
2440
2441
2442
2443
2444
2445
2446
2447
2448
2449
2450
2451
2452
2453
2454
2455
2456
2457
2458
2459
2460 <span class="grey">Degermark, et. al. Standards Track [Page 44]</span></pre>
2461 <hr class='noprint'/><!--NewPage--><pre class='newpage'><span id="page-45" ></span>
2462 <span class="grey"><a href="./rfc2507">RFC 2507</a> IP Header Compression February 1999</span>
2463
2464
2465 <span class="h2"><a class="selflink" id="section-18" href="#section-18">18</a>. Authors' Addresses</span>
2466
2467 Mikael Degermark
2468 Department of Computer Science and Electrical Engineering
2469 Lulea University of Technology
2470 SE-971 87 Lulea, Sweden
2471
2472 Phone: +46 920 91188
2473 Fax: +46 920 72831
2474 Mobile: +46 70 833 8933
2475 EMail: [email protected]
2476
2477
2478 Bjorn Nordgren
2479 CDT/Telia Research AB
2480 Aurorum 6
2481 S-977 75 Lulea, Sweden
2482
2483 Phone: +46 920 75400
2484 Fax: +46 920 75490
2485 EMail: [email protected], [email protected]
2486
2487
2488 Stephen Pink
2489 Department of Computer Science and Electrical Engineering
2490 Lulea University of Technology
2491 SE-971 87 Lulea, Sweden
2492
2493 Phone: +46 920 752 29
2494 Fax: +46 920 728 31
2495 Mobile: +46 70 532 0007
2496 EMail: [email protected]
2497
2498
2499
2500
2501
2502
2503
2504
2505
2506
2507
2508
2509
2510
2511
2512
2513
2514
2515
2516 <span class="grey">Degermark, et. al. Standards Track [Page 45]</span></pre>
2517 <hr class='noprint'/><!--NewPage--><pre class='newpage'><span id="page-46" ></span>
2518 <span class="grey"><a href="./rfc2507">RFC 2507</a> IP Header Compression February 1999</span>
2519
2520
2521 <span class="h2"><a class="selflink" id="section-19" href="#section-19">19</a>. References</span>
2522
2523 [<a id="ref-RFC-768">RFC-768</a>] Postel, J., "User Datagram Protocol", STD 6, <a href="./rfc768">RFC 768</a>,
2524 August 1980.
2525
2526 [<a id="ref-RFC-791">RFC-791</a>] Postel, J., "Internet Protocol", STD 5, <a href="./rfc791">RFC 791</a>,
2527 September 1981.
2528
2529 [<a id="ref-RFC-793">RFC-793</a>] Postel, J., "Transmission Control Protocol", STD 7,
2530 <a href="./rfc793">RFC 793</a>, September 1981.
2531
2532 [<a id="ref-RFC-1144">RFC-1144</a>] Jacobson, V., "Compressing TCP/IP Headers for Low-
2533 Speed Serial Links", <a href="./rfc1144">RFC 1144</a>, February 1990.
2534
2535 [<a id="ref-RFC-1553">RFC-1553</a>] Mathur, A. and M. Lewis, "Compressing IPX Headers
2536 Over WAN Media (CIPX)", <a href="./rfc1553">RFC 1553</a>, December 1993.
2537
2538 [<a id="ref-RFC-1700">RFC-1700</a>] Reynolds, J. and J. Postel, "Assigned Numbers", STD
2539 2, <a href="./rfc1700">RFC 1700</a>, October 1994. See also:
2540 <a href="http://www.iana.org/numbers.html">http://www.iana.org/numbers.html</a>
2541
2542 [<a id="ref-RFC-2402">RFC-2402</a>] Kent, S. and R. Atkinson, "IP Authentication Header",
2543 <a href="./rfc2402">RFC 2402</a>, November 1998.
2544
2545 [<a id="ref-RFC-2406">RFC-2406</a>] Kent, S. and R. Atkinson, "IP Encapsulating Security
2546 Protocol (ESP)", <a href="./rfc2406">RFC 2406</a>, November 1998.
2547
2548 [<a id="ref-RFC-1828">RFC-1828</a>] Metzger, W., "IP Authentication using Keyed MD5", <a href="./rfc1828">RFC</a>
2549 <a href="./rfc1828">1828</a>, August 1995.
2550
2551 [<a id="ref-IPv6">IPv6</a>] Deering, S. and R. Hinden, "Internet Protocol,
2552 Version 6 (IPv6) Specification", <a href="./rfc2460">RFC 2460</a>, December
2553 1998.
2554
2555 [<a id="ref-ICMPv6">ICMPv6</a>] Conta, A. and S. Deering, "Internet Control Message
2556 Protocol (ICMPv6) for the Internet Protocol Version 6
2557 (IPv6) Specification.", <a href="./rfc2463">RFC 2463</a>, December 1998.
2558
2559 [<a id="ref-RFC-2004">RFC-2004</a>] Perkins, C., "Minimal Encapsulation within IP", <a href="./rfc2004">RFC</a>
2560 <a href="./rfc2004">2004</a>, October 1996.
2561
2562 [<a id="ref-CRTP">CRTP</a>] Casner, S. and V. Jacobson, "Compressing IP/UDP/RTP
2563 Headers for Low-Speed Serial Links", <a href="./rfc2508">RFC 2508</a>,
2564 February 1999.
2565
2566 [<a id="ref-PPP-HC">PPP-HC</a>] Engan, M., Casner, S. and C. Bormann, "IP Header
2567 Compression for PPP", <a href="./rfc2509">RFC 2509</a>, February 1999.
2568
2569
2570
2571
2572 <span class="grey">Degermark, et. al. Standards Track [Page 46]</span></pre>
2573 <hr class='noprint'/><!--NewPage--><pre class='newpage'><span id="page-47" ></span>
2574 <span class="grey"><a href="./rfc2507">RFC 2507</a> IP Header Compression February 1999</span>
2575
2576
2577 <span class="h2"><a class="selflink" id="section-20" href="#section-20">20</a>. Full Copyright Statement</span>
2578
2579 Copyright (C) The Internet Society (1999). All Rights Reserved.
2580
2581 This document and translations of it may be copied and furnished to
2582 others, and derivative works that comment on or otherwise explain it
2583 or assist in its implementation may be prepared, copied, published
2584 and distributed, in whole or in part, without restriction of any
2585 kind, provided that the above copyright notice and this paragraph are
2586 included on all such copies and derivative works. However, this
2587 document itself may not be modified in any way, such as by removing
2588 the copyright notice or references to the Internet Society or other
2589 Internet organizations, except as needed for the purpose of
2590 developing Internet standards in which case the procedures for
2591 copyrights defined in the Internet Standards process must be
2592 followed, or as required to translate it into languages other than
2593 English.
2594
2595 The limited permissions granted above are perpetual and will not be
2596 revoked by the Internet Society or its successors or assigns.
2597
2598 This document and the information contained herein is provided on an
2599 "AS IS" basis and THE INTERNET SOCIETY AND THE INTERNET ENGINEERING
2600 TASK FORCE DISCLAIMS ALL WARRANTIES, EXPRESS OR IMPLIED, INCLUDING
2601 BUT NOT LIMITED TO ANY WARRANTY THAT THE USE OF THE INFORMATION
2602 HEREIN WILL NOT INFRINGE ANY RIGHTS OR ANY IMPLIED WARRANTIES OF
2603 MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. .fi
2604
2605
2606
2607
2608
2609
2610
2611
2612
2613
2614
2615
2616
2617
2618
2619
2620
2621
2622
2623
2624
2625
2626
2627
2628 Degermark, et. al. Standards Track [Page 47]
2629 </pre>