TFTP Trivial File Transfer Protocol

Transkrypt

TFTP Trivial File Transfer Protocol
TFTP
Trivial File Transfer Protocol
References:
RFC 783, 1350
1
TFTP Usage and Design

Transfer plików pomiędzy procesami.

Minimalna nadmiarowość (brak
autoryzacji)

Zaprojektowany dla UDP (może
wykorzystywać jednak różne prtotkoły
warstwy transportowej).
2
TFTP Usage and Design
(cont.)

Łatwy do implementacji

Mały – możliwy do zawarcia w „firmware”

Używany do transferu plików (tam gdzie nie
wymagamy autoryzacji) – często dla
przekazania plików startowych,
konfiguracyjnych)
3
Diskless Workstation Booting 1
The call for help
Help! I don't know who I am!
My Ethernet address is:
4C:23:17:77:A6:03
RARP
Diskless
Workstation
4
Diskless Workstation Booting 2
The answer from the all-knowing
I know all! You are to be
know as: 128.113.45.211
RARP
Server
Diskless
Workstation
RARP REPLY
5
Diskless Workstation Booting 3
The request for instructions
I need the file named
boot-128.113.45.211
Diskless
Workstation
TFTP Request (Broadcast)
6
Diskless Workstation Booting 4
The dialog
here is part 1
I got part 1
TFTP
Server
here is part 2
Diskless
Workstation
boot file
TFTP File Transfer
7
TFTP Protocol
5 typów komunikatów:
– Read request
– Write request
– Data
– ACK (acknowledgment)
– Error
8
Messages

Każdy jest niezależnym datagramem
UDP

Każdy ma 2 bt opcode ( bytes)

Reszta zależy od „opcode”.
9
Message Formats
OPCODE
FILENAME
OPCODE BLOCK#
0
MODE
0
DATA
OPCODE BLOCK#
OPCODE BLOCK#
2 bytes
2 bytes
ERROR MESSAGE
0
10
Read Request
01
filename
0
mode
0
null terminated ascii string null terminated ascii string
containing name of file
containing transfer mode
2 byte opcode
network byte order
variable length fields!
11
Write Request
02
filename
0
mode
0
null terminated ascii string null terminated ascii string
containing name of file
containing transfer mode
2 byte opcode
network byte order
variable length fields!
12
TFTP Data Packet
03
block #
data 0 to 512 bytes
2 byte block number
network byte order
2 byte opcode
network byte order
all data packets have 512 bytes
except the last one.
13
TFTP Acknowledgment
04
2 byte opcode
network byte order
block #
2 byte block number
network byte order
14
TFTP Error Packet
05
errcode
2 byte opcode
network byte order
errstring
0
null terminated ascii error string
2 byte error code
network byte order
15
TFTP Error Codes
0 - not defined
1 - File not found
2 - Access violation
3 - Disk full
4 - Illegal TFTP operation
5 - Unknown port
6 - File already exists
7 - No such user
16
TFTP transfer modes

“netascii” : dla transferu plików
tekstowych.
– obie strony komunikacji są odpowiedzialne
za konwersję do/z forrmatu netascii.

“octet” : dla transferu plików binarnych.
– bez żadnej translacji.
17
Lost Data Packets Original Protocol Specification

Nadawca używa „timeout” z
retransmisją.
– nadawcą może być zrówno klient jak i
serwer.
Duplikowane pakiety danych muszą być
rozpoznane i ACK retransmitowane
 Oryginalny protokół jest podatny na
"sorcerer’s apprentice syndrome".

18
Sorcerer’s Apprentice Syndrome
send DATA[n]
(time out)
retransmit DATA[n]
receive ACK[n]
send DATA[n+1]
receive ACK[n] (dup)
send DATA[n+1]
(dup)
...
receive DATA[n]
send ACK[n]
receive DATA[n] (dup)
send ACK[n] (dup)
receive DATA[n+1]
send ACK[n+1]
receive DATA[n+1] (dup)
send ACK[n+1] (dup)
19
The Fix

Nadawca nie powinien powtórnie
wysyłać pakietów danych w odpowiedzi
na zduplikowane ACK.

Jeżeli nadawca otrzymuje ACK[n] – nie
wysyła DATA[n+1] jezęli ACK było
zduplikowane
20
Issues
Problem plików większych niż 65535 blokiare
65536 blocks x 512 bytes/block =
33,554,432 bytes.

RFC nie rozstrzyga tej kwestii!
21

Podobne dokumenty