qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [Qemu-devel] Qemu's internal TFTP server breaks lock-step-iness of TFTP
@ 2010-01-06 22:11 Milan Plzik
  2010-01-06 22:43 ` Anthony Liguori
  2010-01-07 15:42 ` H. Peter Anvin
  0 siblings, 2 replies; 6+ messages in thread
From: Milan Plzik @ 2010-01-06 22:11 UTC (permalink / raw)
  To: qemu-devel

[-- Attachment #1: Type: text/plain, Size: 595 bytes --]

  Hello,

  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.

  I would like to thank to mbc and th1 (who is the rightful author of
the patch) from #gpxe for their time, effort and patience with me :)

	Milan Plzik

[-- Attachment #2: qemu_tftp_handle_oack_correctly.patch --]
[-- Type: text/x-patch, Size: 283 bytes --]

diff --git a/slirp/tftp.c b/slirp/tftp.c
index 082f5d0..db869fc 100644
--- a/slirp/tftp.c
+++ b/slirp/tftp.c
@@ -362,6 +362,7 @@ static void tftp_handle_rrq(Slirp *slirp, struct tftp_t *tp, int pktlen)
 	  }
 
 	  tftp_send_oack(spt, "tsize", tsize, tp);
+	  return;
       }
   }
 

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

* Re: [Qemu-devel] Qemu's internal TFTP server breaks lock-step-iness of TFTP
  2010-01-06 22:11 Milan Plzik
@ 2010-01-06 22:43 ` Anthony Liguori
  2010-01-07 12:51   ` Milan Plzik
  2010-01-07 15:42 ` H. Peter Anvin
  1 sibling, 1 reply; 6+ messages in thread
From: Anthony Liguori @ 2010-01-06 22:43 UTC (permalink / raw)
  To: Milan Plzik; +Cc: qemu-devel

On 01/06/2010 04:11 PM, Milan Plzik wrote:
>    Hello,
>
>    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.
>
>    I would like to thank to mbc and th1 (who is the rightful author of
> the patch) from #gpxe for their time, effort and patience with me :)
>    

Thanks for the patch, I assume this fixes -boot n when using -bootp and 
-tftp.  Can you add an appropriate Signed-off-by and resubmit?

Regards,

Anthony Liguori

> 	Milan Plzik
>    

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

* [Qemu-devel] Qemu's internal TFTP server breaks lock-step-iness of TFTP
@ 2010-01-07 12:39 Milan Plzik
  2010-01-13 23:26 ` Anthony Liguori
  0 siblings, 1 reply; 6+ messages in thread
From: Milan Plzik @ 2010-01-07 12:39 UTC (permalink / raw)
  To: qemu-devel

[-- Attachment #1: Type: text/plain, Size: 535 bytes --]

  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>


[-- Attachment #2: qemu_tftp_handle_oack_correctly.patch --]
[-- Type: text/x-patch, Size: 283 bytes --]

diff --git a/slirp/tftp.c b/slirp/tftp.c
index 082f5d0..db869fc 100644
--- a/slirp/tftp.c
+++ b/slirp/tftp.c
@@ -362,6 +362,7 @@ static void tftp_handle_rrq(Slirp *slirp, struct tftp_t *tp, int pktlen)
 	  }
 
 	  tftp_send_oack(spt, "tsize", tsize, tp);
+	  return;
       }
   }
 

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

* Re: [Qemu-devel] Qemu's internal TFTP server breaks lock-step-iness of TFTP
  2010-01-06 22:43 ` Anthony Liguori
@ 2010-01-07 12:51   ` Milan Plzik
  0 siblings, 0 replies; 6+ messages in thread
From: Milan Plzik @ 2010-01-07 12:51 UTC (permalink / raw)
  To: Anthony Liguori; +Cc: qemu-devel

V Streda, 6. január 2010 o 16:43 -0600, Anthony Liguori napísal(a):
> Thanks for the patch, I assume this fixes -boot n when using -bootp and 
> -tftp.  

  Not sure what was the original issue, but at least for me it fixed
booting pxegrub :)

> Can you add an appropriate Signed-off-by and resubmit?

  Added, re-submitted; I hope it will be acceptable as an attachment.

> 
> Regards,
> 
> Anthony Liguori
> 
> > 	Milan Plzik
> >    
> 

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

* Re: [Qemu-devel] Qemu's internal TFTP server breaks lock-step-iness of TFTP
  2010-01-06 22:11 Milan Plzik
  2010-01-06 22:43 ` Anthony Liguori
@ 2010-01-07 15:42 ` H. Peter Anvin
  1 sibling, 0 replies; 6+ messages in thread
From: H. Peter Anvin @ 2010-01-07 15:42 UTC (permalink / raw)
  To: Milan Plzik; +Cc: qemu-devel

On 01/06/2010 02:11 PM, Milan Plzik wrote:
>   Hello,
> 
>   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.
> 
>   I would like to thank to mbc and th1 (who is the rightful author of
> the patch) from #gpxe for their time, effort and patience with me :)
> 
> 	Milan Plzik

The built-in TFTP server has at least two *serious* other problems:

a) It has the Sorcerer's Apprentice bug (See RFC 1123 and 1350).
b) It doesn't do time-based retransmits.

Note that (a) can't be fixed without fixing (b).

	-hpa

-- 
H. Peter Anvin, Intel Open Source Technology Center
I work for Intel.  I don't speak on their behalf.

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

* Re: [Qemu-devel] Qemu's internal TFTP server breaks lock-step-iness of TFTP
  2010-01-07 12:39 [Qemu-devel] Qemu's internal TFTP server breaks lock-step-iness of TFTP Milan Plzik
@ 2010-01-13 23:26 ` Anthony Liguori
  0 siblings, 0 replies; 6+ messages in thread
From: Anthony Liguori @ 2010-01-13 23:26 UTC (permalink / raw)
  To: Milan Plzik; +Cc: qemu-devel

On 01/07/2010 06:39 AM, Milan Plzik wrote:
>    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>
>
>    

Applied.  Thanks.

Regards,

Anthony Liguori

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

end of thread, other threads:[~2010-01-13 23:26 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-01-07 12:39 [Qemu-devel] Qemu's internal TFTP server breaks lock-step-iness of TFTP Milan Plzik
2010-01-13 23:26 ` Anthony Liguori
  -- strict thread matches above, loose matches on Subject: below --
2010-01-06 22:11 Milan Plzik
2010-01-06 22:43 ` Anthony Liguori
2010-01-07 12:51   ` Milan Plzik
2010-01-07 15:42 ` H. Peter Anvin

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).