public inbox for ecos-devel@sourceware.org
 help / color / mirror / Atom feed
* RedBoot's TFTP client and dumb TFTP servers
@ 2011-01-10 14:14 Sergei Gavrikov
  2011-01-10 14:31 ` Gary Thomas
  0 siblings, 1 reply; 4+ messages in thread
From: Sergei Gavrikov @ 2011-01-10 14:14 UTC (permalink / raw)
  To: eCos Developers

Hi

I tried to get working the QEMU's embedded TFTP server with RedBoot's
FTP client and the RedBoot's 'load' command always wept, -- "illegal
TFTP operation".

I did dig that QEMU's TFTP server has the very simple check for a
transfer mode:

slirp/tftp.c:314

    if (memcmp(&tp->x.tp_buf[k], "octet\0", 6) != 0) {
        tftp_send_error(spt, 4, "Unsupported transfer mode", tp);
        return;
    }

in a contrast, RedBoot sets a binary transfer as 

net/tftp_client.c:95

    fp = "OCTET";
    while (*fp) *cp++ = *fp++;
    *cp++ = '\0';


According the RFC 1350 'THE TFTP PROTOCOL (REVISION 2)'
http://www.ietf.org/rfc/rfc1350.txt

(look at the page 5, please)

the RedBoot's code does not anything wrong (even obsolete RFC 783
allows any combination of upper and lower case, such as "NETASCII").
However, the first words are mentioned there are all lower-cased.

Well, a substitution 's/OCTET/octet/' in tftp_client.c solved the issue
with the QEMU TFTP server. However, perhaps, there are a few such TFTP
servers like the QEMU's one. It seemed for me that same symptom was
reported here:
http://sourceware.org/ml/ecos-discuss/2005-06/msg00158.html

Q: Whether can we simplify our life patching RedBoot? Is it safe?

Well, if I did not miss something, I can generate new report via
Bugzilla.


Sergei

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: RedBoot's TFTP client and dumb TFTP servers
  2011-01-10 14:14 RedBoot's TFTP client and dumb TFTP servers Sergei Gavrikov
@ 2011-01-10 14:31 ` Gary Thomas
  2011-01-10 14:48   ` Sergei Gavrikov
  0 siblings, 1 reply; 4+ messages in thread
From: Gary Thomas @ 2011-01-10 14:31 UTC (permalink / raw)
  To: Sergei Gavrikov; +Cc: eCos Developers

On 01/10/2011 07:13 AM, Sergei Gavrikov wrote:
> Hi
>
> I tried to get working the QEMU's embedded TFTP server with RedBoot's
> FTP client and the RedBoot's 'load' command always wept, -- "illegal
> TFTP operation".
>
> I did dig that QEMU's TFTP server has the very simple check for a
> transfer mode:
>
> slirp/tftp.c:314
>
>      if (memcmp(&tp->x.tp_buf[k], "octet\0", 6) != 0) {
>          tftp_send_error(spt, 4, "Unsupported transfer mode", tp);
>          return;
>      }
>
> in a contrast, RedBoot sets a binary transfer as
>
> net/tftp_client.c:95
>
>      fp = "OCTET";
>      while (*fp) *cp++ = *fp++;
>      *cp++ = '\0';
>
>
> According the RFC 1350 'THE TFTP PROTOCOL (REVISION 2)'
> http://www.ietf.org/rfc/rfc1350.txt
>
> (look at the page 5, please)
>
> the RedBoot's code does not anything wrong (even obsolete RFC 783
> allows any combination of upper and lower case, such as "NETASCII").
> However, the first words are mentioned there are all lower-cased.
>
> Well, a substitution 's/OCTET/octet/' in tftp_client.c solved the issue
> with the QEMU TFTP server. However, perhaps, there are a few such TFTP
> servers like the QEMU's one. It seemed for me that same symptom was
> reported here:
> http://sourceware.org/ml/ecos-discuss/2005-06/msg00158.html
>
> Q: Whether can we simplify our life patching RedBoot? Is it safe?
>
> Well, if I did not miss something, I can generate new report via
> Bugzilla.

I've never run across another TFTP server that can't handle
OCTET in upper case.

By your reference, the QEMU server is what's broken - why not fix it instead?

-- 
------------------------------------------------------------
Gary Thomas                 |  Consulting for the
MLB Associates              |    Embedded world
------------------------------------------------------------

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: RedBoot's TFTP client and dumb TFTP servers
  2011-01-10 14:31 ` Gary Thomas
@ 2011-01-10 14:48   ` Sergei Gavrikov
  2011-01-13 20:57     ` Sergei Gavrikov
  0 siblings, 1 reply; 4+ messages in thread
From: Sergei Gavrikov @ 2011-01-10 14:48 UTC (permalink / raw)
  To: Gary Thomas; +Cc: eCos Developers

On Mon, 10 Jan 2011, Gary Thomas wrote:

> On 01/10/2011 07:13 AM, Sergei Gavrikov wrote:
> > Hi
> > 
> > I tried to get working the QEMU's embedded TFTP server with
> > RedBoot's FTP client and the RedBoot's 'load' command always wept,
> > -- "illegal TFTP operation".
> > 
> > I did dig that QEMU's TFTP server has the very simple check for a
> > transfer mode:
> > 
> > slirp/tftp.c:314
> > 
> >      if (memcmp(&tp->x.tp_buf[k], "octet\0", 6) != 0) {
> >          tftp_send_error(spt, 4, "Unsupported transfer mode", tp);
> >          return;
> >      }
> > 

[snip]

> I've never run across another TFTP server that can't handle OCTET in
> upper case.
> 
> By your reference, the QEMU server is what's broken - why not fix it
> instead?


Gary, thanks for your expertise, then I will disturb qemu-devel list.


Sergei

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: RedBoot's TFTP client and dumb TFTP servers
  2011-01-10 14:48   ` Sergei Gavrikov
@ 2011-01-13 20:57     ` Sergei Gavrikov
  0 siblings, 0 replies; 4+ messages in thread
From: Sergei Gavrikov @ 2011-01-13 20:57 UTC (permalink / raw)
  To: eCos Developers; +Cc: Gary Thomas

Hi,

On Mon, 10 Jan 2011, Sergei Gavrikov wrote:

> On Mon, 10 Jan 2011, Gary Thomas wrote:

> > On 01/10/2011 07:13 AM, Sergei Gavrikov wrote:
<...>
> > > I tried to get working the QEMU's embedded TFTP server with
> > > RedBoot's FTP client and the RedBoot's 'load' command always wept,
> > > -- "illegal TFTP operation".
<...>
> > I've never run across another TFTP server that can't handle OCTET in
> > upper case.

Indeed, I've checked out 'netkit-tftp', 'atftp', and 'tftp-hpa' sources.
All TFTP servers use either strcasecmp() or tolower() then strcmp() on
checking the mode field. But all companion (TFP clients) send the mode
field in *lower* case.

> > By your reference, the QEMU server is what's broken - why not fix it
> > instead?
> 
> Gary, thanks for your expertise, then I will disturb qemu-devel list.

FYI: they applied my patch, but it is unlikely that everyone loves build
QEMU from sources :-) IMO, we could get the RedBoot's TFTP client be more
compliant/tolerant, but can be the RedBoot on QEMU is rarely the case.

Sergei

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2011-01-13 20:57 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-01-10 14:14 RedBoot's TFTP client and dumb TFTP servers Sergei Gavrikov
2011-01-10 14:31 ` Gary Thomas
2011-01-10 14:48   ` Sergei Gavrikov
2011-01-13 20:57     ` Sergei Gavrikov

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 read-only IMAP folder(s) and NNTP newsgroup(s).