Forum Discussion
Matthew_Gamble_
Nimbostratus
Mar 12, 2009TFTP Server?
Is it possible to write a simple TFTP server as an iRule to return static content? I see some examples for load balancing TFTP requests, but not for actually acting as a TFTP server. I have a very s...
James_Quinby_46
Mar 13, 2009Historic F5 Account
A little closer. This works with the pre-embedded blocks that natty76 is using in his. I've created an external file class called "tftp_file". Just need to do that bit. Two things left undone:
1. client mode switching (netascii v. binary)
2. client retries (resend block X)
when CLIENT_ACCEPTED {
log local0. "Client connected from [IP::client_addr]"
binary scan [UDP::payload] xc opcode
log local0. "Opcode is $opcode"
if { $opcode == 1 } {
binary scan [UDP::payload] xxa* string
log local0. "String is $string"
set stringlist [split $string \000]
set file [lindex $stringlist 0]
set mode [lindex $stringlist 1]
log local0. "File is $file, Mode is $mode"
if { $mode != "octet" && $mode != "netascii" } {
reject
} else {
log local0. "Send the file!"
set blockdata(1) [binary format H* 000300014620494e495452442e494d473b3120202020202020202020202020202020202020\
20202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020\
202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202\
020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020\
202009696e697472642e696d670d0a4620524541444d452e3b312020202020202020202020202020202020202020202020202020202020202020\
20202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020\
20202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020\
20202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202009524541444d45\
0d0a4620564d4c494e555a2e3b3120202020202020202020202020202020202020202020202020202020202020202020202020202020202020202\
020202020202020202020202020]
set blockdata(2) [binary format H* 0003000220202020202020202020202020202020202020202020202020202020202020202020\
2020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020\
202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202009766d6c696e757a0d0a]
UDP::respond $blockdata(1)
UDP::respond $blockdata(2)
}
} else { reject }
}Help guide the future of your DevCentral Community!
What tools do you use to collaborate? (1min - anonymous)Recent Discussions
Related Content
DevCentral Quicklinks
* Getting Started on DevCentral
* Community Guidelines
* Community Terms of Use / EULA
* Community Ranking Explained
* Community Resources
* Contact the DevCentral Team
* Update MFA on account.f5.com
Discover DevCentral Connects
