pxelinux: fix the new timeout code
authorH. Peter Anvin <hpa@zytor.com>
Tue, 14 Apr 2009 03:30:26 +0000 (20:30 -0700)
committerH. Peter Anvin <hpa@zytor.com>
Tue, 14 Apr 2009 03:30:26 +0000 (20:30 -0700)
Fix the new timeout code; in particular:

- on receiving an ERROR packet, we fake an immediate timeout;
  this has to be done differently now.
- fix missing decrement of timeout counter.

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
core/pxelinux.asm

index a87f321..94d013b 100644 (file)
@@ -206,7 +206,6 @@ StrucPtr    resd 1                  ; Pointer to PXENV+ or !PXE structure
 APIVer         resw 1                  ; PXE API version found
 IdleTimer      resw 1                  ; Time to check for ARP?
 LocalBootType  resw 1                  ; Local boot return code
-PktTimeout     resw 1                  ; Timeout for current packet
 RealBaseMem    resw 1                  ; Amount of DOS memory after freeing
 OverLoad       resb 1                  ; Set if DHCP packet uses "overloading"
 DHCPMagic      resb 1                  ; PXELINUX magic flags
@@ -1078,6 +1077,7 @@ searchdir:
                cmp dx,[bp-12]
                je .pkt_loop
                mov [bp-12],dx
+               dec word [bp-10]
                jnz .pkt_loop
                pop ax  ; Adjust stack
                pop ax
@@ -1264,7 +1264,9 @@ searchdir:
                call writestr_early
                jmp kaboom
 
-.bailnow:      mov word [bp-2],1       ; Immediate error - no retry
+.bailnow:
+               ; Immediate error - no retry
+               mov word [bp-2],TimeoutTableEnd-1
 
 .failure:      pop bx                  ; Junk
                pop bx