RFC 1692

Transport Multiplexing Protocol (TMux)

๐Ÿ“… published August 1994, from ietf

RFC 1692 ยท Transport Multiplexing Protocol (TMux) ๐Ÿฆ‹

Okay bestie, let's knock out the paperwork first ๐Ÿ’… This is RFC 1692, titled "Transport Multiplexing Protocol (TMux)", from the Network Working Group. It's a Standards Track doc dated August 1994. The authors are P. Cameron (Xylogics, International Ltd.), D. Crocker (Silicon Graphics, Inc.), D. Cohen (Myricom), and J. Postel (ISI). The title block doesn't list anything it obsoletes or updates, so there's nothing extra to flag there โœจ


Status of this Memo ๐ŸŒธ

This document specifies an Internet standards track protocol for the Internet community, and it's asking for discussion and suggestions for improvements ๐Ÿซถ For the standardization state and status of this protocol, check the current edition of the "Internet Official Protocol Standards" (STD 1). Distribution of this memo is unlimited ๐ŸŒˆ

Abstract ๐ŸŽ€

Terminal servers have a small-packet problem. They can generate a huge pile of tiny packets, and most of those are headed to just one or two hosts ๐Ÿ˜ญ TMux lets multiple short transport segments, no matter what application they belong to, get bundled up between a server and host pair ๐Ÿ’œ

Acknowledgments ๐Ÿ™

This spec is the result of merging two documents. One is the original TMux proposal, which came out of several discussions and related initiatives through IETF working groups. The other is IEN 90 [1], which Danny Cohen and Jon Postel first proposed in May 1979 ๐Ÿงš

Applicability Statement ๐Ÿ“

TMux is built to optimize sending a ton of small data packets, the kind you get when lots of interactive Telnet and Rlogin sessions connect to a few hosts on the network ๐Ÿ’ป In that situation, TMux can improve both network and host performance โœจ TMux is not intended for multiplexing long streams made of large blocks of data, the kind apps like FTP usually send. Not its vibe ๐Ÿ™…โ€โ™€๏ธ

TMux may be applicable to other situations that generate small packets, but the design didn't consider those, so don't assume it's a perfect fit ๐Ÿคทโ€โ™€๏ธ

Using TMux in any other situation may require some modification ๐Ÿ› ๏ธ


1. Introduction โœจ

When network designers figure out which protocols create the most load, they usually think about protocols that move big blocks of data, like FTP and NFS. What often gets missed is the load from Telnet and Rlogin, because everyone assumes users type slowly and the packets are super tiny. That's a seriously big underestimate for networks and hosts with lots of Telnet and Rlogin ports spread across multiple terminal servers ๐Ÿ˜ค

The problem is that the work a host has to do to process a 1-octet packet is almost as much as the work for a 1500-octet packet. So it's the overhead of handling each packet that eats a host's resources, not the processing of the data itself ๐Ÿคฏ

Communication load isn't only measured in bits per second. It's also measured in packets per second, and in many situations the packets-per-second number is the real performance limit, not the bits. The proposed multiplexing is aimed at fixing exactly that ๐Ÿ’…

If most users on a terminal server only connect to a few hosts, then it's pretty obvious that network and host load could drop a lot if traffic from multiple users headed to the same host could ride in the same packet ๐Ÿ‘‘

TMux is designed to improve network utilization and cut the interrupt load on hosts running multiple sessions with lots of short packets. It does this by multiplexing transport traffic onto a single IP datagram [2], which means fewer, larger packets. TMux is very constrained in how it pulls this off, going for simplicity over sophistication ๐Ÿง


2. Protocol Design ๐ŸŽ€

IP hosts may use TMux transparently, and they may even switch back and forth between TMux and sending transport segments in the usual, independent IP datagrams ๐Ÿฆ‹

TMux works by stuffing a set of transport segments into the same IP datagram. Each segment gets a TMux mini-header in front of it, and that header says how long the segment is and which transport protocol it actually belongs to. The receiving host splits out the individual transport segments and hands them up to the transport layer as if they'd arrived the normal IP/transport way. So the transport layer has no clue about the special wrapping ๐Ÿ™ˆ

A TMux message looks like this ๐Ÿ‘€

     | IP hdr | TM hdr | Tport segment | TM hdr | Tport segment| ...|

Quick legend ๐Ÿ‘‡

  • TM hdr is a TMux mini-header and specifies the following Tport segment.
  • Tport segment refers to the entire transport segment, including transport headers.

The TMux protocol lets you combine transmission units from different higher-level protocols into one transmission unit of a lower-level protocol. Only segments with the same Internet Protocol (IP) header can be combined, with the possible exception of the protocol and checksum fields. Say you have the segment (H1, B1) and the segment (H2, B2), where Hi and Bi are the headers and bodies of each segment. They may be combined (multiplexed) only if H=H1=H2. The combined TMux message ends up as either (H, B1, B2) or (H, B2, B1) ๐Ÿซถ

The receiver should treat this combined message as if the two original segments, (H,B1) and (H,B2), arrived separately. It is recommended, though not a requirement, that the segments in the TMux message should be processed in the same order that they appear in the TMux message ๐Ÿ“ฆ

Here's the multiplexing magic โœจ The individual segments (H,B1) through (H,Bn) get combined into one single message. That message has an IP header equal to H, except the PROTOCOL field is set to 18, which is the protocol number of the TMux protocol. After that header come all the segments, B1 through Bn. Each segment, Bi, gets a 4 octet TMux mini-header in front of it. That mini-header holds the number of the protocol the segment is addressed to, plus the total length of the segment, including the mini-header itself. Since this mini-header isn't otherwise protected by a checksum, it also has a checksum field that just covers the mini-header ๐Ÿ”

2.1. IP Protocol field value ๐Ÿ”ข

TMux is indicated in an IP datagram by the Protocol (ID) value of 18 (22 octal), see [3]. Main character number 18 ๐ŸŒŸ

2.2. Header Format ๐Ÿงฉ

Every 4 octet TMux mini-header has this general format ๐Ÿ‘‡

                     +-------------------------------+
                     |         Length high           |
                     +-------------------------------+
                     |          Length low           |
                     +-------------------------------+
                     |         Protocol ID           |
                     +-------------------------------+
                     |          Checksum             |
                     +-------------------------------+
                     |      Transport segment        |
                     |       ...                     |
                     |       ...                     |

The LENGTH field is the octet count for this mini-header plus the transport segment after it, anywhere from 0-65535 octets. So the length field has a minimum value of 4 ๐Ÿ™ƒ Segments that are larger than the maximum allowed for TMux (see section 5.1) should be sent as individual IP datagrams instead.

The Protocol ID field holds the value that would normally have been placed in the IP header Protocol field ๐Ÿง 

The Checksum field is the XOR of the first 3 octets ๐Ÿงฎ

Now for the padding ๐Ÿงต To keep TCP, UDP and other segments on their 32 bit alignment, when the segments being multiplexed aren't a multiple of 32 bits long, extra octets get added to re-align the end of the segment, and therefore the next segment too. The receiver ignores these octets on input. The padding doesn't affect the LENGTH field, though. It still contains the real length of the segment ๐Ÿ’–

2.3. Sending Data ๐Ÿ’Œ

Okay so host endpoints can use TMux whenever they want, in either direction (or both!) ๐Ÿ’–. They can even flip back and forth between TMux packaging and the usual individual IP datagrams for individual transport associations ๐Ÿฆ‹. The only barrier to using TMux is that the sender has to know whether the receiver supports it. This matters a lot because early TMux use is probably gonna be limited ๐Ÿ˜ญ.

The easiest way to detect TMux support is to only send TMux messages to hosts that have already sent you a valid TMux message ๐ŸŽ€. That leaves the question of who starts the TMux connection in the first place ๐Ÿค”. The most straightforward answer is that the host sends an IP datagram with no data (so the IP total length field is 20), but with an IP Protocol field value of 18 for TMux. This is called a TMux ENQ (enquiry) message โœจ.

The host that receives this message knows the originator supports TMux, so it can start sending TMux messages ๐Ÿงš. That in turn makes the originator of the ENQ message start using TMux too. If for any reason the receiver doesn't plan to send TMux messages to the originator, but is ready to accept them, it can reply with another ENQ message.

If an ENQ message doesn't get a response, it's reasonable to resend the ENQ a while later in case the original was lost ๐Ÿ™ˆ. If that one gets lost too, the ENQ may be repeated as often as needed, but the time between requests should increase exponentially, up to a limit of about 1 hour. Suitable times between ENQs would be 15 seconds, 30 seconds, 60 seconds, 120 seconds etc. โณ

Note that this checking process doesn't need to get in the way of any of the transport (user) data ๐Ÿ’…. That data can be sent whenever it's convenient, albeit in its less-efficient IP datagram form.

The only problem with this scheme is that a host which supports TMux may stop supporting it, like what happens when the host gets rebooted ๐Ÿ˜ฌ. Other hosts need to learn about this change. The fix is to keep a Time To Live (TTL) value for each host that has sent TMux messages. This TTL is a timed TTL, not a count like the IP TTL field, and its time stamp gets updated every time a TMux message is received. TMux can then use it to expire the information it holds about the host after a suitable time, e.g., 1 minute โฐ.

Here's how this TTL time stamp works ๐Ÿ‘‘. When TMux is handed a segment to send to a host, it checks whether the time to live has expired. If the TTL hasn't expired, the segment goes out in a TMux message as normal. If the TTL has expired, the host is marked as being unable to TMux, but the segment is still sent as a TMux message (i.e., with the normal delay to allow other segments to be multiplexed). If the host really can't TMux anymore (a rare occurrence), this segment will time out and get retried by the transport provider, i.e., TCP. Because the host was marked as not able to TMux, the retry gets sent as a normal IP datagram. If the remote host can still TMux, it should send back TMux traffic (even if it has been rebooted), typically a TCP window update, and the local host will mark it as able to TMux again ๐Ÿฅณ. This approach avoids the performance problem of constantly dropping out of TMuxing and having to send probe messages. If the IP datagram to be sent is from UDP, the remote host may not send anything in reply. So for UDP this scheme isn't any better than just stopping TMux messages to the host, but it's also no worse ๐Ÿคทโ€โ™€๏ธ.


3. Protocol Behavior ๐Ÿงš

3.1. Transport Flow Control

TMux works as an extension to the IP datagram protocol, so it doesn't really mess with most flow control mechanisms ๐Ÿ’–. Those operate at the transport layer -- above TMux, so they're totally unaffected.

3.2. Connection Management

The concept of a connection belongs to certain transport protocols, not to IP or to TMux ๐Ÿฆ‹. So when a transport protocol using TMux needs connection management, it happens the same way it does for IP. In fact, the transport protocol isn't supposed to know TMux is being used at all ๐Ÿ™ˆ.

3.3 Multiplexed Message Construction

When a transport provider (e.g., TCP or UDP) sends a segment, TMux first removes the IP header (if present), then adds a TMux mini-header and the segment to the Multiplexed Message under construction for the host specified by the destination address of the segment ๐ŸŽ€.

When the first message to be transmitted gets placed into the Multiplexed Message under construction, a timer starts โฑ๏ธ. When the timer expires, the Multiplexed Message under construction is transmitted. This makes sure all the segments available before the timer expires get sent in a single Multiplexed Message โœจ. If the buffer holding the message fills up during construction, the Multiplexed Message is transmitted immediately ๐Ÿ”ฅ.

The delay time should be user configurable, and a reasonable time is 20 to 30 milliseconds ๐ŸŒธ. The time period should be long enough to give a reasonable chance of sending multiple segments, but not so long that the echo response time becomes a problem. This suggests the upper limit for the timer is probably 1/10th second. Timeouts are pretty expensive on many systems, so it is recommended that a single timer be used and that all TMux messages under construction get sent when the timer expires ๐Ÿ’….

Configuration options may also limit the number of included data segments or the maximum size of the Multiplexed Message before it's transmitted ๐Ÿ“. It's also suggested that larger segments (e.g., those over 700 octets) should be sent as standard IP datagrams and not multiplexed. This makes sure the delay caused by the TMux timer doesn't hold up those segments, for which it's inadvisable ๐Ÿ˜ญ. The size of the largest segments to be multiplexed should (if possible) be configurable.

4. Protocol Example ๐ŸŒˆ

This example shows a TMux message made up of three multiplexed segments ๐Ÿฆ‹:

A TCP segment consisting of a 20 octet TCP header, 5 octets of data and 3 octets of padding. So the length field is:

             Mini header + TCP header + data
           =     4       +     20     +  5
           =     29

The padding is not included in the length ๐Ÿ™ˆ.

A TCP segment consisting of a 20 octet TCP header and 4 octets of data. This segment doesn't need padding โœจ.

A UDP segment consisting of a 4 octet UDP header, 41 octets of data and 3 octets of padding ๐Ÿ’œ.

                     +-------------------------------+
                     |         Length = 29           |
                     |         (2 octets)            |
                     +-------------------------------+
                     |     Protocol ID = 6 (TCP)     |
                     +-------------------------------+
                     |          Checksum             |
                     +-------------------------------+
                     |         TCP Header            |
                     |        (20 octets)            |
                     +-------------------------------+
                     |          TCP data             |
                     |         (5 octets)            |
                     +-------------------------------+
                     |          Padding              |
                     |         (3 octets)            |
                     +-------------------------------+
                     |         Length = 28           |
                     |         (2 octets)            |
                     +-------------------------------+
                     |     Protocol ID = 6 (TCP)     |
                     +-------------------------------+
                     |          Checksum             |
                     +-------------------------------+
                     |         TCP Header            |
                     |        (20 octets)            |
                     +-------------------------------+
                     |          TCP data             |
                     |         (4 octets)            |
                     +-------------------------------+
                     |         Length = 49           |
                     |         (2 octets)            |
                     +-------------------------------+
                     |    Protocol ID = 17 (UDP)     |
                     +-------------------------------+
                     |          Checksum             |
                     +-------------------------------+
                     |         UDP Header            |
                     |         (4 octets)            |
                     +-------------------------------+
                     |          UDP data             |
                     |         (41 octets)           |
                     +-------------------------------+
                     |          Padding              |
                     |         (3 octets)            |
                     +-------------------------------+

5. Implementation Suggestion ๐Ÿญ

5.1 Maximum TMux Message Size

Section 3.3 mentions sending messages immediately if the limit on TMux message size is reached ๐Ÿ”ฅ. On systems where Path MTU Discovery (as per RFC 1191 [4]) has been implemented, this should be used to discover the maximum message size that can be transmitted, and that size should be used as the maximum TMux message size ๐Ÿ’–.

5.2 Deciding Which Segments to Multiplex

It's the sender's job to decide which segments should be TMux'd and which shouldn't ๐Ÿ‘‘. For example, segments sent by FTP should not normally be multiplexed ๐Ÿ™…โ€โ™€๏ธ. In lots of situations, it may be sensible to restrict multiplexing to just the sessions involved in interactive traffic (Telnet and Rlogin) by checking the source and destination TCP port numbers ๐ŸŽ€. However, if a segment that wouldn't normally be multiplexed is about to be sent and a TMux message is already under construction, the extra segment can be added to that TMux message, and this complete message should be sent immediately, rather than waiting for the timer to expire โฐโœจ.

6. Implementation notes ๐Ÿ› ๏ธ

okay bestie ๐ŸŽ€ these notes come from actual testing of the early TMux implementations โœจ. they're NOT technically part of the standard, but they SHOULD be followed if possible so everyone's implementations play nicely together ๐Ÿ’–

since the TMux mini-header doesn't have a TOS field ๐Ÿ™ƒ, only segments with the same IP TOS field SHOULD be packed into a single TMux message. most systems don't even use the TOS feature, so it's not a major restriction ๐Ÿ’…. where TOS is used, it MAY be desirable to hold several messages under construction for a host, one for each TOS value ๐ŸŒˆ.

segments with IP options SHOULD NOT be multiplexed ๐Ÿšซ.

only unicast addresses SHOULD be considered for multiplexing ๐ŸŽฏ.

segments addressed to the loopback address (127.0.0.1) are not candidates for multiplexing ๐Ÿ™…โ€โ™€๏ธ.

only segments with a source or destination port for an interactive session (i.e., Telnet and Rlogin) SHOULD be considered for multiplexing using TMux ๐Ÿ–ฅ๏ธโœจ.

if an error is discovered in a checksum of a TMux header, the rest of the message, starting there, is ignored ๐Ÿ˜ญ. if an unknown PROTOCOL field is discovered in any TMux header, this segment, and only this one, is ignored ๐Ÿซถ.

if the TMux implementation is continually sending TMux messages containing exactly one segment (because there is little traffic to multiplex), then TMux MAY be turned off. this implies that TMux MAY be switched off when there is no congestion. the vibe is "don't multiplex when there's nothing to multiplex" ๐Ÿ’€

to stop intermediate nodes from fragmenting and reconstructing TMux frames, implementations MAY want to set the "do not fragment" flag in the IP datagram of TMux messages ๐Ÿงš.

okay this one is spicy ๐Ÿ”ฅ. if host B receives a TMux ENQ message from host A, but doesn't have any data for host A, then it MAY also send back an ENQ message. HOWEVER, host A MAY send another ENQ message in response to this, which causes B to respond, and so on, and so on, forever ๐Ÿ˜ตโ€๐Ÿ’ซ. so if this facility is used, code MUST be included to prevent this looping behavior from happening. sending an ENQ in response to an ENQ is NOT RECOMMENDED, except in special circumstances ๐Ÿ™ˆ.

it is RECOMMENDED that the following aspects of the TMux protocol be user configurable ๐Ÿ“:

  • the maximum size of a segment that can be multiplexed by TMux.
  • the delay between the first segment being placed into the message under construction and the message being sent.

7. Security Considerations ๐Ÿ”

okay bestie, serious moment incoming ๐Ÿšจ. because TMux is basically an extension to IP, it doesn't have any more impact on site security than IP already does. security SHOULD be handled by the upper layer protocols ๐Ÿ›ก๏ธ.

now, this is the drama ๐Ÿ˜ฑ. some routers filter packets based on TCP port numbers. segments sent using TMux won't be subject to that filtering, because it obscures the TCP port number. HOWEVER, larger segments for the same TCP connection will still be sent as IP datagrams, so they WILL be subject to filtering, and that creates a potential problem ๐Ÿ’”.

so for this reason, any router that doesn't support TMux, but which does support this type of filtering, SHOULD NOT allow TMux messages through (in either direction) ๐Ÿšง. this makes both hosts think the other doesn't support TMux, so all segments get sent as IP datagrams, and the problem is eliminated โœ….

a better solution is for routers to actually understand the TMux protocol, inspect each of the multiplexed segments, and remove the segments that fail the filtering ๐Ÿ‘‘. that's the iconic move, periodt ๐Ÿ’….


8. References ๐Ÿ“š

[1] Cohen, D., and Postel, J., "Multiplexing Protocol", IEN 90, USC/Information Sciences Institute,, May 1979.

[2] Postel, J., "Internet Protocol", STD 5, RFC 791, USC/Information Sciences Institute, September 1981.

[3] Reynolds, J. and J. Postel, "Assigned Numbers", STD 2, RFC 1340, USC/Information Sciences Institute, March 1990.

[4] Mogul, J., and S. Deering, "Path MTU discovery", RFC 1191, DECWRL and Stanford University, November 1990.


9. Authors' Addresses ๐Ÿ’Œ

Peter Cameron

Peter Cameron
Xylogics International, Ltd.
Featherstone Rd.
Wolverton Mill
Milton Keynes
MK12 5RD
United Kingdom

Phone: +44  908 222112
Fax:   +44  908 222115
EMail: cameron@xylint.co.uk

David Crocker

David Crocker
Silicon Graphics, Inc.
2011 N. Shoreline Blvd.
P.O. Box 7311
Mountain View, CA 94039-7311
USA

Phone: +1 415 390 1804
Fax:   +1 415 962 8404
EMail: dcrocker@sgi.com

Danny Cohen

Danny Cohen
Myricom
325 N. Santa Anita Ave.
Arcadia, CA 91006
USA

Phone: +1 818 821 5555
EMail: Cohen@myricom.com

Jon Postel

Jon Postel
USC/Information Sciences Institute
4676 Admiralty Way
Marina del Rey, CA  90292-6695
USA

Phone: +1 310 822 1511
Fax:   +1 310 823 6714
EMail: Postel@ISI.EDU

10. Discussion List ๐Ÿ’ฌ

there's a discussion list for this protocol, which is called this for historical reasons ๐Ÿ›๏ธโœจ:

cmp-id@xylint.co.uk

requests to join the list SHOULD be sent to ๐Ÿ“ฉ:

cmp-id-request@xylint.co.uk

that's the whole tea, bestie ๐ŸŒˆ๐Ÿ’– thanks for reading all three parts ๐Ÿซถ

๐Ÿ“ฆ where this page comes from