diff options
| author | Michael Brown | 2006-08-09 02:09:29 +0200 |
|---|---|---|
| committer | Michael Brown | 2006-08-09 02:09:29 +0200 |
| commit | d1a123b1f4f265aa415d647212c64fb02d47e208 (patch) | |
| tree | 76d61ff8a19d734dc8d7620980f0d4112bc8aeed /src/net | |
| parent | Initial (untested) implementation of TFTP over the new UDP API. (diff) | |
| download | ipxe-d1a123b1f4f265aa415d647212c64fb02d47e208.tar.gz ipxe-d1a123b1f4f265aa415d647212c64fb02d47e208.tar.xz ipxe-d1a123b1f4f265aa415d647212c64fb02d47e208.zip | |
Added TFTP test code (currently just dumps file to console).
Diffstat (limited to 'src/net')
| -rw-r--r-- | src/net/udp/tftp.c | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/src/net/udp/tftp.c b/src/net/udp/tftp.c index 39839bea9..2b00cd780 100644 --- a/src/net/udp/tftp.c +++ b/src/net/udp/tftp.c @@ -207,9 +207,10 @@ static int tftp_send_rrq ( struct tftp_session *tftp, void *buf, size_t len ) { end = ( buf + len ); if ( data > end ) goto overflow; - data += snprintf ( data, ( end - data ), - "%s%coctet%cblksize%c%d%ctsize%c0", - tftp->filename, 0, 0, 0, tftp->blksize, 0, 0 ) + 1; + data += ( snprintf ( data, ( end - data ), + "%s%coctet%cblksize%c%d%ctsize%c0", + tftp->filename, 0, 0, 0, + tftp->request_blksize, 0, 0 ) + 1 ); if ( data > end ) goto overflow; rrq->opcode = htons ( TFTP_RRQ ); @@ -456,6 +457,8 @@ struct async_operation * tftp_get ( struct tftp_session *tftp ) { tftp->timer.expired = tftp_timer_expired; tftp->state = -1; tftp->blksize = TFTP_DEFAULT_BLKSIZE; + if ( ! tftp->request_blksize ) + tftp->request_blksize = TFTP_MAX_BLKSIZE; /* Open UDP connection */ if ( ( rc = udp_open ( &tftp->udp, 0 ) ) != 0 ) { |
