From 905ea567534bbb67b83b2be41bfcd42209681e6a Mon Sep 17 00:00:00 2001 From: Joshua Oreman Date: Wed, 26 May 2010 14:22:03 -0700 Subject: [PATCH] [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 Signed-off-by: Michael Brown --- src/net/udp/dhcp.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/net/udp/dhcp.c b/src/net/udp/dhcp.c index 7850fb4b..a092a27e 100644 --- a/src/net/udp/dhcp.c +++ b/src/net/udp/dhcp.c @@ -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" );