From: Samuel Thibault <samuel.thibault@ens-lyon.org>
To: qemu-devel@nongnu.org, peter.maydell@linaro.org
Cc: Vincent Bernat <vincent@bernat.im>,
jan.kiszka@siemens.com,
Samuel Thibault <samuel.thibault@ens-lyon.org>
Subject: [Qemu-devel] [PULL] tftp: fake support for netascii protocol
Date: Fri, 18 Nov 2016 18:51:28 +0100 [thread overview]
Message-ID: <20161118175128.17192-2-samuel.thibault@ens-lyon.org> (raw)
In-Reply-To: <20161118175128.17192-1-samuel.thibault@ens-lyon.org>
From: Vincent Bernat <vincent@bernat.im>
Some network equipments are requesting a file using the netascii
protocol and this is not configurable. Currently, qemu's tftpd only
supports the octet protocol. This commit makes it accept the netascii
protocol as well but do not perform the requested transformation (LF ->
CR,LF) as it would be far more complex. The current implementation is
good enough. A user has always the choice to preencode the served file
correctly.
Signed-off-by: Vincent Bernat <vincent@bernat.im>
Signed-off-by: Samuel Thibault <samuel.thibault@ens-lyon.org>
---
slirp/tftp.c | 8 +++++---
1 file changed, 5 insertions(+), 3 deletions(-)
diff --git a/slirp/tftp.c b/slirp/tftp.c
index c185906..ab1c05d 100644
--- a/slirp/tftp.c
+++ b/slirp/tftp.c
@@ -326,13 +326,15 @@ static void tftp_handle_rrq(Slirp *slirp, struct sockaddr_storage *srcsas,
return;
}
- if (strcasecmp(&tp->x.tp_buf[k], "octet") != 0) {
+ if (strcasecmp(&tp->x.tp_buf[k], "octet") == 0) {
+ k += 6;
+ } else if (strcasecmp(&tp->x.tp_buf[k], "netascii") == 0) {
+ k += 9;
+ } else {
tftp_send_error(spt, 4, "Unsupported transfer mode", tp);
return;
}
- k += 6; /* skipping octet */
-
/* do sanity checks on the filename */
if (!strncmp(req_fname, "../", 3) ||
req_fname[strlen(req_fname) - 1] == '/' ||
--
2.10.2
next prev parent reply other threads:[~2016-11-18 17:51 UTC|newest]
Thread overview: 23+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-11-18 17:51 [Qemu-devel] [PULL] tftp: fake support for netascii protocol Samuel Thibault
2016-11-18 17:51 ` Samuel Thibault [this message]
2016-11-18 17:55 ` no-reply
2016-11-19 7:32 ` Thomas Huth
2016-11-19 8:03 ` Vincent Bernat
2016-11-19 22:30 ` Samuel Thibault
2016-11-20 8:41 ` [Qemu-devel] [v2] " Vincent Bernat
2016-11-20 8:44 ` no-reply
2016-11-20 8:44 ` no-reply
2016-11-21 7:35 ` Thomas Huth
2016-11-21 14:46 ` Stefan Hajnoczi
2016-11-21 14:51 ` hpa
2016-11-21 15:05 ` Samuel Thibault
2016-11-21 15:28 ` hpa
2016-11-22 10:49 ` Stefan Hajnoczi
2016-11-23 7:30 ` Vincent Bernat
2016-11-23 9:34 ` Stefan Hajnoczi
2016-11-21 15:35 ` Vincent Bernat
2016-11-21 15:38 ` hpa
2016-11-20 8:42 ` [Qemu-devel] [PULL] " Vincent Bernat
-- strict thread matches above, loose matches on Subject: below --
2016-11-20 17:05 Samuel Thibault
2016-11-20 17:05 ` Samuel Thibault
2016-11-20 17:09 ` no-reply
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20161118175128.17192-2-samuel.thibault@ens-lyon.org \
--to=samuel.thibault@ens-lyon.org \
--cc=jan.kiszka@siemens.com \
--cc=peter.maydell@linaro.org \
--cc=qemu-devel@nongnu.org \
--cc=vincent@bernat.im \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).