rfc-2347

TFTP Option Extension

G. Malkin, A. Harkin
date1998-05 streamLegacy statusDRAFT STANDARD pages7 canonicalhttps://www.rfc-editor.org/rfc/rfc2347 doi10.17487/RFC2347 errataview
The Trivial File Transfer Protocol is a simple, lock-step, file transfer protocol which allows a client to get or put a file onto a remote host. This document describes a simple extension to TFTP to allow option negotiation prior to the file transfer. [STANDARDS-TRACK]

obsoletes

updates

Extracted elements (15)

design-rationale §Introduction

The option negotiation mechanism is backward-compatible: options are appended to existing RRQ/WRQ packet formats so legacy servers silently ignore them and fall back to standard TFTP behavior. The request-respond-acknowledge sequence mirrors TFTP's own lock-step design to keep the mechanism simple.

interoperability-note §Negotiation Protocol

If a server does not support option negotiation, it will likely ignore appended options and return a DATA packet (for RRQ) or ACK packet (for WRQ), establishing normal TFTP data transfer without options. A client may retry a failed request without options to handle servers that treat extra data in the request as an error.

normative-requirement §Negotiation Protocol MUST

An option may only be specified once in a request. The order of options is not significant.

normative-requirement §Negotiation Protocol MUST

An option not acknowledged by the server must be ignored by the client and server as if it were never requested. If multiple options were requested, the client must use those options which were acknowledged and must not use those which were not acknowledged.

normative-requirement §Negotiation Protocol SHOULD

If the client rejects the server's OACK, it must send an ERROR packet with error code 8 to terminate the transfer. Similarly, if the client receives an OACK containing an unrequested option, it should respond with ERROR code 8 and terminate.

normative-requirement §Negotiation Protocol MUST

If the transfer was initiated with a Read Request and the client accepts the OACK, the client sends an ACK with data block number set to 0 to confirm the negotiated values. If initiated with a Write Request, the client begins the transfer with the first DATA packet using the negotiated values.

normative-requirement §Negotiation Protocol MUST

Once a client acknowledges an OACK with an appropriate non-error response, that client has agreed to use only the options and values returned by the server; the server cannot request an option, it can only respond to them.

normative-requirement §Negotiation Protocol SHOULD NOT

Options which the server does not support should be omitted from the OACK; they should not cause an ERROR packet to be generated. If the value of a supported option is invalid, the option specification determines whether the server omits it, proposes an alternate value, or sends ERROR code 8.

normative-requirement §Negotiation Protocol MUST NOT

The server must not include in the OACK any option which was not specifically requested by the client; only the client may initiate option negotiation.

protocol-element §Packet Formats

A new packet type, Option Acknowledgment (OACK), opcode 6, is defined. The OACK contains the options and values the server accepts, copied from the original request: |6|opt1|0|value1|0|...|optN|0|valueN|0|. Acknowledged values may differ from requested values if the option specification permits.

protocol-element §Packet Formats

Error code 8 is newly defined to indicate that a transfer should be terminated due to option negotiation failure. It is used by either the client or server to reject an OACK or an invalid option value.

protocol-element §Packet Formats

TFTP option negotiation is initiated by appending option/value pairs to Read Request (opcode 1) or Write Request (opcode 2) packets. Options are NULL-terminated, case-insensitive ASCII strings; the order is not significant. The maximum size of a request packet is 512 octets.

security-consideration §Security Considerations

The basic TFTP protocol has no security mechanism, which is why it has no rename, delete, or file overwrite capabilities. This option extension document does not add any security to TFTP, nor does it introduce additional security risks beyond those already present in TFTP.

security

state-machine §Negotiation Protocol

For a Read Request with options, three server responses are possible: OACK (options accepted), DATA (options ignored, normal transfer begins), or ERROR (request denied). For a Write Request with options, the three responses are: OACK (options accepted), ACK (options ignored, normal transfer begins), or ERROR.

wire-format §Packet Formats

Options are encoded after the mode field in RRQ/WRQ packets as a sequence of NULL-terminated opt/value pairs: |opc|filename|0|mode|0|opt1|0|value1|0|...|optN|0|valueN|0|. Each field is case-insensitive ASCII and NULL-terminated.