RFC 7440

TFTP Windowsize Option

πŸ“… published January 2015, from ietf

RFC 7440: TFTP Windowsize Option πŸŽ€

Title block tea β˜•

  • Series: Internet Engineering Task Force (IETF) 🌸
  • Number: RFC 7440
  • Author: P. Masotta, Serva 🧚
  • Category: Standards Track ✨
  • Date: January 2015 πŸ“…
  • ISSN: 2070-1721
  • Obsoletes / Updates: The header has no "Obsoletes" or "Updates" line, so it doesn't list any. πŸ™ˆ

Abstract

okay so TFTP ("Trivial File Transfer Protocol", RFC 1350) is a super simple, lockstep file transfer protocol that lets a client get or put a file onto a remote host πŸ’Ύ. One of its biggest jobs is helping nodes boot up from a Local Area Network (LAN) at the very start πŸ₯Ή. People use it there because it's so easy to implement, but the lockstep thing kinda limits throughput on a LAN 😭.

This doc describes a TFTP option that lets the client and server negotiate a window size, which is a bunch of consecutive blocks sent before anyone waits for a reply. It's the upgrade to that single-block lockstep vibe πŸ¦‹. The option mechanism it uses comes from "TFTP Option Extension" (RFC 2347) πŸ’….

Status of This Memo

This is an Internet Standards Track document. ✨

This document is a product of the Internet Engineering Task Force (IETF). It represents the consensus of the IETF community. It has received public review and has been approved for publication by the Internet Engineering Steering Group (IESG). Further information on Internet Standards is available in Section 2 of RFC 5741. πŸŽ€

Info about the current status of this document, any errata, and how to give feedback on it can be found at http://www.rfc-editor.org/info/rfc7440. πŸ”₯

Copyright (c) 2015 IETF Trust and the persons identified as the document authors. All rights reserved. 🌈

This document is subject to BCP 78 and the IETF Trust's Legal Provisions Relating to IETF Documents (http://trustee.ietf.org/license-info) in effect on the date of publication of this document. Please review these documents carefully, because they describe your rights and restrictions with respect to this document. Code Components extracted from this document must include Simplified BSD License text as described in Section 4.e of the Trust Legal Provisions, and they're provided without warranty as described in the Simplified BSD License. πŸ“œ


Table of Contents πŸ—‚οΈ

   1. Introduction ....................................................2
   2. Conventions Used in This Document ...............................3
   3. Windowsize Option Specification .................................3
   4. Traffic Flow and Error Handling .................................4
   5. Proof of Concept and Windowsize Evaluation ......................6
   6. Congestion and Error Control ....................................7
   7. Security Considerations .........................................8
   8. References ......................................................9
      8.1. Normative References .......................................9
   Author's Address ...................................................9

1. Introduction ✨

TFTP is basically unused for Internet transfers these days, but it's still massively used in network boot and installation setups, including EFI (Extensible Firmware Interface) πŸ–₯️. Its naturally low transfer rate has been partly fixed by the blocksize negotiated extension [RFC2348] 🩹. With that method, the original 512-byte block limit is, in practice, replaced in Ethernet environments by blocks no bigger than 1468 Bytes, so IP block fragmentation gets avoided 🧩.

That still isn't enough when you're moving big files, like the initial ramdisk of Linux distributions or the PE images used in network installations by Microsoft WDS/MDT/SCCM 😭. TFTP is nowhere near extinct, so this document presents a negotiated extension, under the terms of "TFTP Option Extension" [RFC2347], that gets transfer rates comparable to modern file transfer protocols πŸš€πŸ’–.

2. Conventions Used in This Document πŸ“–

The key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT", "SHOULD", "SHOULD NOT", "RECOMMENDED", "NOT RECOMMENDED", "MAY", and "OPTIONAL" in this document are to be interpreted as described in [RFC2119].

Quick heads-up πŸ’…: these words only carry that meaning when they're in ALL CAPS. Lowercase uses don't carry the significance given in RFC 2119 πŸ™…β€β™€οΈ.

3. Windowsize Option Specification πŸŽ€

The TFTP Read Request or Write Request packet gets modified to include the windowsize option, like this. Note that all fields except opc MUST be ASCII strings followed by a single-byte NULL character 🫢.

      2B     string   1B   string   1B     string     1B   string   1B
   +-------+---~~---+----+---~~---+----+-----~~-----+----+---~~---+----+
   |  opc  |filename|  0 |  mode  |  0 | windowsize |  0 | #blocks|  0 |
   +-------+---~~---+----+---~~---+----+-----~~-----+----+---~~---+----+

opc : The opcode field holds either a 1 for Read Requests or a 2 for Write Requests, as defined in [RFC1350] πŸ”’.

filename : The name of the file to be read or written, as defined in [RFC1350] πŸ“.

mode : The transfer mode: "netascii", "octet", or "mail", as defined in [RFC1350] 🧾.

windowsize : The windowsize option, "windowsize" (case insensitive) πŸͺŸ.

#blocks : The base-10 ASCII string representation of how many blocks are in a window. The valid values range MUST be between 1 and 65535 blocks, inclusive. The windowsize refers to the number of consecutive blocks transmitted before stopping and waiting to receive the acknowledgment of the last block sent 🀩.

For example:

+------+--------+----+-------+----+------------+----+----+----+
|0x0001| foobar |0x00| octet |0x00| windowsize |0x00| 16 |0x00|
+------+--------+----+-------+----+------------+----+----+----+

This is a Read Request for the file named "foobar" in octet transfer mode with a windowsize of 16 blocks. (The blocksize option isn't negotiated in this example, so the default of 512 Bytes per block applies πŸ“.)

If the server is willing to accept the windowsize option, it sends an Option Acknowledgment (OACK) to the client πŸ™Œ. The specified value MUST be less than or equal to the value the client specified. Then the client MUST either use the size from the OACK, or send an ERROR packet with error code 8 to terminate the transfer πŸ’€.

The rules for finding the final packet are unchanged from [RFC1350] and [RFC2348] 🏁.

A data window with fewer blocks than the negotiated windowsize is the final window. If the windowsize is greater than the amount of data being transferred, the first window is the final window 🌸.

4. Traffic Flow and Error Handling πŸ¦‹

The next diagram shows a section of the traffic flow between the Data Sender (DSND) and the Data Receiver (DRCV) on a generic windowsize TFTP file transfer 🎬.

The DSND MUST cyclically send the DRCV the agreed windowsize of consecutive data blocks before normally stopping to wait for the ACK of the transferred window πŸ”. The DRCV MUST send the DSND the ACK of the last data block in the window, to confirm a successful window reception 🫑.

If an expected ACK doesn't reach the DSND in time (timeout), the last received ACK SHALL set the beginning of the next windowsize data block window to be sent ⏰.

If there's a data block sequence error, the DRCV SHOULD notify the DSND by sending an ACK for the last data block it correctly received 🚨. The notified DSND SHOULD send a new data block window, and its beginning MUST be set based on the ACK received out of sequence πŸ”„.

Traffic with windowsize = 1 MUST be equivalent to traffic specified by [RFC1350] 🧸.

For normative traffic not specifically covered in this section, please refer to [RFC1350] and its updates πŸ“š.

         [ DRCV ]      <---traffic--->      [ DSND ]
           ACK#      ->               <-   Data Block#   window block#
                              ...
                              <-           |DB n+01|          1
                              <-           |DB n+02|          2
                              <-           |DB n+03|          3
                              <-           |DB n+04|          4
         |ACK n+04|           ->
                              <-           |DB n+05|          1
                       Error |<-           |DB n+06|          2
                              <-           |DB n+07|          3
         |ACK n+05|           ->
                              <-           |DB n+06|          1
                              <-           |DB n+07|          2
                              <-           |DB n+08|          3
                              <-           |DB n+09|          4
         |ACK n+09|           ->
                              <-           |DB n+10|          1
                       Error |<-           |DB n+11|          2
                              <-           |DB n+12|          3
         |ACK n+10|           ->| Error
                              <-           |DB n+13|          4
                                          - timeout -
                              <-           |DB n+10|          1
                              <-           |DB n+11|          2
                              <-           |DB n+12|          3
                              <-           |DB n+13|          4
         |ACK n+13|           ->
                              ...

                 Section of a Windowsize = 4 TFTP Transfer
                    Including Errors and Error Recovery

5. Proof of Concept and Windowsize Evaluation ✨

okay so we built a prototype and ran performance tests on it πŸ”₯ we tried a bunch of windowsizes with a fixed blocksize of 1456 bytes. The setup was a lightly loaded Gigabit Ethernet, two Toshiba Tecra Core 2 Duo 2.2 Ghz laptops, "octet" mode, and a 180 MByte file πŸ’»

              ^
              |
          300 +
      Seconds |                           windowsize | time (s)
              |                           ----------   ------
              |     x                         1         257
          250 +                               2         131
              |                               4          76
              |                               8          54
              |                              16          42
          200 +                              32          38
              |                              64          35
              |
              |
          150 +
              |
              |           x
              |
          100 +
              |
              |                 x
              |
           50 +                       x
              |                             x
              |                                   x     x
              |
            0 +-//--+-----+-----+-----+-----+-----+-----+-->
                    1     2     4     8    16    32    64

                   Windowsize (in Blocks of 1456 Bytes)

the chart is giving main character energy πŸ“ˆπŸ’– Comparatively, the same 180 MB transfer over a drive mapped on Server Message Block (SMB) / Common Internet File System (CIFS), in the same scenario, took 23 seconds πŸ™ˆ

Now the comparison of transfer times (without a gateway) between the standard lockstep schema and the negotiated windowsizes πŸ’…

            Windowsize  |  Time Reduction (%)
            ----------     -----------------
                 1              -0%
                 2             -49%
                 4             -70%
                 8             -79%
                16             -84%
                32             -85%
                64             -86%

the transfer time drops once you use a windowed schema πŸš€ the reason is that there are fewer of the required synchronous acknowledgements being exchanged, so it's literally less waiting around 😭🫢

Choosing the right windowsize depends on the underlying networking technology and topology, and probably other factors too 🌈 Operators SHOULD test various values and SHOULD be conservative when selecting a windowsize value, because the table and chart above show there's a point where raising the windowsize gives you diminishing returns πŸ’€ so don't just go max mode bestie πŸ‘‘

6. Congestion and Error Control πŸ›‘οΈ

from a congestion control (CC) standpoint, the number of blocks in a window doesn't pose an intrinsic threat to the ability of intermediate devices to signal congestion through drops πŸ¦‹ The rate at which TFTP UDP datagrams are sent SHOULD follow the CC guidelines in Section 3.1 of [RFC5405].

from an error control standpoint, [RFC1350] and its subsequent updates don't specify a circuit breaker (CB), but existing implementations have always chosen to fail under certain circumstances 😬 Implementations SHOULD always set a maximum number of retries for datagram retransmissions, imposing an appropriate threshold on error recovery attempts. After that threshold, a transfer SHOULD always be aborted to prevent pathological retransmission conditions 🚫

Here's an implementation example scaled for an Ethernet environment (1 Gbit/s, MTU=1500) 🧚 you'd set:

windowsize = 8
blksize = 1456
maximum retransmission attempts per block/window = 6
timeout between retransmissions = 1 S
minimum inter-packet delay = 80 uS

Implementations might well choose other values based on expected and/or tested operating conditions 🌸

7. Security Considerations πŸ”

TFTP includes no login or access control mechanisms. Care must be taken when using TFTP for file transfers where authentication, access control, confidentiality, or integrity checking are needed. ngl this is the part where we all need to pay attention 😭 Those security services could be supplied above or below the layer at which TFTP runs.

Care must also be taken with the rights granted to a TFTP server process, so you don't violate the security of the server's file system πŸ—‚οΈ TFTP is often installed with controls so that only files with public read access are available via TFTP. Listing, deleting, renaming, and writing files via TFTP are also typically disallowed πŸ™…β€β™€οΈ TFTP file transfers are NOT RECOMMENDED where the inherent protocol limitations could raise insurmountable liability concerns. πŸ’€

TFTP includes no protection against an on-path attacker 😱 Care must be taken when controlling windowsize values according to the data sender, data receiver, and network environment capabilities. TFTP service is frequently tied to bootstrap and initial provisioning activities, so servers in that environment are in a position to impose device- or network-specific throughput limitations as appropriate πŸ› οΈ

This document does not add any security controls to TFTP πŸ₯² however, the specified extension doesn't pose additional security risks either 🫢

8. References πŸ“š

8.1. Normative References

[RFC1350]   Sollins, K., "The TFTP Protocol (Revision 2)", STD 33,
            RFC 1350, July 1992,
            <http://www.rfc-editor.org/info/rfc1350>.

[RFC2347]   Malkin, G. and A. Harkin, "TFTP Option Extension", RFC
            2347, May 1998, <http://www.rfc-editor.org/info/rfc2347>.

[RFC2348]   Malkin, G. and A. Harkin, "TFTP Blocksize Option", RFC
            2348, May 1998, <http://www.rfc-editor.org/info/rfc2348>.

[RFC5405]   Eggert, L. and G. Fairhurst, "Unicast UDP Usage
            Guidelines for Application Designers", BCP 145, RFC 5405,
            November 2008, <http://www.rfc-editor.org/info/rfc5405>.

[RFC2119]   Bradner, S., "Key words for use in RFCs to Indicate
            Requirement Levels", BCP 14, RFC 2119, March 1997,
            <http://www.rfc-editor.org/info/rfc2119>.

Author's Address πŸ’–

Patrick Masotta
Serva

EMail: patrick.masotta.ietf@vercot.com
URI:   http://www.vercot.com/~serva/

and that's the whole RFC, bestie πŸŒˆβœ¨πŸŽ€

πŸ“¦ where this page comes from