summaryrefslogtreecommitdiffstats
path: root/slirp/tftp.c
Commit message (Collapse)AuthorAgeFilesLines
* Fixed various typosDeepak Kathayat2014-03-251-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>
* slirp: Implement TFTP Blocksize optionHervé Poussineau2012-09-141-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>
* slirp: Remove unused return value of tftp_send_next_blockJan Kiszka2012-09-131-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>
* slirp: Handle more than 65535 blocks in TFTP transfersHervé Poussineau2012-09-131-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>
* slirp: improve TFTP performanceHervé Poussineau2012-09-131-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>
* Use glib memory allocation and free functionsAnthony Liguori2011-08-201-3/+3
| | | | | | qemu_malloc/qemu_free no longer exist after this commit. Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
* slirp: Remove some type casts caused by bad declaration of x.tp_bufStefan Weil2011-02-251-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>
* slirp: Use strcasecmp() to check tftp mode, tsizeSergei Gavrikov2011-01-131-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>
* slirp: Replace u_int8_t, u_int16_t, u_int32_t, u_int64_t by standard int typesStefan Weil2010-07-251-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>
* slirp: remove dead assignments, spotted by clangBlue Swirl2010-03-071-3/+0
| | | | | | Value stored is never read. Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
* Qemu's internal TFTP server breaks lock-step-iness of TFTPMilan Plzik2010-01-131-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>
* Handle TFTP ERROR from clientThomas Horsten2010-01-111-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>
* slirp: tftp: Relax filename format checkJan Kiszka2009-06-291-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>
* slirp: Factor out internal state structureJan Kiszka2009-06-291-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>
* slirp: tftp: Rework filename handlingJan Kiszka2009-06-291-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>
* slirp: tftp: Refactor tftp_handle_rrqJan Kiszka2009-06-291-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>
* slirp: tftp: Clean up tftp_send_errorJan Kiszka2009-06-291-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>
* slirp: tftp: Cleanup tftp_prefix checkJan Kiszka2009-06-291-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>
* slirp: Drop dead codeJan Kiszka2009-06-291-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>
* slirp: Move smb, redir, tftp and bootp parameters and -net channelJan Kiszka2009-06-291-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>
* Suppress gcc 4.x -Wpointer-sign (included in -Wall) warningsblueswir12008-09-201-7/+9
| | | | git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@5275 c046a42c-6fe2-441c-8c8c-71466251a162
* Fix OpenBSD linker warningsblueswir12008-08-211-3/+4
| | | | git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@5044 c046a42c-6fe2-441c-8c8c-71466251a162
* Use const and static as needed, disable unused codeblueswir12007-10-261-4/+4
| | | | git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@3452 c046a42c-6fe2-441c-8c8c-71466251a162
* find -type f | xargs sed -i 's/[\t ]*$//g' # Yes, again. Note the star in ↵ths2007-09-171-12/+12
| | | | | | the regex. git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@3177 c046a42c-6fe2-441c-8c8c-71466251a162
* find -type f | xargs sed -i 's/[\t ]$//g' # on most filesths2007-09-161-22/+22
| | | | git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@3173 c046a42c-6fe2-441c-8c8c-71466251a162
* Change -tftp option to take a root directory, by Anthony Liguori.ths2007-02-201-3/+9
| | | | git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@2441 c046a42c-6fe2-441c-8c8c-71466251a162
* Add OACK support to slirp TFTP server, by Anthony Liguori.ths2007-02-201-0/+83
| | | | git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@2440 c046a42c-6fe2-441c-8c8c-71466251a162
* win32 fixbellard2004-10-091-1/+1
| | | | git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@1113 c046a42c-6fe2-441c-8c8c-71466251a162
* port redirection supportbellard2004-08-251-1/+1
| | | | git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@1054 c046a42c-6fe2-441c-8c8c-71466251a162
* removed gettimeofday usagebellard2004-08-251-19/+13
| | | | git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@1053 c046a42c-6fe2-441c-8c8c-71466251a162
* TFTP support (Magnus Damm)bellard2004-08-241-0/+339
git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@1050 c046a42c-6fe2-441c-8c8c-71466251a162
OpenPOWER on IntegriCloud