MavEtJu's Distorted View of the World

New tftp / tftpd implemetation for FreeBSD

Posted on 2008-01-31 20:00:00
Tags: Networking, tftp, FreeBSD

It all started when we got some new routers, which told me the following when trying to upload configuration or download images from it: The TFTP server doesn't support the blocksize option.

My curiousity was triggered, it took me some reading of RFCs and other documentation to find out what was possible and what could be done. Was plain TFTP very simple in its handshake, TFTP with options was kind of messy because of its backwards capability: The first packet returned could either be an acknowledgement of options, or the first data packet.

Going through the source code of src/libexec/tftpd and going through the code of src/usr.bin/tftp showed that there was a lot of duplicate code, and the addition of options would only increase the amount of duplicate code. After all, both the client and the server can act as a sender and receiver.

At the end, it ended up with a nearly complete rewrite of the tftp client and server. It has been tested against the following TFTP clients and servers:

It supports the following RFCs:

It supports the following unofficial TFTP Options as described at

From the tftp program point of view the following things are changed:

If you try this tftp/tftpd implementation, please let me know if it works (or doesn't work) and against which implementaion so I can get a list of confirmed working systems.

For now, the new implementation can be found at as a port in net/freebsd-tftp until it has been imported back into the FreeBSD base system.

| Share on Facebook | Share on Twitter
From: Yuri Pankov
Posted on: 2008-02-02 02:23:23
CommentI've tested tftpd server with Vanguard 6520 (ancient) and more recent 320, 6450 and 7330 routers (, as well as several 3com switches (older SuperStack 3 Switch 4400 and newer 4500 and SuperStack 3 Switch 3226) - no problems with configuration download/upload.

One note though - tftpd[838]: write request for 7330.conf: error 102 looks misinformative, all documentation that I have seen specifies TFTP errors in 0-7 range, not 10x (sorry if I'm mistaken).


Leave a comment
Back to the main page