Browse Source

[dhcp] Don't consider invalid offers to be duplicates

This fixes a regression in BOOTP support; since BOOTP requests often
have the `siaddr' field set to 0.0.0.0, they would be considered
duplicates of the first zeroed-out offer slot.

Signed-off-by: Joshua Oreman <oremanj@rwcr.net>
Signed-off-by: Michael Brown <mcb30@ipxe.org>
tags/v1.20.1
Joshua Oreman 14 years ago
parent
commit
905ea56753
1 changed files with 3 additions and 3 deletions
  1. 3
    3
      src/net/udp/dhcp.c

+ 3
- 3
src/net/udp/dhcp.c View File

417
 
417
 
418
 	/* Enqueue an offer to be filled in */
418
 	/* Enqueue an offer to be filled in */
419
 	for ( i = 0 ; i < DHCP_MAX_OFFERS ; i++ ) {
419
 	for ( i = 0 ; i < DHCP_MAX_OFFERS ; i++ ) {
420
+		if ( ! dhcp->offers[i].valid )
421
+			break;
422
+
420
 		if ( dhcp->offers[i].server.s_addr == server_id.s_addr ) {
423
 		if ( dhcp->offers[i].server.s_addr == server_id.s_addr ) {
421
 			DBGC ( dhcp, " dup\n" );
424
 			DBGC ( dhcp, " dup\n" );
422
 			return;
425
 			return;
423
 		}
426
 		}
424
-
425
-		if ( ! dhcp->offers[i].valid )
426
-			break;
427
 	}
427
 	}
428
 	if ( i == DHCP_MAX_OFFERS ) {
428
 	if ( i == DHCP_MAX_OFFERS ) {
429
 		DBGC ( dhcp, " dropped\n" );
429
 		DBGC ( dhcp, " dropped\n" );

Loading…
Cancel
Save