Skip to main content

B. Compatibility with Past Mistakes

When combined with the modern PPP serial line protocol[9], the use of header compression is automatic and invisible to the user. Unfortunately, many sites have existing users of the SLIP described in [12] which doesn't allow for different protocol types to distinguish header compressed packets from IP packets or for version numbers or an option exchange that could be used to automatically negotiate header compression.

The author has used the following tricks to allow header compressed SLIP to interoperate with the existing servers and clients. Note that these are hacks for compatibility with past mistakes and should be offensive to any right thinking person. They are offered solely to ease the pain of running SLIP while users wait patiently for vendors to release PPP.

B.1. Living without a framing `type' byte​

The bizarre packet type numbers in sec. A.1 were chosen to allow a packet type' to be sent on lines where it is undesirable or impossible to add an explicit type byte. Note that the first byte of an IP packet always contains 4' (the IP protocol version) in the top four bits. And that the most significant bit of the first byte of the compressed header is ignored. Using the packet types in sec. A.1, the type can be encoded in the most significant bits of the outgoing packet using the code

                    p->dat[0] |= sl_compress_tcp(p, comp);

and decoded on the receive side by

                  if (p->dat[0] & 0x80)
type = TYPE_COMPRESSED_TCP;
else if (p->dat[0] >= 0x70) {
type = TYPE_UNCOMPRESSED_TCP;
p->dat[0] &=~ 0x30;
} else
type = TYPE_IP;
status = sl_uncompress_tcp(p, type, comp);

B.2. Backwards compatible SLIP servers​

The SLIP described in [12] doesn't include any mechanism that could be used to automatically negotiate header compression. It would be nice to allow users of this SLIP to use header compression but, when users of the two SLIP varients share a common server, it would be annoying and difficult to manually configure both ends of each connection to enable compression. The following procedure can be used to avoid manual configuration.

Since there are two types of dial-in clients (those that implement compression and those that don't) but one server for both types, it's clear that the server will be reconfiguring for each new client session but clients change configuration seldom if ever. If manual configuration has to be done, it should be done on the side that changes infrequently --- the client. This suggests that the server should somehow learn from the client whether to use header compression. Assuming symmetry (i.e., if compression is used at all it should be used both directions) the server can use the receipt of a compressed packet from some client to indicate that it can send compressed packets to that client. This leads to the following algorithm:

There are two bits per line to control header compression: allowed and on. If on is set, compressed packets are sent, otherwise not. If allowed is set, compressed packets can be received and, if an UNCOMPRESSED_TCP packet arrives when on is clear, on will be set. If a compressed packet arrives when allowed is clear, it will be ignored.

Clients are configured with both bits set (allowed is always set if on is set) and the server starts each session with allowed set and on clear. The first compressed packet from the client (which must be a UNCOMPRESSED_TCP packet) turns on compression for the server.

Note: Since [12] framing doesn't include error detection, one should be careful not to `false trigger' compression on the server. The UNCOMPRESSED_TCP packet should checked for consistency (e.g., IP checksum correctness) before compression is enabled. Arrival of COMPRESSED_TCP packets should not be used to enable compression.