aboutsummaryrefslogtreecommitdiff
path: root/slirp/tftp.c
AgeCommit message (Collapse)AuthorFilesLines
2014-03-25Fixed various typosDeepak Kathayat1-1/+1
Signed-off-by: Deepak Kathayat <deepak.mk17@gmail.com> Reviewed-by: Andreas Färber <afaerber@suse.de> Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
2012-09-14slirp: Implement TFTP Blocksize optionHervé Poussineau1-9/+33
This option is described in RFC 1783. As this is only an optional field, we may ignore it in some situations and handle it in some others. However, MS Windows 2003 PXE boot client requests a block size of the MTU (most of the times 1472 bytes), and doesn't work if the option is not acknowledged (with whatever value). According to the RFC 1783, we cannot acknowledge the option with a bigger value than the requested one. As current implementation is using 512 bytes by block, accept the option with a value of 512 if the option was specified, and don't acknowledge it if it is not present or less than 512 bytes. Signed-off-by: Hervé Poussineau <hpoussin@reactos.org> Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
2012-09-13slirp: Remove unused return value of tftp_send_next_blockJan Kiszka1-9/+5
No caller actually makes use of this value, so let's simplify the code. Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
2012-09-13slirp: Handle more than 65535 blocks in TFTP transfersHervé Poussineau1-14/+10
RFC 1350 does not mention block count roll-over. However, a lot of TFTP servers implement it to be able to transmit big files, so do it also. Current block size is 512 bytes, so TFTP files were limited to 32 MB. Signed-off-by: Hervé Poussineau <hpoussin@reactos.org> Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
2012-09-13slirp: improve TFTP performanceHervé Poussineau1-14/+18
When transferring a file, keep it open during the whole transfer, instead of opening/closing it for each block. Signed-off-by: Hervé Poussineau <hpoussin@reactos.org> Reviewed-by: Aurelien Jarno <aurelien@aurel32.net> Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
2011-08-20Use glib memory allocation and free functionsAnthony Liguori1-3/+3
qemu_malloc/qemu_free no longer exist after this commit. Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2011-02-25slirp: Remove some type casts caused by bad declaration of x.tp_bufStefan Weil1-7/+7
x.tp_buf was declared as a uint8_t array, but always used as a char array (which needed a lot of type casts). The patch includes these changes: * Fix declaration of x.tp_buf and remove all type casts. * Use offsetof() to get the offset of x.tp_buf. Signed-off-by: Stefan Weil <weil@mail.berlios.de> Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
2011-01-13slirp: Use strcasecmp() to check tftp mode, tsizeSergei Gavrikov1-2/+2
According to RFC 1350 (TFTP Revision 2) the mode field can contain any combination of upper and lower case; also RFC 2349 propagates that the transfer size option ("tsize") is case in-sensitive too. Current implementation of embedded TFTP server missed that what does mess some TFTP clients. Fixed by using STRCASECMP(3) in the required places. Signed-off-by: Sergei Gavrikov <sergei.gavrikov@gmail.com> Reviewed-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com> Signed-off-by: Edgar E. Iglesias <edgar@axis.com>
2010-07-25slirp: Replace u_int8_t, u_int16_t, u_int32_t, u_int64_t by standard int typesStefan Weil1-4/+4
There is no need to have a second set of integral types. Replace them by the standard types from stdint.h. Signed-off-by: Stefan Weil <weil@mail.berlios.de> Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
2010-03-07slirp: remove dead assignments, spotted by clangBlue Swirl1-3/+0
Value stored is never read. Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
2010-01-13Qemu's internal TFTP server breaks lock-step-iness of TFTPMilan Plzik1-0/+1
According to RFC 1350 and RFC 2347, TFTP server should answer RRQ by either OACK or DATA packet. Qemu's internal TFTP server answers RRQ with additional options by sending both OACK and DATA packet, thus breaking the "lock-step" feature of the protocol, and also confuses client. Proposed solution would be to, in case of OACK packet, wait for ACK from client and just then start sending data. Attached patch implements this. Signed-off-by: Thomas Horsten <thomas@horsten.com> Signed-off-by: Milan Plzik <milan.plzik@gmail.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2010-01-11Handle TFTP ERROR from clientThomas Horsten1-0/+23
If a PXE client only wants to find out the size of a file, it will open the file and then abort the transfer by sending a TFTP ERROR packet. The ERROR packet should cause qemu to terminate the session. If not, the sessions will soon run out and cause timeouts in the client. Also, if a TFTP session already exists with same IP/UDP port, it should be terminated when a new RRQ is received, instead of creating a duplicate (which will never be used). A patch for gPXE to send the ERROR packet is also being submitted to gPXE. Together they resolve slowness/hanging when booting pxegrub from qemu's internal TFTP server. The patch from Milan Plzik to return after sending OACK is also required for a complete fix. Signed-off-by: Thomas Horsten <thomas@horsten.com> Signed-off-by: Milan Plzik <milan.plzik@gmail.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2009-06-29slirp: tftp: Relax filename format checkJan Kiszka1-3/+5
[ Applies on top of my recently posted slirp series. ] Allow tftp requests with filenames that do not start with a slash. Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2009-06-29slirp: Factor out internal state structureJan Kiszka1-37/+28
The essence of this patch is to stuff (almost) all global variables of the slirp stack into the structure Slirp. In this step, we still keep the structure as global variable, directly accessible by the whole stack. Changes to the external interface of slirp will be applied in the following patches. Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2009-06-29slirp: tftp: Rework filename handlingJan Kiszka1-22/+16
This changes the filename handling from a static buffer in tftp_session for the client-provided name + prefix to a dynamically allocated buffer that keeps the combined path in one place. Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2009-06-29slirp: tftp: Refactor tftp_handle_rrqJan Kiszka1-28/+21
Specifically make the filename extraction more readable, and always report errors back to the client. Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2009-06-29slirp: tftp: Clean up tftp_send_errorJan Kiszka1-8/+5
The return code of tftp_send_error is not used, drop it. And also make sure to always terminate the session. Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2009-06-29slirp: tftp: Cleanup tftp_prefix checkJan Kiszka1-8/+7
Perform check for set prefix early (if it's not given, tftp is disabled) and drop redundant second check. Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2009-06-29slirp: Drop dead codeJan Kiszka1-1/+1
After all its years inside the qemu tree, there is no point in keeping the dead code paths of slirp. This patch is a first round of removing usually commented out code parts. More cleanups need to follow (and maybe finally a proper reindention). Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2009-06-29slirp: Move smb, redir, tftp and bootp parameters and -net channelJan Kiszka1-1/+1
So far a couple of slirp-related parameters were expressed via stand-alone command line options. This it inconsistent and unintuitive. Moreover, it prevents both dynamically reconfigured (host_net_add/ delete) and multi-instance slirp. This patch refactors the configuration by turning -smb, -redir, -tftp and -bootp as well as -net channel into options of "-net user". The old stand-alone command line options are still processed, but no longer advertised. This allows smooth migration of management applications to to the new syntax and also the extension of that syntax later in this series. Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2008-09-20Suppress gcc 4.x -Wpointer-sign (included in -Wall) warningsblueswir11-7/+9
git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@5275 c046a42c-6fe2-441c-8c8c-71466251a162
2008-08-21Fix OpenBSD linker warningsblueswir11-3/+4
git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@5044 c046a42c-6fe2-441c-8c8c-71466251a162
2007-10-26 Use const and static as needed, disable unused codeblueswir11-4/+4
git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@3452 c046a42c-6fe2-441c-8c8c-71466251a162
2007-09-17find -type f | xargs sed -i 's/[\t ]*$//g' # Yes, again. Note the star in ↵ths1-12/+12
the regex. git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@3177 c046a42c-6fe2-441c-8c8c-71466251a162
2007-09-16find -type f | xargs sed -i 's/[\t ]$//g' # on most filesths1-22/+22
git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@3173 c046a42c-6fe2-441c-8c8c-71466251a162
2007-02-20Change -tftp option to take a root directory, by Anthony Liguori.ths1-3/+9
git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@2441 c046a42c-6fe2-441c-8c8c-71466251a162
2007-02-20Add OACK support to slirp TFTP server, by Anthony Liguori.ths1-0/+83
git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@2440 c046a42c-6fe2-441c-8c8c-71466251a162
2004-10-09win32 fixbellard1-1/+1
git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@1113 c046a42c-6fe2-441c-8c8c-71466251a162
2004-08-25port redirection supportbellard1-1/+1
git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@1054 c046a42c-6fe2-441c-8c8c-71466251a162
2004-08-25removed gettimeofday usagebellard1-19/+13
git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@1053 c046a42c-6fe2-441c-8c8c-71466251a162
2004-08-24TFTP support (Magnus Damm)bellard1-0/+339
git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@1050 c046a42c-6fe2-441c-8c8c-71466251a162