PXELINUX: make TFTP work without any OACK
authorH. Peter Anvin <hpa@zytor.com>
Wed, 27 Feb 2008 18:53:40 +0000 (10:53 -0800)
committerH. Peter Anvin <hpa@zytor.com>
Wed, 27 Feb 2008 18:53:40 +0000 (10:53 -0800)
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

index 8ab223e..a6a847d 100644 (file)
@@ -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