[U-Boot] [PATCH 0/6] TFTP server

Luca Ceresoli luca.ceresoli at comelit.it
Thu Apr 14 17:52:51 CEST 2011


This patch series adds to U-Boot the ability to receive a file via TFTP acting
as a server, not a client.

The implementation is kept simple:
- receive only (accept WRQ from remote client, not RRQ);
- the Filename in the WRQ is ignored: the destination is always a user-provided
  memory location;
- binary transfers only: the Mode in the WRQ is ignored; this is allowed by
  RFC1350 (section 5);
- no TFTP Option Extensions (RFC2347);
- no TFTP multicast.

The implementation is discussed here:
http://lists.denx.de/pipermail/u-boot/2011-April/090405.html

Once it has started, the server is stopped like the client is: on a complete
file reception, Ctrl-C and after waiting 5 seconds for 10 times.

The first four patches are preliminary cleanups and extensions to the current
code. Most important, the second patch adds to incoming packet handlers an
argument containing the source IP address, and has impact in many places in
the networking code.

The fifth patch implements the core TFTP server.

The last patch adds a user command to launch the server.

A note about checkpatch.pl.
Some of these patches do have checkpatch errors and/or warnings. These are all
issues that were already present in the pre-existing code.
An example from patch 2:

 static void
-PingHandler (uchar * pkt, unsigned dest, unsigned src, unsigned len)
+PingHandler (uchar * pkt, unsigned dest, IPaddr_t sip, unsigned src,
+unsigned len)
 {

Raises:
* ERROR: "foo * bar" should be "foo *bar"
* WARNING: space prohibited between function name and open parenthesis '('

As I didn't touch the pointer parameters nor the stuff before the '(' (but I
changed the line somewhere else), should I also fix the checkpatch issues?
And in case, should it be a separate patch to make it cleaner?

Also please take a look at the note in patch number 5.

Luca

Luca Ceresoli (6):
  README: remove spurious line
  NET: pass source IP address to packet handlers
  TFTP: rename "server" to "remote"
  TFTP: rename STATE_RRQ to STATE_SEND_RRQ
  TFTP: net/tftp.c: add server mode receive
  TFTP: add tftpsrv command

 README                   |    2 +-
 common/cmd_net.c         |   14 ++++++
 drivers/net/netconsole.c |    5 +-
 include/net.h            |   18 +++++---
 net/bootp.c              |    9 +++-
 net/dns.c                |    2 +-
 net/net.c                |   35 +++++++++------
 net/nfs.c                |    2 +-
 net/rarp.c               |    3 +-
 net/sntp.c               |    3 +-
 net/tftp.c               |  109 ++++++++++++++++++++++++++++++++++++---------
 net/tftp.h               |    6 +++
 12 files changed, 157 insertions(+), 51 deletions(-)



More information about the U-Boot mailing list