RFC 2348
TFTP Blocksize Option
RFC 2348: TFTP Blocksize Option ๐
- Network Working Group ๐ธ
- RFC number: 2348
- Authors: G. Malkin (Bay Networks) and A. Harkin (Hewlett Packard Co.) ๐ซถ
- Category: Standards Track โจ
- Date: May 1998 ๐
- Updates: RFC 1350 ๐ง
- Obsoletes: RFC 1783 ๐
Status of This Memo ๐
okay so this doc is a standards track protocol for the whole Internet community, and it's basically inviting everyone to discuss it and suggest improvements ๐. If you want the current standardization state of this protocol, check the latest edition of the "Internet Official Protocol Standards" (STD 1) ๐. Distribution of this memo is unlimited, so share it with everyone ๐ฆ.
Copyright Notice ๐
Copyright (C) The Internet Society (1998). All Rights Reserved.
Abstract โจ
okay so TFTP, the Trivial File Transfer Protocol [1], is a super simple, lock-step file transfer protocol that lets a client get a file from a remote host or put one onto it ๐. One of its main jobs is booting diskless nodes on a Local Area Network ๐ป. It's built this simple on purpose so it fits in a small node's limited ROM space ๐ง. BUT the 512-octet blocksize is not the most efficient choice on a LAN where the MTU may be 1500 octets or greater ๐ญ.
So this document describes a TFTP option that lets the client and server negotiate a blocksize that actually suits the network medium ๐ฅ. The TFTP Option Extension mechanism is described in [2] ๐.
Blocksize Option Specification ๐
The TFTP Read Request or Write Request packet gets a makeover to include the blocksize option, and it looks like this (note: everything except "opc" is NULL-terminated ๐ ):
+-------+---~~---+---+---~~---+---+---~~---+---+---~~---+---+
| opc |filename| 0 | mode | 0 | blksize| 0 | #octets| 0 |
+-------+---~~---+---+---~~---+---+---~~---+---+---~~---+---+
Here's what each field does, bestie ๐ซถ:
- opc: the opcode. It's a 1 for Read Requests or a 2 for Write Requests, as defined in [1] ๐ข.
- filename: the name of the file being read or written, as defined in [1] ๐.
- mode: the transfer mode, which is "netascii", "octet", or "mail", as defined in [1] ๐ธ.
- blksize: the Blocksize option itself, written as "blksize" (case in-sensitive) ๐.
- #octets: the number of octets in a block, written in ASCII. Valid values range between "8" and "65464" octets, inclusive ๐ฆ. The blocksize counts only the data octets, so it does NOT include the four octets of TFTP header ๐.
Here's an example packet ๐ง:
+-------+--------+---+--------+---+--------+---+--------+---+
| 1 | foobar | 0 | octet | 0 | blksize| 0 | 1428 | 0 |
+-------+--------+---+--------+---+--------+---+--------+---+
This is a Read Request for the file named "foobar", in octet (binary) transfer mode, with a block size of 1428 octets. That's the Ethernet MTU minus the TFTP, UDP and IP header lengths, so it's giving perfectly sized ๐ โจ.
If the server is cool with the blocksize option, it sends an Option Acknowledgment (OACK) back to the client ๐ค. The value it specifies must be less than or equal to the value the client asked for ๐. The client then has to either use the size from the OACK, or send an ERROR packet with error code 8 to end the transfer ๐.
The rules for finding the final packet are the same as in [1] ๐. The final packet is any data packet whose data length is less than the negotiated blocksize ๐. If the blocksize is bigger than the amount of data being transferred, the first packet is already the final one ๐. And if the amount of data is an exact multiple of the blocksize, an extra data packet with no data gets sent to end the transfer ๐.
Proof of Concept ๐ฅ
Okay the receipts! The team ran performance tests on the prototype implementation with a bunch of different block sizes ๐. The tests ran on a lightly loaded Ethernet, between two HP-UX 9000 machines, in "octet" mode, on 2.25MB files ๐ป. The average (5x) transfer times for paths with (g-time) and without (n-time) an intermediate gateway are graphed below ๐:
|
37 + g
|
35 +
|
33 +
|
31 +
|
29 +
|
27 +
| g blocksize n-time g-time
25 + --------- ------ ------
s | n 512 23.85 37.05
e 23 + g 1024 16.15 25.65
c | 1428 13.70 23.10
o 21 + 2048 10.90 16.90
n | 4096 6.85 9.65
d 19 + 8192 4.90 6.15
s |
17 + g
| n
15 +
| n
13 +
|
11 + n
| g
9 +
|
7 + n
| g
5 + n
"
0 +------+------+--+---+------+------+---
512 1K | 2K 4K 8K
1428
blocksize (octets)
Here's the comparison of transfer times (without a gateway) between the standard 512-octet blocksize and the negotiated ones ๐งฎ:
1024 2x -32%
1428 2.8x -42%
2048 4x -54%
4096 8x -71%
8192 16x -80%
As predicted, transfer time goes down as the blocksize goes up ๐โจ. Why? Fewer packets get sent ๐ฆ. For example, going from 512 to 1024 octets doesn't just halve the number of data packets, it also halves the number of acknowledgement packets, along with how many times the data sender has to wait for an ACK ๐. There's also a secondary win from reducing the per-packet framing and processing overhead ๐ง.
Okay but the catch: if the blocksize goes past the path MTU, IP fragmentation and reassembly start adding overhead ๐ญ. That gets more noticable the more gateways are in the path ๐.
Security Considerations ๐
The basic TFTP protocol has no security mechanism ๐จ. That's exactly why it has no rename, delete, or file overwrite capabilities ๐ . This document does NOT add any security to TFTP ๐ฌ. However, the specified extensions do not add any additional security risks ๐ซถ, so we're at least not making things worse ๐.
References ๐
[1] Sollins, K., "The TFTP Protocol (Revision 2)", STD 33, RFC 1350, October 1992.
[2] Malkin, G., and A. Harkin, "TFTP Option Extension", RFC 2347, May 1998.
Authors' Addresses ๐
Gary Scott Malkin
Bay Networks
8 Federal Street
Billerica, MA 10821
Phone: (978) 916-4237
EMail: gmalkin@baynetworks.com
Art Harkin
Networked Computing Division
Hewlett-Packard Company
19420 Homestead Road MS 43LN
Cupertino, CA 95014
Phone: (408) 447-3755
EMail: ash@cup.hp.com
Full Copyright Statement ๐ธ
Copyright (C) The Internet Society (1998). All Rights Reserved.
This document and translations of it may be copied and furnished to others, and derivative works that comment on or otherwise explain it or assist in its implementation may be prepared, copied, published and distributed, in whole or in part, without restriction of any kind, provided that the above copyright notice and this paragraph are included on all such copies and derivative works. However, this document itself may not be modified in any way, such as by removing the copyright notice or references to the Internet Society or other Internet organizations, except as needed for the purpose of developing Internet standards in which case the procedures for copyrights defined in the Internet Standards process must be followed, or as required to translate it into languages other than English.
The limited permissions granted above are perpetual and will not be revoked by the Internet Society or its successors or assigns.
This document and the information contained herein is provided on an "AS IS" basis and THE INTERNET SOCIETY AND THE INTERNET ENGINEERING TASK FORCE DISCLAIMS ALL WARRANTIES, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTY THAT THE USE OF THE INFORMATION HEREIN WILL NOT INFRINGE ANY RIGHTS OR ANY IMPLIED WARRANTIES OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. ๐
๐ฆ where this page comes from
- ietf: rfc2348 1998-05
- ๐ girlified by claude-haiku-5-5 on : a language model's rewrite of the original, under its terms