<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2//EN">
<HTML>
<HEAD>
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=iso-8859-1">
<META NAME="Generator" CONTENT="MS Exchange Server version 6.5.7651.59">
<TITLE>[PATCH] DHCP Client Fix</TITLE>
</HEAD>
<BODY>
<!-- Converted from text/plain format -->
<P><FONT SIZE=2>commit e6e505eae94ed721e123e177489291fc4544b7b8<BR>
Author: Justin Flammia <jflammia@savantav.com><BR>
Date: Mon Oct 29 17:19:03 2007 -0400<BR>
<BR>
Found a bug in the way the DHCP Request packet is built, where the IP address<BR>
that is offered by the server is bound to prematurely. This patch is a fix of<BR>
that bug where the IP address offered by the DHCP server is not used until<BR>
after the DHCP ACK from the server is received.<BR>
<BR>
Signed-off-by: Justin Flammia <jflammia@savantav.com><BR>
---<BR>
net/bootp.c | 11 +++++++----<BR>
1 files changed, 7 insertions(+), 4 deletions(-)<BR>
<BR>
diff --git a/net/bootp.c b/net/bootp.c<BR>
index 749d3e5..cfe6f8d 100644<BR>
--- a/net/bootp.c<BR>
+++ b/net/bootp.c<BR>
@@ -850,9 +850,9 @@ static void DhcpSendRequestPkt(Bootp_t *bp_offer)<BR>
bp->bp_hlen = HWL_ETHER;<BR>
bp->bp_hops = 0;<BR>
bp->bp_secs = htons(get_timer(0) / CFG_HZ);<BR>
- NetCopyIP(&bp->bp_ciaddr, &bp_offer->bp_ciaddr); /* both in network byte order */<BR>
- NetCopyIP(&bp->bp_yiaddr, &bp_offer->bp_yiaddr);<BR>
- NetCopyIP(&bp->bp_siaddr, &bp_offer->bp_siaddr);<BR>
+ /* Do not set the client IP, your IP, or server IP yet, since it hasn't been ACK'ed by<BR>
+ * the server yet */<BR>
+<BR>
/*<BR>
* RFC3046 requires Relay Agents to discard packets with<BR>
* nonzero and offered giaddr<BR>
@@ -870,7 +870,9 @@ static void DhcpSendRequestPkt(Bootp_t *bp_offer)<BR>
/*<BR>
* Copy options from OFFER packet if present<BR>
*/<BR>
- NetCopyIP(&OfferedIP, &bp->bp_yiaddr);<BR>
+<BR>
+ /* Copy offered IP into the parameters request list */<BR>
+ NetCopyIP(&OfferedIP, &bp_offer->bp_yiaddr);<BR>
extlen = DhcpExtended((u8 *)bp->bp_vend, DHCP_REQUEST, NetDHCPServerIP, OfferedIP);<BR>
<BR>
pktlen = BOOTP_SIZE - sizeof(bp->bp_vend) + extlen;<BR>
@@ -980,3 +982,4 @@ void DhcpRequest(void)<BR>
#endif<BR>
<BR>
#endif<BR>
+<BR>
--<BR>
1.5.0.6<BR>
</FONT>
</P>
</BODY>
</HTML>