]> git.ipfire.org Git - thirdparty/ipxe.git/commitdiff
[dhcp] Don't consider invalid offers to be duplicates
authorJoshua Oreman <oremanj@rwcr.net>
Wed, 26 May 2010 21:22:03 +0000 (14:22 -0700)
committerMichael Brown <mcb30@ipxe.org>
Thu, 27 May 2010 09:22:05 +0000 (10:22 +0100)
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>
src/net/udp/dhcp.c

index 7850fb4b8fd8dabb87b01d2673c10f3d62f34327..a092a27efff740d4c3b20f92230bc117f8a6f947 100644 (file)
@@ -417,13 +417,13 @@ static void dhcp_rx_offer ( struct dhcp_session *dhcp,
 
        /* Enqueue an offer to be filled in */
        for ( i = 0 ; i < DHCP_MAX_OFFERS ; i++ ) {
+               if ( ! dhcp->offers[i].valid )
+                       break;
+
                if ( dhcp->offers[i].server.s_addr == server_id.s_addr ) {
                        DBGC ( dhcp, " dup\n" );
                        return;
                }
-
-               if ( ! dhcp->offers[i].valid )
-                       break;
        }
        if ( i == DHCP_MAX_OFFERS ) {
                DBGC ( dhcp, " dropped\n" );