Skip to contentSkip to conversation

Qemu's internal TFTP server breaks lock-step-iness of TFTP

Qemu-devel Milan Plzik 3 participants 4 messages Jan 6, 2010 – Jan 7, 2010

lore
Share & tools
lore
#0 lore raw

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

slirp/tftp.c +1 -0
index 082f5d0..db869fc 100644
@@ -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;
       }
   }
 
#1 lore raw
Quoted 7 lines · Milan Plzik

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.

Quoted 7 lines

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

Quoted 2 lines

Milan Plzik

#2 lore raw

V Streda, 6. január 2010 o 16:43 -0600, Anthony Liguori napísal(a):

Quoted 2 lines

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

Quoted 1 line

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

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

Quoted 8 lines

Regards,

Anthony Liguori

Quoted 2 lines

Milan Plzik

#3 lore raw
In reply to Milan Plzik
Quoted 7 lines · Milan Plzik

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.

Quoted 8 lines

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

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