RFC2507 - IP Header Compression(2)

时间:2005-02-16 来源: 作者: 点击:
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ |Version| Traffic Class | Flow Label | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | Payload Length | Next Head
  

+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|Version| Traffic Class | Flow Label |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| Payload Length | Next Header | Hop Limit |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| |
+ +
| |
+ Source Address +
| |
+ +
| |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| |
+ +
| |
+ Destination Address +
| |
+ +
| |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+

Version NOCHANGE (DEF)
Traffic Class NOCHANGE (might be DEF, see sect 4.1)
(see also sect 6 a)
Flow Label NOCHANGE (DEF)
Payload Length INFERRED
Next Header NOCHANGE
Hop Limit NOCHANGE (might be DEF, see sect 4.1)
Source Address NOCHANGE (DEF)
Destination Address NOCHANGE (DEF)

The Payload Length field of encapsulated headers must correspond to
the length value of the encapsulating header. If not, the header
chain MUST NOT be compressed.

NOTE: If this the IP header closest to a TCP header, bit 7 of the
Traffic Class field can be passed using the R-flag of the compressed
TCP header. See section 6 a).

This classification implies that the entire IPv6 base header will be
compressed away.

7.2. IPv6 Extension Headers [IPv6, section 4]

What extension headers are present and the relative order of them is
not expected to change in a packet stream. Whenever there is a
change, a full packet header must be sent. All Next Header fields in
IPv6 base header and IPv6 extension headers are NOCHANGE.

7.3. Options [IPv6, section 4.2]

The contents of Hop-by-hop Options and Destination Options extension
headers are encoded with TLV "options" (see [IPv6]):

+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+- - - - - - - - -
| Option Type | Opt Data Len | Option Data
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+- - - - - - - - -

Option Type and Opt Data Len fields are assumed to be fixed for a
given packet stream, so they are classified as NOCHANGE. The Option
data is RANDOM unless specified otherwise below.

Padding

Pad1 option

+-+-+-+-+-+-+-+-+
| 0 |
+-+-+-+-+-+-+-+-+

Entire option is NOCHANGE.

PadN option

+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+- - - - - - - - -
| 1 | Opt Data Len | Option Data
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+- - - - - - - - -

All fields are NOCHANGE.

7.4. Hop-by-Hop Options Header [IPv6, section 4.3]

+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| Next Header | Hdr Ext Len | |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ +
| |
. .
. Options .
. .
| |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+

Next Header NOCHANGE
Hdr Ext Len NOCHANGE

Options TLV coded values and padding.
Classified according to 7.3 above, unless
being a Jumbo Payload option (see below).

Jumbo Payload option
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| 194 |Opt Data Len=4 |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| Jumbo Payload Length |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+

First two fields are NOCHANGE and Jumbo Payload Length INFERRED.
(frame length must be supplied by link layer implementation).

NOTE: It is silly to compress the headers of a packet carrying a
Jumbo Payload Option since the relative header overhead is
negligible. Moreover, it is usually a bad idea to send such
large packets over low- and medium-speed links.

7.5. Routing Header [IPv6, section 4.4]

+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| Next Header | Hdr Ext Len | Routing Type | Segments Left |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| |
. .
. type-specific data .
. .
| |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+

All fields of the Routing Header are NOCHANGE.

If the Routing Type is not recognized, it is impossible to determine
the final Destination Address unless the Segments Left field has the
value zero, in which case the Destination Address is the final
Destination Address in the basic IPv6 header.

In the Type 0 Routing Header, the last address is DEF if (Segments
Left > 0).

Routing Headers are compressed away completely. This is a big win as
the maximum size of the Routing Header is 392 octets. Moreover, Type
0 Routing Headers with one address, size 24 octets, are used by
Mobile IP.

7.6. Fragment Header [IPv6, section 4.5]

The first fragment of a packet has Fragment Offset = 0 and the chain
of subheaders extends beyond its Fragment Header. If a fragment is
not the first (Fragment Offset not 0), there are no subsequent
subheaders (unless the chain of subheaders in the first fragment
didn't fit entirely in the first fragment).

Since packets may be reordered before reaching the compression point,
and some fragments may follow other routes through the network, a
compressor cannot rely on seeing the first fragment before other
fragments. This implies that information in subheaders following the
Fragment Header of the first fragment cannot be examined to determine
the proper packet stream for other fragments.

It is possible to design compression schemes that can compress
subheaders after the Fragment Header, at least in the first fragment,
but to avoid complicating the rules for sending full headers and the
rules for compression and decompression, the chain of subheaders that
follow a Fragment Header MUST NOT be compressed.

The fields of the Fragment Header are classified as follows.

+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| Next Header | Reserved | Fragment Offset |Res|M|
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| Identification |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+

Next Header NOCHANGE
Reserved NOCHANGE
Res RANDOM
M flag RANDOM
Fragment Offset RANDOM
Identification RANDOM

This classification implies that a Fragment Header is compressed down
to 6 octets. The minimum IPv6 MTU is 1280 octets so most fragments
will be at least 1280 octets. Since the 6 octet overhead of the
compressed fragment header is amortized over a fairly large packet,
the additional complexity of more sophisticated compression schemes
is not justifiable.

NOTE: The Identification field is RANDOM instead of NOCHANGE
to avoid one compression slow-start per original packet.

Grouping of fragments according to the optional guidelines in
section4.1:

Fragments and unfragmented packets should not be grouped
together.

Port numbers cannot be used to identify the packet stream because
port numbers are not present in every fragment. To adhere to the
uniqueness rules for the Identification value, a fragmented
packet stream is identified by the combination of Source Address
and (final) Destination Address.

NOTE: The Identification value is NOT used to identify the
packet stream. This avoids using a new CID for each packet and
saves the cost of the associated compression slow-start. We
expect that the unfragmentable part of the headers will not
change too frequently, if it does thrashing may occur.

7.7. Destination Options Header [IPv6, section 4.6]

+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| Next Header | Hdr Ext Len | |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ +
| |
. .
. Options .
. .
| |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+

Next Header NOCHANGE
Hdr Ext Len NOCHANGE

Options TLV coded values and padding.
Compressed according to 7.3 above.

The only Destination Options defined in [IPv6] are the padding
options.

7.8. No Next Header [IPv6, section 4.7]

Covered by rules for IPv6 Header Extensions (7.2).

7.9. Authentication Header [RFC-2402, section 3.2]

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
+---------------+---------------+---------------+---------------+
| Next Header | Length | RESERVED |
+---------------+---------------+---------------+---------------+
| Security Parameters Index (SPI) |
+---------------+---------------+---------------+---------------+
| |
+ Authentication Data (variable number of 32-bit words) |
| |
+---------------+---------------+---------------+---------------+

Next Header NOCHANGE
Length NOCHANGE
Reserved NOCHANGE
SPI NOCHANGE (DEF)
Authentication Data RANDOM

[RFC-1828] specifies how to do authentication with keyed MD5, the
authentication method all IPv6 implementations must support. For
this method, the Authentication Data is 16 octets.

7.10. Encapsulating Security Payload Header [RFC-2406, section 3.1]

This header implies that the subsequent parts of the packet are
encrypted. Thus, no further header compression is possible on
subsequent headers as encryption is typically already performed when
the compressor sees the packet.

However, when the ESP Header is used in tunnel mode an entire IP
packet is encrypted, and the headers of that packet MAY be compressed
before the packet is encrypted at the entry point of the tunnel.
This means that it must be possible to feed an IP packet and its
length to the decompressor, as if it came from the link-layer. The
mechanisms for dealing with reordering described in section 11 MUST
also be used, as packets can be reordered in a tunnel.

+---------------+---------------+---------------+---------------+
| Security Association Identifier (SPI), 32 bits |
+===============+===============+===============+===============+
| Opaque Transform Data, variable length |
+---------------+---------------+---------------+---------------+

SPI NOCHANGE (DEF)
Opaque Transform Data RANDOM

Everything after the SPI is encrypted and is not compressed.

7.11. UDP Header

The UDP header is described in [RFC-768].

The Next Header field (IPv6) or Protocol field (IPv4) in the
preceding subheader is DEF.

+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| Source Port | Destination Port |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| Length | Checksum |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+

Source Port NOCHANGE (DEF)
Destination Port NOCHANGE (DEF)
Length INFERRED
Checksum RANDOM, unless it is zero,
in which case it is NOCHANGE.

The Length field of the UDP header MUST match the Length field(s) of
preceding subheaders, i.e, there must not be any padding after the
UDP payload that is covered by the IP Length.

The UDP header is typically compressed down to 2 octets, the UDP
checksum. When the UDP checksum is zero (which it cannot be with
IPv6), it is likely to be so for all packets in the flow and is
defined to be NOCHANGE. This saves 2 octets in the compressed header.

7.12. TCP Header

The TCP header is described in [RFC-793].

The Next Header field (IPv6) or Protocol field (IPv4) in the
preceding subheader is DEF.

+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| Source Port | Destination Port |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| Sequence Number |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| Acknowledgment Number |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| Offset| Reserved |U|A|P|R|S|F| Window |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| Checksum | Urgent Pointer |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| Options | Padding |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+

U, A, P, R, S, and F stands for Urg, Ack, Psh, Rst, Syn, and Fin.

There are two ways to compress the TCP header.

7.12.1. Compressed with differential encoding

Source Port NOCHANGE (DEF)
Destination Port NOCHANGE (DEF)
Sequence Number DELTA
Acknowledgment Number DELTA
Offset NOCHANGE
Reserved DELTA (if differs from context,
set R-flag in flag octet
and send absolute value
as described in 6 a.)
Urg,Psh RANDOM (placed in flag octet)
Ack INFERRED to be 1
Rst,Syn,Fin INFERRED to be 0
Window DELTA (if change in Window,
set W-flag in flag octet
and send difference)
Checksum RANDOM
Urgent Pointer DELTA (if Urg is set, send
absolute value)
Options, Padding DELTA (if change in Options,
set O-flag and send
whole Options, Padding)

A packet with a TCP header compressed according to the above must be
indicated to be of type COMPRESSED_TCP. The compressed header is
described in section 6.

This method is essentially the differential encoding techniques of
Jacobson, described in [RFC-1144], the differences being the placement
of the compressed TCP header fields (see section 6), the use of the
O-flag, the use of the R-flag, and elimination of the C-flag. The
O-flag allows compression of the TCP header when the Timestamp option
is used and the Options fields changes with each header.

DELTA values (except for Reserved field and Options, Padding) MUST be
coded as in [RFC-1144]. A Reserved field value passed with the R-flag
MUST NOT update the context at compressor or decompressor.

7.12.2. Without differential encoding

Source Port NOCHANGE (DEF)
Destination Port NOCHANGE (DEF)

(all the rest) RANDOM

The Identification field in a preceding IPv4 header is RANDOM.

A packet with a TCP header compressed according to the above must be
indicated to be of type COMPRESSED_TCP_NODELTA. It uses the same CID
space as COMPRESSED_TCP packets, and the header MUST be saved as
context. The compressed header is described in section 6.

This packet type can be sent as the response to a header request
instead of sending a full header, can be used over links that reorder
packets, and can be sent instead of a full header when there are
changes that cannot be represented by a compressed header. A
sophisticated compressor can switch to sending only
COMPRESSED_TCP_NODELTA headers when the packet loss frequency is high.

7.13. IPv4 header [RFC-791, section 3.1]

0 1 2 3
0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|Version| IHL |Type of Service| Total Length |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| Identification |Flags| Fragment Offset |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| Time to Live | Protocol | Header Checksum |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| Source Address |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| Destination Address |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| Options | Padding |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+

There are two ways to compress the IPv4 header

a) If the IPv4 header is not for a fragment (MF flag is not set and
Fragment Offset is zero) and there are no options (IHL is 5), it
is classified as follows

Version NOCHANGE (DEF)
IHL NOCHANGE (DEF, must be 5)
Type of Service NOCHANGE (might be DEF, see sect 4.1)
(see also 6 a)
Total Length INFERRED (from link-layer implementation
or encapsulating IP header)

Identification DELTA/ (If the Protocol field has the
(value corresponding to TCP)
RANDOM (otherwise)

Flags NOCHANGE (MF flag must not be set)
Fragment Offset NOCHANGE (must be zero)
Time to Live NOCHANGE (might be DEF, see sect 4.1)
Protocol NOCHANGE
Header Checksum INFERRED (calculated from other fields)
Source Address NOCHANGE (DEF)
Destination Address NOCHANGE (DEF)
Options, Padding (not present)

Note: When a TCP header immediately follows, the IPv4 and TCP
header MUST be compressed as a unit as described in section 6.
Bits 6 and 7 of the Type of Service field (bits 14 and 15 of the
first word) can then be passed using the R-flag (see section 6
a).

b) If the IPv4 header is for a fragment (MF bit set or Fragment
Offset nonzero), or there are options (IHL > 5), all fields are
RANDOM (i.e., if the header is compressed all fields are sent
as-is and not compressed). This classification allows compression
of the tunnel header, but not the fragment header, when fragments
are tunneled. If the IPv4 header is for a fragment it ends the
compressible chain of subheaders, i.e., it must be the last
subheader to be compressed. If the IPv4 header has options but
is not for a fragment it does not end the compressible chain of
subheaders, so subsequent subheaders can be compressed.

A compressor that follows the optional guidelines of section 4.1 will
in case a) use the Version, Source Address and Destination Address to
define the packet stream, together with the fact that there are no
IPv4 options and that this is not a fragment.

Case b) can define two kinds of packet streams depending on whether
the IPv4 header is for a fragment or not.

If the IPv4 header in case b) is for a fragment, a compressor
following the optional guidelines will use that fact together with
the Version, Source Address, and Destination Address to determine the
packet stream.

If the IPv4 header in case b) is not for a fragment, it must have
options. A compressor following the optional guidelines will use that
fact, but not the size of the options, together with the Version,
Source Address, and Destination Address to determine the packet
stream.

7.14. Minimal Encapsulation header [RFC-2004, section 3.1]

0 1 2 3
0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| Protocol |S| reserved | Header Checksum |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| Original Destination Address |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
: (if present) Original Source Address :
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+

Protocol NOCHANGE
Original Source Address Present (S) NOCHANGE
reserved NOCHANGE
Header Checksum INFERRED (calculated from
other values)
Original Destination Address NOCHANGE
Original Source Address NOCHANGE (present only
if S=1)

This header is likely to be used by Mobile IP.

8. Changing context identifiers

On a point-to-point link, the compressor has total knowledge of what
CIDs are in use at the decompressor and may change what CID a packet
stream uses or reuse CIDs at will.

Each non-TCP CID is associated with a context with a generation
value. To avoid too rapid generation wrap-around and potential
incorrect decompression, an implementation MUST avoid wrap-around of
the generation value in less than MIN_WRAP seconds (see section 14).

To aid in avoiding wrap-around, the generation value associated with
a CID MUST NOT be reset when changing to a new packet stream.
Instead, a compressor MUST increment the generation value by one when
using the CID for a new non-TCP packet stream.

9. Rules for dropping or temporarily storing packets

When a decompressor receives a packet with a compressed TCP header
with CID C, it MUST be discarded when the context for C has not been
initialized by a full header.

When a decompressor receives a packet with a compressed non-TCP
header with CID C and generation G, the header must not be
decompressed using the current context when

a) the decompressor has been disconnected from the compressor for
more than MIN_WRAP seconds, because the context might be
obsolete even if it has generation G.

b) the context for C has a generation other than G.

In case a) and b) the packet may either be

i) discarded immediately, or else

ii) stored temporarily until the context is updated by a packet
with a full non-TCP header with CID C and generation G, after
which the header can be decompressed.

Packets stored in this manner MUST be discarded when

*) receiving full or compressed non-TCP headers with CID C
and a generation other than G,

*) the decompressor has not received packets with CID C in
the last MIN_WRAP seconds.

When full headers are lost, a decompressor can receive compressed
non-TCP headers with a generation value other than the generation of
its context. Rule ii) allows the decompressor to store such headers
until they can be decompressed using the correct context.

10. Low-loss header compression for TCP

Since fewer bits are transmitted per packet with header compression,
the packet loss rate is lower with header compression than without,
for a fixed bit-error rate. This is beneficial for links with high
bit-error rates such as wireless links.

However, since TCP headers are compressed using differential
encoding, a single lost TCP segment can ruin an entire TCP sending
window because the context is not incremented properly at the
decompressor. Subsequent headers will therefore be decompressed to
be different than before compression and discarded by the TCP
receiver because the TCP checksum fails.

A TCP connection in the wide area where the last hop is over a
medium-speed lossy link, for example a wireless LAN, will then have
poor performance with traditional header compression because the
delay-bandwidth product is relatively large and the bit-error rate
relatively high. For a 2 Mbit/s wireless LAN and an end-to-end RTT of
200 ms, the delay-bandwidth product is 50 kbyte. That is equivalent
to about 97 512-octet segments with compressed headers. Each loss
can thus be multiplied by a factor of 100.

This section describes two simple mechanisms for quick repair of the
context. With these mechanisms header compression will improve TCP
throughput over lossy links as well as links with low bit-error
rates.

10.1. The "twice" algorithm

The decompressor may compute the TCP checksum to determine if its
context is not updated properly. If the checksum fails, the error is
assumed to be caused by a lost segment that did not update the
context properly. The delta of the current segment is then added to
the context again on the assumption that the lost segment contained
the same delta as the current. By decompressing and computing the TCP
checksum again, the decompressor checks if the repair succeeded or if
the delta should be applied once more.

Analysis of traces of various TCP bulk transfers show that applying
the delta of the current segment one or two times will repair the
context for between 83 and 99 per cent of all single-segment losses
in the data stream. For the acknowledgment stream, the success rate
is smaller due to the delayed ack mechanism of TCP. The "twice"
mechanism repairs the context for 53 to 99 per cent of the losses in
the acknowledgment stream. A sophisticated implementation of this
idea would determine whether the TCP stream is an acknowledgment or
data stream and determine the segment size by observing the stream of
full and compressed headers. Trying deltas that are small multiples
of the segment size will result in even higher rates of successful
repairs for acknowledgment streams.

10.2. Header Requests

The relatively low success rate for the "twice" algorithm for TCP
acknowledgment streams calls for an additional mechanism for
repairing the context at the decompressor. When the decompressor
fails to repair the context after a loss, the decompressor may
optionally request a full header from the compressor. This is
possible on links where the decompressor can identify the compressor
and send packets to it.

On such links, a decompressor may send a CONTEXT_STATE packet back to
the compressor to indicate that one or more contexts are invalid. A
decompressor SHOULD NOT transmit a CONTEXT_STATE packet every time a
compressed packet refers to an invalid context, but instead should
limit the rate of transmission of CONTEXT_STATE packets to avoid
flooding the reverse channel. A CONTEXT_STATE packet can indicate
that several contexts are out of date, this technique SHOULD be used
instead of sending several separate packets. The following diagram
shows the format of a CONTEXT_STATE packet.

0 1 2 3 4 5 6 7
+---+---+---+---+---+---+---+---+
| TCP header request = 3 |
+---+---+---+---+---+---+---+---+
| CID count |
+---+---+---+---+---+---+---+---+
| CID |
+---+---+---+---+---+---+---+---+
| CID |
+---+---+---+---+---+---+---+---+
...
+---+---+---+---+---+---+---+---+
| CID |
+---+---+---+---+---+---+---+---+

The first octet is a type code to allow the CONTEXT_STATE packet type
to be shared for other compression protocols that are (see [CRTP]) or
may be defined in parallel with this one. When used for TCP header
requests the type code has the value 3, and the remainder of the
packet is a sequence of CIDs preceded by a one-octet count of the
number of CIDs.

On receipt of a CONTEXT_STATE packet, the compressor MUST mark the
CIDs invalid to ensure that the next packet emitted in those packet
streams are FULL_HEADER or COMPRESSED_TCP_NODELTA packets.

Header requests are an optimization, so loss of a CONTEXT_STATE
packet does not affect the correct operation of TCP header
compression. When a CONTEXT_STATE packet is lost, eventually a new
one will be transmitted or TCP will timeout and retransmit. The big
advantage of using header requests is that TCP acknowledgment streams
can be repaired after a roundtrip-time over the lossy link. This
will typically avoid a TCP timeout and unnecessary retransmissions.
The lower packet loss rate due to smaller packets will then result in
higher throughput because the TCP window can grow larger between
losses.

11. Links that reorder packets

Some links reorder packets, for example multi-hop radio links that
use deflection routing to route around congested nodes. Packets
routed different ways can then arrive at the destination in a
different order than they were sent.

11.1. Reordering in non-TCP packet streams

Compressed non-TCP headers do not change the context, and neither do
full headers that refresh it. There can be problems only when a full
header that changes the context arrives out of order. There are two
cases:

- A packet with a full header with generation G arrives *after*
a packet with a compressed header with generation G. This case
is covered by rule b) ii) in section 9.

- A packet with a full header with generation G arrives *before*
a packet with a compressed header with generation G-1 (modulo
64). The decompressor MAY then keep both versions of the
context around for a while to be able to decompress subsequent
compressed headers with generation G-1 (modulo 64). The old
context MUST be discarded after MIN_WRAP seconds.

11.2. Reordering in TCP packet streams

A compressor may avoid sending COMPRESSED_TCP headers and only send
COMPRESSED_TCP_NODELTA headers when there is reordering over the
link. Compressed headers will typically be 17 octets with that
method, significantly larger than the usual 4-7 octets.

To achieve better compression rates the following method, adding only
two octets to the compressed header for a total of 6-9 octets, may be
used. A packet sequence number, incremented by one for every packet
in the TCP stream, is then associated with each compressed and full
header. This allows the decompressor to place the packets in the
correct sequence and apply their deltas to the context in the correct
order. A simple sliding window scheme is used to place the packets
in the correct order.

Two octets are needed for the packet sequence numbers. One octet
gives only 256 sequence numbers. In a sliding window scheme the
window should be no larger than half of the sequence number space, so
packets can not arrive more than 127 positions out-of-sequence. This
is equivalent to a delay of 260 ms on 2 Mbit/s links with 512 octet
segments. Delays of that order are not uncommon over wide-area
Internet connections. However, two octets giving 2^16 = 65536 values
should be sufficient.

Full TCP/IP headers will only have space for one octet of sequence
number when there is no tunneling. It is not feasible to increase the
size of full headers since the packet size might be optimized for the
MTU of the link. Therefore only the least significant octet of the
packet sequence number can be placed in such full headers. We believe

that such full headers can be positioned correctly frequently enough
with only the least significant octet of the packet sequence number
available.

The packet sequence number zero MUST be skipped over. Avoiding zero
takes care of a problem that can occur when the TCP window scale
option is used to enlarge the TCP window. When exactly 2^16 octets of
TCP data is lost, a compressed header will be decompressed
incorrectly without being detected by the TCP checksum. TCP segment
sizes are often a power of two. So by using a packet sequence number
space that is not a power of two either the TCP sequence number or
the packet sequence number will differ when 2^16 octets are lost.
Whenever a compressor sees the window scale option on a SYN segment,
it MUST use packet sequence numbers when subsequently compressing
that packet stream.

In compressed TCP headers the two octet packet sequence number MUST
be placed immediately after the TCP Checksum. See section 5.3 for
placement of packet sequence numbers in full headers.

12. Hooks for additional header compression

The following hook is supplied to allow additional header compression
schemes for headers on top of UDP. The initial chain of subheaders is
then compressed as described here, and the other header compression
scheme is applied to the header above the UDP header. An example of
such additional header compression is Compressed RTP by Casner and
Jacobson [CRTP]. To allow some error detection, such schemes
typically need a sequence number that may need to be passed in full
headers as well as compressed UDP headers.

The D-bit and Data octet (see section 6) provides the necessary
mechanism. When a sequence number, say, needs to be passed in a
FULL_HEADER or COMPRESSED_NON_TCP header, the D-bit is set and the
sequence number is placed in the Data field. The decompressor must
then extract and make the Data field available to the additional
header compression scheme.

Use of additional header compression schemes like CRTP must be
negotiated. The D-bit and Data octet mechanism must automatically be
enabled whenever use of additional header compression schemes has
been negotiated.

13. Demultiplexing

For each link layer, there must be a document specifying how the
various packet types used by IP header compression is indicated.
Such a document exists for PPP [PPP-HC]. This section gives OPTIONAL
guidelines on how packet types may be indicated by a specific link-
layer.

It is necessary to distinguish packets with regular IPv4 headers,
regular IPv6 headers, full IPv6 packets, full IPv4 packets,
compressed TCP packets, compressed non-TCP packets, and CONTEXT_STATE
packets.

The decision to use a distinct ethertype (or equivalent) for IPv6 has
already been taken, which means that link-layers must be able to
indicate that a packet is an IPv6 packet.

IP header compression requires that the link-layer implementation can
indicate four kinds of packets: COMPRESSED_TCP for format a) in
section 6, COMPRESSED_TCP_NODELTA for format b), COMPRESSED_NON_TCP
for formats c) and d), and CONTEXT_STATE as described in section
11.2. It is also desirable to indicate FULL_HEADERS at the link
layer.

Full headers can be indicated by setting the first bit of the Version
field in a packet indicated to be an IPv6 packet. In addition, one
bit of the Version field is used to indicate if the first subheader
is an IPv6 or an IPv4 header, and one bit is used to indicate if this
full header carries a TCP CID or a non-TCP CID. The first four bits
are encoded as follows:

Version Meaning
------- -------

0110 regular IPv6 header

1T*0 T=1 indicates a TCP header, T=0 indicates a non-TCP header
1*V0 V=1 indicates a IPv6 header, V=0 indicates a IPv4 header

If a link-layer cannot indicate the packet types for the compressed
headers or CONTEXT_STATE, packet types that cannot be indicated could
start with an octet indicating the packet type, followed by the
header.

First octet Type of compressed header
----------- -------------------------

0 COMPRESSED_TCP
1 COMPRESSED_TCP_NODELTA
2 COMPRESSED_NON_TCP
3 CONTEXT_STATE

The currently assigned CONTEXT_STATE type values are

Value Type Reference
----- ----- ----------
0 Reserved -
1 IP/UDP/RTP w. 8-bit CID [CRTP]
2 IP/UDP/RTP w. 16-bit CID [CRTP]
3 TCP header request Section 10.2

14. Configuration Parameters

Header compression parameters are negotiated in a way specific to the
link-layer implementation. Such procedures for link-layer xxx needs
to be specified in a document "IP header compression over xxx". Such
a document exists for PPP [PPP-HC].

The following parameter is fixed for all implementations of this
header compression scheme.

MIN_WRAP - minimum time of generation value wrap around

3 seconds.

The following parameters can be negotiated between the compressor and
decompressor. If not negotiated their values must be as specified by
DEFAULT.

F_MAX_PERIOD - Largest number of compressed non-TCP headers that
may be sent without sending a full header.

DEFAULT is 256

F_MAX_PERIOD must be at least 1 and at most 65535.

F_MAX_TIME - Compressed headers may not be sent more than
F_MAX_TIME seconds after sending last full header.

DEFAULT is 5

F_MAX_TIME must be at least 1 and at most 255.

NOTE: F_MAX_PERIOD and F_MAX_TIME should be lower when it is
likely that a decompressor loses its state.

MAX_HEADER - The largest header size in octets that may
be compressed.

DEFAULT is 168 octets, which covers

- Two IPv6 base headers
- A Keyed MD5 Authentication Header
- A maximum-sized TCP header

MAX_HEADER must be at least 60 octets and
at most 65535 octets.

TCP_SPACE - Maximum CID value for TCP.

DEFAULT is 15 (which gives 16 CID values)

TCP_SPACE must be at least 3 and at most 255.

NON_TCP_SPACE - Maximum CID value for non-TCP.

DEFAULT is 15 (which gives 16 CID values)

NON_TCP_SPACE must be at least 3 and at most 65535.

EXPECT_REORDERING - The mechanisms in section 11 are used.

DEFAULT no.

15. Implementation Status

A prototype using UDP as the link layer has been operational since
March 1996. A NetBSD implementation for PPP has been operational
since October 1996.

16. Acknowledgments

This protocol uses many ideas originated by Van Jacobson in the
design of header compression for TCP/IP over slow-speed links [RFC-
1144]. It has benefited from discussions with Stephen Casner and
Carsten Bormann.

We thank Craig Partridge for pointing out a problem that can occur
when the TCP window scale option is used. A solution to this problem
relying on the packet sequence numbers used for reordering is
described in section 11.2.

17. Security Considerations

The compression protocols in this document run on top of a link-layer
protocol. The compression protocols themselves introduce no new
additional vulnerabilities beyond those associated with the specific
link-layer technology being used.

Denial-of-service attacks are possible if an intruder can introduce
(for example) bogus Full Header packets onto the link. However, an
intruder having the ability to inject arbitrary packets at the link-
layer in this manner raises additional security issues that dwarf
those related to the use of header compression.

We advise implementors against identifying packet streams with the
aid of information that is encrypted, even if such information
happens to be available to the compressor. Doing so may expose
traffic patterns.

18. Authors' Addresses

Mikael Degermark
Department of Computer Science and Electrical Engineering
Lulea University of Technology
SE-971 87 Lulea, Sweden

Phone: +46 920 91188
Fax: +46 920 72831
Mobile: +46 70 833 8933
EMail: micke@sm.luth.se

Bjorn Nordgren
CDT/Telia Research AB
Aurorum 6
S-977 75 Lulea, Sweden

Phone: +46 920 75400
Fax: +46 920 75490
EMail: bcn@lulea.trab.se, bcn@cdt.luth.se

Stephen Pink
Department of Computer Science and Electrical Engineering
Lulea University of Technology
SE-971 87 Lulea, Sweden

Phone: +46 920 752 29
Fax: +46 920 728 31
Mobile: +46 70 532 0007
EMail: steve@sm.luth.se

19. References

[RFC-768] Postel, J., "User Datagram Protocol", STD 6, RFC768,
August 1980.

[RFC-791] Postel, J., "Internet Protocol", STD 5, RFC791,
September 1981.

[RFC-793] Postel, J., "Transmission Control Protocol", STD 7,
RFC793, September 1981.

[RFC-1144] Jacobson, V., "Compressing TCP/IP Headers for Low-
Speed Serial Links", RFC1144, February 1990.

[RFC-1553] Mathur, A. and M. Lewis, "Compressing IPX Headers
Over WAN Media (CIPX)", RFC1553, December 1993.

[RFC-1700] Reynolds, J. and J. Postel, "Assigned Numbers", STD
2, RFC1700, October 1994. See also:
http://www.iana.org/numbers.html

[RFC-2402] Kent, S. and R. Atkinson, "IP Authentication Header",
RFC2402, November 1998.

[RFC-2406] Kent, S. and R. Atkinson, "IP Encapsulating Security
Protocol (ESP)", RFC2406, November 1998.

[RFC-1828] Metzger, W., "IP Authentication using Keyed MD5", RFC
1828, August 1995.

[IPv6] Deering, S. and R. Hinden, "Internet Protocol,
Version 6 (IPv6) Specification", RFC2460, December
1998.

[ICMPv6] Conta, A. and S. Deering, "Internet Control Message
Protocol (ICMPv6) for the Internet Protocol Version 6
(IPv6) Specification.", RFC2463, December 1998.

[RFC-2004] Perkins, C., "Minimal Encapsulation within IP", RFC
2004, October 1996.

[CRTP] Casner, S. and V. Jacobson, "Compressing IP/UDP/RTP
Headers for Low-Speed Serial Links", RFC2508,
February 1999.

[PPP-HC] Engan, M., Casner, S. and C. Bormann, "IP Header
Compression for PPP", RFC2509, February 1999.

20. Full Copyright Statement

Copyright (C) The Internet Society (1999). All Rights Reserved.

This document and translations of it may be copied and furnished to
others, and derivative works that comment on or otherwise explain it
or assist in its implementation may be prepared, copied, published
and distributed, in whole or in part, without restriction of any
kind, provided that the above copyright notice and this paragraph are
included on all such copies and derivative works. However, this
document itself may not be modified in any way, such as by removing
the copyright notice or references to the Internet Society or other
Internet organizations, except as needed for the purpose of
developing Internet standards in which case the procedures for
copyrights defined in the Internet Standards process must be
followed, or as required to translate it into languages other than
English.

The limited permissions granted above are perpetual and will not be
revoked by the Internet Society or its successors or assigns.

This document and the information contained herein is provided on an
"AS IS" basis and THE INTERNET SOCIETY AND THE INTERNET ENGINEERING
TASK FORCE DISCLAIMS ALL WARRANTIES, EXPRESS OR IMPLIED, INCLUDING
BUT NOT LIMITED TO ANY WARRANTY THAT THE USE OF THE INFORMATION
HEREIN WILL NOT INFRINGE ANY RIGHTS OR ANY IMPLIED WARRANTIES OF
MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. .fi

------分隔线----------------------------
顶一下
(0)
0%
踩一下
(1)
100%
------分隔线----------------------------
最新评论 查看所有评论
发表评论 查看所有评论
请自觉遵守互联网相关的政策法规,严禁发布色情、暴力、反动的言论。
评价:
表情:
用户名: 密码: 验证码:
推荐内容