From 8cca168fc73058bf8b9bc6f6858ca4b38e5fde16 Mon Sep 17 00:00:00 2001 From: "H. Peter Anvin" Date: Wed, 27 Feb 2008 10:53:40 -0800 Subject: [PATCH] PXELINUX: make TFTP work without any OACK Make the TFTP stack handle the case where no options are acknowledged, so we don't even get an OACK; instead we get the first data packet immediately. --- pxelinux.asm | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/pxelinux.asm b/pxelinux.asm index 8ab223e..a6a847d 100644 --- a/pxelinux.asm +++ b/pxelinux.asm @@ -1286,14 +1286,24 @@ searchdir: sub cx,2 ; Too short? jb .failure lodsw ; Block number - cmp ax,1 + cmp ax,htons(1) jne .failure mov [bx+tftp_lastpkt],ax cmp cx,TFTP_BLOCKSIZE ja .err_reply ; Corrupt... - je .unknown_size + je .not_eof + ; This was the final EOF packet, already... + ; We know the filesize, but we also want to ack the + ; packet and set the EOF flag. mov [bx+tftp_filesize],ecx -.unknown_size: mov [bx+tftp_bytesleft],cx + mov byte [bx+tftp_goteof],1 + push si + mov si,bx + ; AX = htons(1) already + call ack_packet + pop si +.not_eof: + mov [bx+tftp_bytesleft],cx mov ax,pktbuf_seg push es mov es,ax -- 2.7.4