Skip to main content

Rule: Prohibit new requests before completing old negotiation

A TELNET implementation MUST NOT initiate a new WILL/WONT/DO/DONT request about an option that is under negotiation, i.e., for which it has already made such a request and not yet received a response.

DISCUSSION:

It is unclear from RFC 854 whether or not a TELNET implementation may allow new requests about an option that is currently under negotiation; it certainly seems limiting to prohibit "option typeahead". Unfortunately, consider the following:

LOOP EXAMPLE 2

Suppose an option is disabled, and we decide in quick succession to enable it, disable it, and reenable it. We send WILL WONT WILL and at the end remember that we are negotiating. The other side agrees with DO DONT DO. We receive the first DO, enable the option, and forget we have negotiated. Now DONT DO are coming through the network and both sides have forgotten they are negotiating; consequently we loop.

(All possible TELNET loops eventually degenerate into the same form, where WILL WONT [or WONT WILL, or WILL WONT WILL WONT, etc.] go through the network while both sides think negotiation is over; the response is DO DONT and we loop forever. TELNET implementors are encouraged to implement any option that can detect such a loop and cut it off; e.g., a method of explicitly differentiating requests from acknowledgments would be sufficient. No such option exists as of February 1990.)

This particular case is of considerable practical importance: most combinations of existing user-server TELNET implementations do enter an infinite loop when asked quickly a few times to enable and then disable an option. This has taken on an even greater importance with the advent of LINEMODE [4], because LINEMODE is the first option that tends to generate such rapidly changing requests in the normal course of communication. It is clear that a new rule is needed.

One might try to prevent the several-alternating-requests problem by maintaining a more elaborate state than YES/NO/WANTwhatever, e.g., a state that records all outstanding requests. Dave Borman has proposed an apparently working scheme [2] that won't blow up if both sides initiate several requests at once, and that seems to prevent option negotiation loops; complete analysis of his solution is somewhat difficult since it means that TELNET can no longer be a finite-state automaton. He has implemented his solution in the latest BSD telnet version [5]; as of May 1989, he does not intend to publish it for others to use [3].

Here the author decided to preserve TELNET's finite-state property, for robustness and because the result can be easily proven to work. Hence the above rule.

A more restrictive solution would be to buffer all data and do absolutely nothing until the response comes back. There is no apparent reason for this, though some existing TELNET implementations do so anyway at the beginning of a connection, when most options are negotiated.