summaryrefslogtreecommitdiffstats
path: root/slirp/tftp.c
diff options
context:
space:
mode:
authorPeter Maydell2019-02-07 19:53:25 +0100
committerPeter Maydell2019-02-07 19:53:25 +0100
commite47f81b617684c4546af286d307b69014a83538a (patch)
tree11e4e8c6482d092d91ed9faed327f341f3cc69f8 /slirp/tftp.c
parentMerge remote-tracking branch 'remotes/vivier2/tags/linux-user-for-4.0-pull-re... (diff)
parentslirp: API is extern C (diff)
downloadqemu-e47f81b617684c4546af286d307b69014a83538a.tar.gz
qemu-e47f81b617684c4546af286d307b69014a83538a.tar.xz
qemu-e47f81b617684c4546af286d307b69014a83538a.zip
Merge remote-tracking branch 'remotes/thibault/tags/samuel-thibault' into staging
More work towards libslirp Marc-André Lureau (27): slirp: generalize guestfwd with a callback based approach net/slirp: simplify checking for cmd: prefix net/slirp: free forwarding rules on cleanup net/slirp: fix leaks on forwarding rule registration error slirp: add callbacks for timer slirp: replace trace functions with DEBUG calls slirp: replace QEMU_PACKED with SLIRP_PACKED slirp: replace most qemu socket utilities with slirp own version slirp: replace qemu_set_nonblock() slirp: add unregister_poll_fd() callback slirp: replace qemu_notify_event() with a callback slirp: move QEMU state saving to a separate unit slirp: do not include qemu headers in libslirp.h public API header slirp: improve windows headers inclusion slirp: add slirp own version of pstrcpy slirp: remove qemu timer.h dependency slirp: remove now useless QEMU headers inclusions slirp: replace net/eth.h inclusion with own defines slirp: replace qemu qtailq with slirp own copy slirp: replace remaining qemu headers dependency slirp: prefer c99 types over BSD kind slirp: improve send_packet() callback slirp: replace global polling with per-instance & notifier slirp: remove slirp_instances list slirp: use polling callbacks, drop glib requirement slirp: pass opaque to all callbacks slirp: API is extern C Peter Maydell (2): slirp: Avoid marking naturally packed structs as QEMU_PACKED slirp: Don't mark struct ipq or struct ipasfrag as packed Samuel Thibault (3): slirp: Avoid unaligned 16bit memory access slirp: replace QEMU_BUILD_BUG_ON with G_STATIC_ASSERT slirp: Move g_spawn_async_with_fds_qemu compatibility to slirp/ # gpg: Signature made Thu 07 Feb 2019 14:02:41 GMT # gpg: using RSA key E61DBB15D4172BDEC97E92D9DB550E89F0FA54F3 # gpg: Good signature from "Samuel Thibault <samuel.thibault@aquilenet.fr>" [unknown] # gpg: aka "Samuel Thibault <sthibault@debian.org>" [marginal] # gpg: aka "Samuel Thibault <samuel.thibault@gnu.org>" [unknown] # gpg: aka "Samuel Thibault <samuel.thibault@inria.fr>" [marginal] # gpg: aka "Samuel Thibault <samuel.thibault@labri.fr>" [marginal] # gpg: aka "Samuel Thibault <samuel.thibault@ens-lyon.org>" [marginal] # gpg: aka "Samuel Thibault <samuel.thibault@u-bordeaux.fr>" [unknown] # gpg: WARNING: This key is not certified with sufficiently trusted signatures! # gpg: It is not certain that the signature belongs to the owner. # Primary key fingerprint: 900C B024 B679 31D4 0F82 304B D017 8C76 7D06 9EE6 # Subkey fingerprint: E61D BB15 D417 2BDE C97E 92D9 DB55 0E89 F0FA 54F3 * remotes/thibault/tags/samuel-thibault: (32 commits) slirp: API is extern C slirp: pass opaque to all callbacks slirp: use polling callbacks, drop glib requirement slirp: remove slirp_instances list slirp: replace global polling with per-instance & notifier slirp: improve send_packet() callback slirp: prefer c99 types over BSD kind slirp: replace remaining qemu headers dependency slirp: Move g_spawn_async_with_fds_qemu compatibility to slirp/ slirp: replace QEMU_BUILD_BUG_ON with G_STATIC_ASSERT slirp: replace qemu qtailq with slirp own copy slirp: replace net/eth.h inclusion with own defines slirp: remove now useless QEMU headers inclusions slirp: remove qemu timer.h dependency slirp: add slirp own version of pstrcpy slirp: improve windows headers inclusion slirp: do not include qemu headers in libslirp.h public API header slirp: move QEMU state saving to a separate unit slirp: replace qemu_notify_event() with a callback slirp: add unregister_poll_fd() callback ... Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Diffstat (limited to 'slirp/tftp.c')
-rw-r--r--slirp/tftp.c16
1 files changed, 9 insertions, 7 deletions
diff --git a/slirp/tftp.c b/slirp/tftp.c
index a9ba1480db..2d8f978786 100644
--- a/slirp/tftp.c
+++ b/slirp/tftp.c
@@ -22,11 +22,11 @@
* THE SOFTWARE.
*/
-#include "qemu/osdep.h"
#include "slirp.h"
-#include "qemu-common.h"
-#include "qemu/cutils.h"
-#include "trace.h"
+
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <fcntl.h>
static inline int tftp_session_in_use(struct tftp_session *spt)
{
@@ -205,7 +205,8 @@ static void tftp_send_error(struct tftp_session *spt,
struct mbuf *m;
struct tftp_t *tp;
- trace_slirp_tftp_error(msg);
+ DEBUG_TFTP("tftp error msg: %s", msg);
+
m = m_get(spt->slirp);
if (!m) {
@@ -216,7 +217,7 @@ static void tftp_send_error(struct tftp_session *spt,
tp->tp_op = htons(TFTP_ERROR);
tp->x.tp_error.tp_error_code = htons(errorcode);
- pstrcpy((char *)tp->x.tp_error.tp_msg, sizeof(tp->x.tp_error.tp_msg), msg);
+ slirp_pstrcpy((char *)tp->x.tp_error.tp_msg, sizeof(tp->x.tp_error.tp_msg), msg);
m->m_len = sizeof(struct tftp_t) - (TFTP_BLOCKSIZE_MAX + 2) + 3 + strlen(msg)
- sizeof(struct udphdr);
@@ -325,7 +326,8 @@ static void tftp_handle_rrq(Slirp *slirp, struct sockaddr_storage *srcsas,
break;
}
}
- trace_slirp_tftp_rrq(req_fname);
+
+ DEBUG_TFTP("tftp rrq file: %s", req_fname);
/* check mode */
if ((pktlen - k) < 6) {